Payment enforcement proxy for MCP servers - adds x402 monetization to any MCP endpoint
mcp-gateway is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 0 GitHub stars and 0 forks.
Payment enforcement proxy that wraps any existing MCP server with x402 payment requirements.
Production URL: https://gateway.cronos402.dev
The MCP Gateway acts as a payment enforcement layer, allowing you to monetize any existing MCP server without modifying its code. It intercepts tool calls, validates payments using the x402 protocol, and forwards requests to the upstream MCP server only after successful payment verification. This enables developers to add payment requirements to both their own servers and third-party MCP services.
pnpm install
pnpm dev
Server runs on http://localhost:3006
pnpm build
pnpm start
DATABASE_URL=postgresql://user:password@localhost:5432/cronos402
UPSTREAM_MCP_URL=https://upstream-server.com/mcp
CRONOS_NETWORK=cronos-testnet
RECIPIENT_ADDRESS=0xYourAddress
FACILITATOR_URL=https://facilitator.cronoslabs.org/v2/x402
Configure per-tool pricing in your environment or database:
const toolPricing = {
'get_weather': '0.01', // $0.01 per call
'premium_data': '0.10', // $0.10 per call
'ai_analysis': '0.50' // $0.50 per call
};
Point to any MCP server:
UPSTREAM_MCP_URL=https://api.example.com/mcp
The gateway will proxy all MCP operations to this server after payment validation.
_meta['x402/payment']Client → Gateway → Upstream MCP Server
↓
Payment Check
↓
Facilitator
import { createMcpGateway } from '@cronos402/mcp-gateway';
const gateway = createMcpGateway({
upstreamUrl: 'https://api.example.com/mcp',
recipient: '0xYourAddress',
network: 'cronos-testnet',
pricing: {
'tool_name': '0.01'
}
});
gateway.listen(3006);
Clients use the gateway URL instead of the upstream server:
# Instead of connecting to upstream directly
npx cronos402 connect --urls https://api.example.com/mcp
# Connect through payment gateway
npx cronos402 connect --urls https://gateway.cronos402.dev/proxy/api.example.com
{
"mcpServers": {
"Paid Service": {
"command": "npx",
"args": [
"cronos402",
"connect",
"--urls",
"https://gateway.cronos402.dev/proxy/upstream",
"--private-key",
"0x...",
"--network",
"cronos-testnet"
]
}
}
}
Gateway MCP endpoint. Proxies to upstream after payment validation.
Health check endpoint.
Returns current tool pricing configuration.
Update tool pricing (requires admin authentication).
gateway_requests - All proxied requestspayment_validations - Payment verification recordstool_usage - Per-tool usage statisticsupstream_servers - Registered upstream serverspnpm drizzle-kit generate
pnpm drizzle-kit migrate
pnpm build
NODE_ENV=production pnpm start
FROM node:20-alpine
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
EXPOSE 3006
CMD ["pnpm", "start"]
# Run all tests
pnpm test
# Watch mode
pnpm test:watch
# Coverage
pnpm test:coverage
GET /health - Server health statusGET /metrics - Prometheus metricsMIT
The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.
Daydreams is a set of tools for building agents for commerce
The first agentic payment network: policy-controlled, gasless, and real money-ready. OmniClaw CLI + Financial Policy Engine let autonomous agents pay and earn safely at machine speed.
Agent behavior that compiles
The A2A x402 Extension brings cryptocurrency payments to the Agent-to-Agent (A2A) protocol, enabling agents to monetize their services through on-chain payments. This extension revives the spirit of HTTP 402 "Payment Required" for the decentralized agent ecosystem.
Live data for AI agents — search, research, markets, crypto, X/Twitter. Pay-per-call via x402 micropayments.