MCPay logo

MCPay

Community
microchipgnu

Open-source Infrastructure for MCP and x402

Publishermicrochipgnu
RepositoryMCPay
LanguageTypeScript
Forks
35
Stars
90
Available tools
0
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    MCPay exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    90 stars and 35 forks from the linked repository.

MCPay

Follow on X (formerly Twitter) GitHub Repo stars License

Website   |   Browse Registry   |   Register/Monetize


What is MCPay?

MCPay is open-source infrastructure that adds on-chain payments to any Model Context Protocol (MCP) server using the x402 "Payment Required" protocol.

It enables MCP clients — such as ChatGPT, Cursor, and others — to make pay-per-call requests instead of relying on static subscriptions or API keys.

The goal is to let AI agents and applications pay only for what they use, automatically and transparently.


Why MCPay (in 30 seconds)

  • 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).
  • 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.
  • Agents → Perform real agent↔service micropayments, enabling autonomous access to APIs, inference, data, and more.

How it works

MCPay handles the entire payment lifecycle transparently for both developers and clients:

  • Follows x402 protocol with structured price metadata.
  • Accepts and verifies the on-chain payment, then automatically retries the original MCP request once confirmed.
  • Streams usage and revenue events to dashboards and analytics endpoints.

This mechanism ensures that any MCP-compatible app or agent can pay per call — either directly (via wallet) or through a delegated, policy-based proxy.

In practice, this means any MCP server can become a paid endpoint with zero friction.

The MCPay proxy acts as the coordination layer between clients, wallets, and upstream services — automatically handling 402 negotiation, on-chain payments, and retries.

Once 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.


Key components

1) Registry

Discover MCP servers and their priced tools at mcpay.tech/servers. Searchable, machine‑readable, agent‑friendly.

2) Monetizer (Proxy)

Wrap existing HTTP endpoints or MCP servers with the MCPay proxy to enforce pay‑per‑call. Zero code changes to your upstream service.

You can monetize via MCPay Registry or programmatically.


Quickstart

MCPay lets you add on-chain pricing to any MCP or OpenAPI server.

Whether you prefer to configure everything from the dashboard or define logic in code, both paths use the same x402 standard.

PathBest forWhat it does
WebsiteFastest go-live, existing servicesConfigure prices per tool/route in the dashboard.
SDKCustom logic & full controlDefine paid tools in code, set pricing, and ship an MCP server that speaks x402 out of the box.

Option A — Connect to a paid MCP server (CLI)

Start an MCP stdio proxy to one or more remote MCP servers. Use either an API key or a wallet private key.

bash
# Using an API key (recommended)
npx mcpay connect --urls https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470 --api-key mcpay_YOUR_API_KEY

# Or using an EVM wallet private key (x402 payments)
npx mcpay connect --urls https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470 --evm 0xYOUR_PRIVATE_KEY --evm-network base-sepolia

# Or using an SVM wallet secret key (x402 payments)
npx mcpay connect --urls https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470 --svm YOUR_SECRET_KEY --svm-network solana-devnet

You can pass multiple URLs via a comma‑separated list to --urls.

Option B — Programmatic client (SDK)

ts
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
import { withX402Client } from 'mcpay/client'
import { createSigner } from 'x402/types'

// Create signer for EVM network
const evmSigner = await createSigner('base-sepolia', process.env.EVM_PRIVATE_KEY!) // dev only; secure in prod
const url = new URL('https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470')

// Create transport
const transport = new StreamableHTTPClientTransport(url)

// Initialize MCP client
const client = new Client({ name: 'my-mcp-client', version: '1.0.0' }, { capabilities: {} })
await client.connect(transport)

// Wrap client with X402 payment capabilities
const paymentClient = withX402Client(client, {
  wallet: { evm: evmSigner },
  maxPaymentValue: BigInt(0.1 * 10 ** 6) // limit max on‑chain value (base units, e.g. 6‑decimals for USDC)
})

const tools = await paymentClient.listTools()
console.log('Available tools:', tools)

SDK

Install:

bash
npm i mcpay   # pnpm add mcpay / yarn add mcpay / bun add mcpay

Features:

  • Automatic 402 handling (x402 pattern).
  • Works with plain HTTP and MCP servers.
  • Pluggable wallet/transport; supports multiple chains/tokens (EVM & SVM).
  • Includes a CLI for local/prod proxying.
  • Support for Base, Avalanche, IoTeX, Sei (EVM) and Solana (SVM) networks.

See js-sdk/README.md for API details.

Building monetized server (Hono)

ts
import { Hono } from "hono"
import { createMcpPaidHandler } from "mcpay/handler"
import { z } from "zod"

const app = new Hono()

const handler = createMcpPaidHandler(
    (server) => {
        server.paidTool(
            "weather",
            "Paid tool",
            "$0.001",
            { city: z.string() },
            {},
            async ({ city }) => ({
                content: [{ type: "text", text: `The weather in ${city} is sunny` }],
            })
        )

        server.tool(
            "free_tool",
            "Free to use",
            { s: z.string(), city: z.string() },
            async ({ s, city }) => ({
                content: [{ type: "text", text: `We support ${city}` }],
            })
        )
    },
    {
        facilitator: {
            url: "https://facilitator.mcpay.tech"
        },
        recipient: {
            "evm": {address: "0xc9343113c791cB5108112CFADa453Eef89a2E2A2", isTestnet: true},
            "svm": {address: "4VQeAqyPxR9pELndskj38AprNj1btSgtaCrUci8N4Mdg", isTestnet: true}
        }
    },
    {
        serverInfo: { name: "paid-mcp", version: "1.0.0" },
    },
)

app.use("*", (c) => handler(c.req.raw))

export default app

CLI

Start a local stdio proxy to remote MCP servers:

json
{
  "mcpServers": {
    "Paid Server": {
      "command": "npx",
      "args": [
        "mcpay",
        "connect",
        "--urls",
        "https://mcpay.tech/v1/mcp/05599356-7a27-4519-872a-2ebb22467470",
        "--api-key",
        "mcpay_YOUR_API_KEY"
      ]
    }
  }
}

Run mcpay connect --help for all flags.

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "microchipgnu-mcpay": {
      "command": "npx",
      "args": [
        "-y",
        "mcpay-monorepo"
      ]
    }
  }
}

Use MCPay MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCPay is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCPay as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCPay MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "microchipgnu-mcpay": {
      "command": "npx",
      "args": [
        "-y",
        "mcpay-monorepo"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCPay MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCPay MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCPay to help me with this task?
MCPay
Sure. I read it.
Here is what I found using MCPay.

Frequently asked questions

What is the MCPay MCP server used for?

MCPay is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCPay MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCPay with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCPay MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCPay connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCPay MCP to TypingMind?

MCPay runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MCPay MCP provide in TypingMind?

MCPay exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCPay MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCPay requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇