{"_id":"@accord-protocol/mcp","_rev":"3-99a0f992708d28038d7c476275e54340","name":"@accord-protocol/mcp","dist-tags":{"latest":"0.4.2"},"versions":{"0.4.0":{"name":"@accord-protocol/mcp","version":"0.4.0","keywords":["accord-protocol","mcp","model-context-protocol","paid-tools","agent-payments","agreement"],"author":{"name":"bez111"},"license":"MIT","_id":"@accord-protocol/mcp@0.4.0","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"homepage":"https://github.com/accord-protocol/accord-protocol/tree/main/packages/accord-mcp","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dist":{"shasum":"54223a5762e9494b7458e4c33b6908a765b1ab55","tarball":"https://registry.npmjs.org/@accord-protocol/mcp/-/mcp-0.4.0.tgz","fileCount":6,"integrity":"sha512-snYSem44yqsyO0Ni7GhkdfNTg2PJgBRVYNfqfWZVsF6oFPOJRV/QTklWU2/5PN0K5Z73nHYE4qg1X8VcUB9FBw==","signatures":[{"sig":"MEYCIQCHlMvhSggXZtCLJ2j7xH4sZie8fZeO9ZlsbcZ2OVRL1wIhALJnQvv4yoLmNxzfE7kPwxwNsW3A6Ky4HMNqkecFlrqc","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34464},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"3de0b386d2e83302cac87206d198a8a799b6baa8","scripts":{"test":"npx tsx --test src/__tests__/*.test.ts","build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"},"repository":{"url":"git+https://github.com/accord-protocol/accord-protocol.git","type":"git","directory":"packages/accord-mcp"},"_npmVersion":"10.9.4","description":"Accord/MCP transport wrapper. Turn any MCP tool into a paid, verifiable Accord engagement: validate Agreement, verify payment via rail adapter, emit Verification + Settlement Receipts. Rail-agnostic. See specs/ACCORD-005-accord-mcp.md.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"@accord-protocol/core":"^0.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp_0.4.0_1778775549269_0.8750161207142755","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@accord-protocol/mcp","version":"0.4.1","keywords":["accord-protocol","mcp","model-context-protocol","paid-tools","agent-payments","agreement"],"author":{"name":"bez111"},"license":"MIT","_id":"@accord-protocol/mcp@0.4.1","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"homepage":"https://github.com/accord-protocol/accord-protocol/tree/main/packages/accord-mcp","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dist":{"shasum":"88a1eab213a9e567c746e680f0bfe306919c9b00","tarball":"https://registry.npmjs.org/@accord-protocol/mcp/-/mcp-0.4.1.tgz","fileCount":6,"integrity":"sha512-rtMscxm4lC7UrBDimxkozZ7LrQ7u2CaRCFQd8vIA2CEFFFtOnP5/2mz/D4ypBjCQ3tiUI79tAx7U/kFvl2P6Hg==","signatures":[{"sig":"MEYCIQD4IcEn5pwmgVytiATRzWYGlAfwain/yod8cVjyR8vNwQIhAJQ+AsofMU4BX974ChoGrvtSbErd1ShBdeo4vxNeVIIB","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@accord-protocol%2fmcp@0.4.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":34472},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"e42de427235ef205df05351fb51e607b159d23b6","scripts":{"test":"npx tsx --test src/__tests__/*.test.ts","build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:150dbd58-0f9e-49c7-8d04-88b1eda41263"}},"repository":{"url":"git+https://github.com/accord-protocol/accord-protocol.git","type":"git","directory":"packages/accord-mcp"},"_npmVersion":"11.14.1","description":"Accord/MCP transport wrapper. Turn any MCP tool into a paid, verifiable Accord engagement: validate Agreement, verify payment via rail adapter, emit Verification + Settlement Receipts. Rail-agnostic. See specs/ACCORD-005-accord-mcp.md.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"@accord-protocol/core":"^0.4.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mcp_0.4.1_1778872880003_0.4286085739215355","host":"s3://npm-registry-packages-npm-production"}},"0.4.2":{"name":"@accord-protocol/mcp","version":"0.4.2","description":"Accord/MCP transport wrapper. Turn any MCP tool into a paid, verifiable Accord engagement: validate Agreement, verify payment via rail adapter, emit Verification + Settlement Receipts. Rail-agnostic. See specs/ACCORD-005-accord-mcp.md.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit","test":"npx tsx --test src/__tests__/*.test.ts"},"keywords":["accord-protocol","mcp","model-context-protocol","paid-tools","agent-payments","agreement"],"author":{"name":"bez111"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/accord-protocol/accord-protocol.git","directory":"packages/accord-mcp"},"homepage":"https://accordprotocol.ai/learn/accord-mcp-paid-tools/","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dependencies":{"@accord-protocol/core":"^0.4.2"},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.0","tsx":"^4.0.0","typescript":"^5.0.0"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"gitHead":"437febb0a70b3162d4b10b19874f1a0026a59bdf","_id":"@accord-protocol/mcp@0.4.2","_nodeVersion":"24.15.0","_npmVersion":"11.15.0","dist":{"integrity":"sha512-5BJkVccdeKmagHOlK9UtWQlAugaP+r5nveMLrs5pLR7x/KqlzkkmjTBmdXnUJNVNJthlsaYIsCMZRw91uUp/dw==","shasum":"6b168f326c409c9664fb768004fe5f8ec27755df","tarball":"https://registry.npmjs.org/@accord-protocol/mcp/-/mcp-0.4.2.tgz","fileCount":6,"unpackedSize":34623,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@accord-protocol%2fmcp@0.4.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBGbPQiLYjPdDmla70ZXfMbBcA75v+/odKUm/LvOO2QJAiEAyscD0xg1bss4uuEJXtIkSqDOQT8/R4ZB8b8B3dP1Ljw="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:150dbd58-0f9e-49c7-8d04-88b1eda41263"}},"directories":{},"maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp_0.4.2_1779582021818_0.6765620182435517"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-14T16:19:09.189Z","modified":"2026-05-24T00:20:22.247Z","0.4.0":"2026-05-14T16:19:09.441Z","0.4.1":"2026-05-15T19:21:20.209Z","0.4.2":"2026-05-24T00:20:21.964Z"},"bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"author":{"name":"bez111"},"license":"MIT","homepage":"https://accordprotocol.ai/learn/accord-mcp-paid-tools/","keywords":["accord-protocol","mcp","model-context-protocol","paid-tools","agent-payments","agreement"],"repository":{"type":"git","url":"git+https://github.com/accord-protocol/accord-protocol.git","directory":"packages/accord-mcp"},"description":"Accord/MCP transport wrapper. Turn any MCP tool into a paid, verifiable Accord engagement: validate Agreement, verify payment via rail adapter, emit Verification + Settlement Receipts. Rail-agnostic. See specs/ACCORD-005-accord-mcp.md.","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"readme":"# `@accord-protocol/mcp`\n\n**Accord/MCP transport wrapper.** Turns any MCP tool into a paid, verifiable Accord engagement: validate Agreement, verify payment via a rail adapter, run the seller's handler, optionally call a verifier, emit Verification + Settlement Receipts.\n\nPublic docs: [Website](https://accordprotocol.ai/) · [Accord/MCP guide](https://accordprotocol.ai/learn/accord-mcp-paid-tools/) · [Status](https://accordprotocol.ai/status/)\n\nRail-agnostic — the wrapper takes any `AccordRailAdapter`. Reference rail adapters (`@accord-protocol/rails-ergo`, `@accord-protocol/rails-base`, `@accord-protocol/rails-x402`) land separately.\n\n## Install\n\n```bash\nnpm install @accord-protocol/mcp @accord-protocol/core\n```\n\n## Quickstart\n\n```ts\nimport { wrapAccordMcp, describeAccordMcpTool, type AccordRailAdapter } from \"@accord-protocol/mcp\";\n\n// Plug your real rail in here. Stub for illustration:\nconst rail: AccordRailAdapter = {\n  rail: \"ergo\",\n  async verifyPayment({ agreement, payment }) {\n    return { ok: true, rail: \"ergo\" };\n  },\n  async settle({ agreement }) {\n    return { /* AccordSettlementReceipt */ } as never;\n  },\n};\n\nconst callPaidSummariser = wrapAccordMcp({\n  rail,\n  // Plug your storage here. The wrapper will reject calls whose\n  // accord_agreement_id this function can't resolve.\n  resolveAgreement: async (id) => store.get(id),\n\n  // Optional. Only invoked when agreement.verification.required is true.\n  // verifier: async ({ agreement, output }) => signedReceipt,\n\n  handler: async ({ text }, { agreement }) => {\n    return { word_count: text.split(/\\s+/).length };\n  },\n});\n\n// And the MCP tool definition with Accord fields injected:\nconst toolDef = describeAccordMcpTool({\n  name: \"summarise\",\n  description: \"Summarise text. Paid.\",\n  inputSchema: { type: \"object\", properties: { text: { type: \"string\" } }, required: [\"text\"] },\n});\n```\n\n## What the wrapper does on every call\n\n```text\n1. Pull accord_agreement_id / accord_payment / accord_task_output from buyer's args\n2. resolveAgreement(id)                       → reject if unknown\n3. validateAgreement(agreement)                → reject on cross-field problems\n4. rail.verifyPayment(agreement, payment)      → reject if payment fails\n5. (optional) check accord_task_output hash    → reject if it doesn't match agreement.task.output_hash\n6. handler(strippedArgs, { agreement })        → run the seller's tool\n7. (if required) verifier(agreement, output)\n   + validateVerificationReceipt(receipt)\n   + check result !== \"rejected\"\n8. (best-effort) rail.settle(...)              → don't reject the call if settle fails\n9. return output + _meta.accord_*\n```\n\nThe wrapper **returns** structured errors (`isError: true` + `_meta.accord_error_code`) instead of throwing. MCP clients are easier to wire that way.\n\n## Error codes\n\n| Code | When |\n|---|---|\n| `MISSING_AGREEMENT_ID` | Buyer didn't include `accord_agreement_id` |\n| `MISSING_PAYMENT` | Buyer didn't include `accord_payment` |\n| `UNKNOWN_AGREEMENT` | `resolveAgreement(id)` returned undefined or threw |\n| `AGREEMENT_INVALID` | `validateAgreement` from `@accord-protocol/core` rejected |\n| `PAYMENT_VERIFICATION_FAILED` | Rail returned `{ ok: false }` |\n| `RAIL_UNAVAILABLE` | Rail's `verifyPayment` threw |\n| `TASK_OUTPUT_HASH_MISMATCH` | Buyer's `accord_task_output` hash ≠ `agreement.task.output_hash` |\n| `HANDLER_THREW` | Seller's handler threw |\n| `VERIFICATION_REQUIRED` | `agreement.verification.required` is true but no verifier configured |\n| `VERIFICATION_REJECTED` | Verifier rejected, or returned an invalid receipt |\n\n## What's NOT in this package\n\n- Rail adapters (Ergo / Rosen / Base / x402) → `@accord-protocol/rails-*`\n- HTTP-side transport → `@accord-protocol/gateway` + `@accord-protocol/x402`\n- Conformance tests → `@accord-protocol/conformance`\n- An MCP server runtime — bring your own (`@modelcontextprotocol/sdk` etc.). The wrapper is a function over args / results, framework-agnostic.\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}