{"id":43015739,"url":"https://github.com/microchipgnu/mcpay","last_synced_at":"2026-04-26T18:02:16.297Z","repository":{"id":296638715,"uuid":"993439503","full_name":"microchipgnu/MCPay","owner":"microchipgnu","description":"Open-source Infrastructure for MCP and x402","archived":false,"fork":false,"pushed_at":"2026-01-21T20:59:47.000Z","size":33960,"stargazers_count":82,"open_issues_count":5,"forks_count":27,"subscribers_count":9,"default_branch":"main","last_synced_at":"2026-02-11T01:48:29.712Z","etag":null,"topics":["mcp","x402"],"latest_commit_sha":null,"homepage":"https://mcpay.tech","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microchipgnu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-30T19:45:27.000Z","updated_at":"2026-02-07T23:09:22.000Z","dependencies_parsed_at":"2025-12-03T23:11:06.630Z","dependency_job_id":"d4879a9b-10b8-4ebd-a39b-98b8a7f78804","html_url":"https://github.com/microchipgnu/MCPay","commit_stats":null,"previous_names":["microchipgnu/mcpay.fun","microchipgnu/mcpay"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/microchipgnu/MCPay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microchipgnu%2FMCPay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microchipgnu%2FMCPay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microchipgnu%2FMCPay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microchipgnu%2FMCPay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microchipgnu","download_url":"https://codeload.github.com/microchipgnu/MCPay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microchipgnu%2FMCPay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32307016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T17:23:19.671Z","status":"ssl_error","status_checked_at":"2026-04-26T17:23:19.195Z","response_time":129,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcp","x402"],"created_at":"2026-01-31T06:00:34.785Z","updated_at":"2026-04-26T18:02:16.266Z","avatar_url":"https://github.com/microchipgnu.png","language":"TypeScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# [MCPay](https://mcpay.tech)\n\n![](/assets/gh_cover.png)\n\n\u003cdiv align=\"center\"\u003e\n    \n  [![Follow on X (formerly Twitter)](https://img.shields.io/twitter/follow/mcpaytech?label=Follow%20%40mcpaytech\u0026style=social)](https://twitter.com/mcpaytech)\n  [![GitHub Repo stars](https://img.shields.io/github/stars/microchipgnu/mcpay?style=social)](https://github.com/microchipgnu/mcpay) \n  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n\u003c/div\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n\n[Website](https://mcpay.tech) \u0026nbsp;\u0026nbsp;|\u0026nbsp;\u0026nbsp;\n[Browse Registry](https://mcpay.tech/servers) \u0026nbsp;\u0026nbsp;|\u0026nbsp;\u0026nbsp;\n[Register/Monetize](https://mcpay.tech/register)\n\n\u003c/div\u003e\n\n---\n\n## What is MCPay?\n\nMCPay is open-source infrastructure that adds **on-chain payments** to any [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server using the [x402 \"Payment Required\" protocol](https://x402.org).\n\nIt enables MCP clients — such as ChatGPT, Cursor, and others — to make **pay-per-call requests** instead of relying on static subscriptions or API keys.\n\nThe goal is to let AI agents and applications pay only for what they use, automatically and transparently.\n\n---\n\n## Why MCPay (in 30 seconds)\n\n* **Clients** → Pay only for what they use — no subscriptions, no keys, no setup. Works out of the box with MCP-compatible apps (ChatGPT, Cursor, and more).\n* **Developers** → Monetize and get discovered instantly using our SDK (or a compatible one), monetization wrapper, or public index. Set per-call, per-token, or dynamic pricing and receive payments automatically.\n* **Agents** → Perform real **agent↔service micropayments**, enabling autonomous access to APIs, inference, data, and more.\n\n---\n\n## How it works\n\nMCPay handles the entire payment lifecycle transparently for both developers and clients:\n\n- Follows x402 protocol with structured price metadata.\n- Accepts and verifies the on-chain payment, then automatically retries the original MCP request once confirmed.\n- Streams usage and revenue events to dashboards and analytics endpoints.\n\nThis mechanism ensures that any MCP-compatible app or agent can pay per call — either directly (via wallet) or through a delegated, policy-based proxy.\n\n```mermaid\nsequenceDiagram\n  participant C as MCP Client\n  participant CP as Client Proxy + Wallet\n  participant P as MCPay Proxy (Edge)\n  participant U as Upstream Service\u003cbr/\u003e(Server Proxy / x402 MCP / api2 / mcp2)\n  participant B as Blockchain (USDC/EUROe)\n  participant D as Analytics/Dashboard\n\n  C-\u003e\u003eCP: (1) MCP call\n  CP-\u003e\u003eP: (2) Forward request\n\n  %% normal path: proxy upstreams the original call\n  P-\u003e\u003eU: (3) Upstream original request\n\n  alt Upstream returns price-gated\n    U--\u003e\u003eP: (4) 402 + price metadata\n\n    alt Proxy is authorized to pay (MCPay Auth/wallet \u0026 policy allows)\n      P-\u003e\u003eB: (5a) Pay on-chain\n      B--\u003e\u003eP: (6a) Payment confirmation\n      P-\u003e\u003eU: (7a) Retry original request\n      U--\u003e\u003eP: (8a) Result\n      P--\u003e\u003eCP: (9a) Forward result\n      CP--\u003e\u003eC: (10a) Deliver result\n    else Proxy cannot/shouldn't pay\n      P--\u003e\u003eCP: (5b) Downstream 402 + price metadata\n      CP-\u003e\u003eB: (6b) Client-side payment (sign via wallet/MCPay Auth)\n      B--\u003e\u003eP: (7b) Confirmation to proxy\n      P-\u003e\u003eU: (8b) Retry original request\n      U--\u003e\u003eP: (9b) Result\n      P--\u003e\u003eCP: (10b) Forward result\n      CP--\u003e\u003eC: (11b) Deliver result\n    end\n\n  else Upstream returns success\n    U--\u003e\u003eP: (4') Tool result\n    P--\u003e\u003eCP: (5') Forward result\n    CP--\u003e\u003eC: (6') Deliver result\n  end\n\n  P--\u003e\u003eD: (✱) Emit usage \u0026 revenue events (both branches)\n\n```\n\nIn practice, this means any MCP server can become a paid endpoint with zero friction.\n\nThe MCPay proxy acts as the coordination layer between **clients, wallets, and upstream services** — automatically handling `402` negotiation, on-chain payments, and retries.\n\nOnce a payment is confirmed, the same request is retried transparently, and the result is streamed back to the client along with usage and revenue data.\n\n---\n\n## Key components\n\n### 1) Registry\n\nDiscover MCP servers and their priced tools at **[mcpay.tech/servers](https://mcpay.tech/servers)**. Searchable, machine‑readable, agent‑friendly.\n\n### 2) Monetizer (Proxy)\n\nWrap existing HTTP endpoints or MCP servers with the **MCPay proxy** to enforce pay‑per‑call. Zero code changes to your upstream service.\n\nYou can monetize via [MCPay Registry](https://mcpay.tech/register) or [programmatically](./packages/js-sdk/README.md).\n\n---\n\n## Quickstart\n\nMCPay lets you add on-chain pricing to any MCP or OpenAPI server.\n\nWhether you prefer to configure everything from the dashboard or define logic in code, both paths use the same x402 standard.\n\n| Path | Best for | What it does |\n|---|---|---|\n| **[Website](https://mcpay.tech/register)** | Fastest go-live, existing services | Configure prices per tool/route in the dashboard. |\n| **[SDK](./packages/js-sdk/README.md)** | Custom logic \u0026 full control | Define **paid tools** in code, set pricing, and ship an MCP server that speaks x402 out of the box. |\n\n### Option A — Connect to a paid MCP server (CLI)\n\nStart an MCP stdio proxy to one or more remote MCP servers. Use either an API key or a wallet private key.\n\n```bash\n# Using an API key (recommended)\nnpx mcpay connect --urls https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470 --api-key mcpay_YOUR_API_KEY\n\n# Or using an EVM wallet private key (x402 payments)\nnpx mcpay connect --urls https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470 --evm 0xYOUR_PRIVATE_KEY --evm-network base-sepolia\n\n# Or using an SVM wallet secret key (x402 payments)\nnpx mcpay connect --urls https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470 --svm YOUR_SECRET_KEY --svm-network solana-devnet\n```\n\nYou can pass multiple URLs via a comma‑separated list to `--urls`.\n\n### Option B — Programmatic client (SDK)\n\n```ts\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js'\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'\nimport { withX402Client } from 'mcpay/client'\nimport { createSigner } from 'x402/types'\n\n// Create signer for EVM network\nconst evmSigner = await createSigner('base-sepolia', process.env.EVM_PRIVATE_KEY!) // dev only; secure in prod\nconst url = new URL('https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470')\n\n// Create transport\nconst transport = new StreamableHTTPClientTransport(url)\n\n// Initialize MCP client\nconst client = new Client({ name: 'my-mcp-client', version: '1.0.0' }, { capabilities: {} })\nawait client.connect(transport)\n\n// Wrap client with X402 payment capabilities\nconst paymentClient = withX402Client(client, {\n  wallet: { evm: evmSigner },\n  maxPaymentValue: BigInt(0.1 * 10 ** 6) // limit max on‑chain value (base units, e.g. 6‑decimals for USDC)\n})\n\nconst tools = await paymentClient.listTools()\nconsole.log('Available tools:', tools)\n```\n\n---\n\n## SDK\n\nInstall:\n\n```bash\nnpm i mcpay   # pnpm add mcpay / yarn add mcpay / bun add mcpay\n```\n\nFeatures:\n\n* Automatic `402` handling (x402 pattern).\n* Works with plain HTTP **and** MCP servers.\n* Pluggable wallet/transport; supports multiple chains/tokens (EVM \u0026 SVM).\n* Includes a **CLI** for local/prod proxying.\n* Support for Base, Avalanche, IoTeX, Sei (EVM) and Solana (SVM) networks.\n\nSee **[js-sdk/README.md](./js-sdk/README.md)** for API details.\n\n### Building monetized server (Hono)\n\n```ts\nimport { Hono } from \"hono\"\nimport { createMcpPaidHandler } from \"mcpay/handler\"\nimport { z } from \"zod\"\n\nconst app = new Hono()\n\nconst handler = createMcpPaidHandler(\n    (server) =\u003e {\n        server.paidTool(\n            \"weather\",\n            \"Paid tool\",\n            \"$0.001\",\n            { city: z.string() },\n            {},\n            async ({ city }) =\u003e ({\n                content: [{ type: \"text\", text: `The weather in ${city} is sunny` }],\n            })\n        )\n\n        server.tool(\n            \"free_tool\",\n            \"Free to use\",\n            { s: z.string(), city: z.string() },\n            async ({ s, city }) =\u003e ({\n                content: [{ type: \"text\", text: `We support ${city}` }],\n            })\n        )\n    },\n    {\n        facilitator: {\n            url: \"https://facilitator.mcpay.tech\"\n        },\n        recipient: {\n            \"evm\": {address: \"0xc9343113c791cB5108112CFADa453Eef89a2E2A2\", isTestnet: true},\n            \"svm\": {address: \"4VQeAqyPxR9pELndskj38AprNj1btSgtaCrUci8N4Mdg\", isTestnet: true}\n        }\n    },\n    {\n        serverInfo: { name: \"paid-mcp\", version: \"1.0.0\" },\n    },\n)\n\napp.use(\"*\", (c) =\u003e handler(c.req.raw))\n\nexport default app\n```\n\n---\n\n## CLI\n\nStart a local stdio proxy to remote MCP servers:\n\n```json\n{\n  \"mcpServers\": {\n    \"Paid Server\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"mcpay\",\n        \"connect\",\n        \"--urls\",\n        \"https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470\",\n        \"--api-key\",\n        \"mcpay_YOUR_API_KEY\"\n      ]\n    }\n  }\n}\n```\n\nRun `mcpay connect --help` for all flags.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrochipgnu%2Fmcpay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrochipgnu%2Fmcpay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrochipgnu%2Fmcpay/lists"}