ChainID Guard

ChainID Guard

MCP server that gates premium features behind a combined x402 (USDC per call) and Stripe API key paywall, ensuring only paying users access deep functionality while free tier runs locally.

Category
Visit Server

README

_mcp-template-gated — MCP server template WITH the paywall gate baked in

This is the reusable factory template for every NEW MCP in the fleet. It is born with the server-side paywall gate already wired, so a new MCP can never again ship the premium tier for free (the bug that made conversion impossible on the first 10 servers).

The gate (the whole point)

  • src/mcpServer.ts — the locally-installed package. The FREE tier (deep=false) runs here. The PREMIUM tier (deep=true) does NOT run here: it is forwarded to the hosted /pro/run endpoint with Authorization: Bearer <KEY>. No key → an upsell (the premium is never executed for free).
  • src/server.ts — the hosted side. /pro/run is gated by two coexisting payment lanes:
    • x402 (USDC per call, for AI agents) via x402-express.
    • Stripe prepaid API key (for humans) — a valid Bearer key skips x402. The 402 body always shows BOTH lanes (pay_with_card_stripe + x402 accepts).
  • src/stripeLane.ts — Stripe Checkout → webhook mints an API key into KV.
  • src/kv.ts — Cloudflare KV (key store + funnel counters), degrades gracefully.
  • src/engine.ts — EXAMPLE engine. Replace run(input,{deep}) with the real logic. Keep the contract: deep=false cheap/local, deep=true premium/server-only.

Make a new MCP from this template

  1. Copy the folder: cp -r _mcp-template-gated <new-name>.
  2. Replace placeholders across the repo:
    • ChainID Guard → human name, e.g. dns-doctor
    • chainid-guard → npm/url slug, e.g. dns-doctor
    • SERVICE_KEY → the buyer's env var, e.g. DNS_DOCTOR_KEY (PowerShell one-liner is in the comment block of scripts/rename.txt.)
  3. In package.json/server.json/stripeLane.ts env defaults set:
    • STRIPE_KEY_PREFIX (e.g. dns_), STRIPE_PLAN_NAME, SERVICE_KEY_ENV, SERVICE_PRO_URL, homepage/PUBLIC_BASE_URL = the Vercel URL.
  4. Write the real engine.ts and the real tool schema/description in mcpServer.ts.
  5. npm install && npx tsc — must build clean.

Verify the gate (regla 7 — not done until this passes)

FORCE_LISTEN=true PORT=8899 PRO_API_KEYS=test_key X402_ENABLED=true node dist/server.js &
curl -s -o /dev/null -w "%{http_code}\n" "http://127.0.0.1:8899/run?target=x"                                  # 200 (free)
curl -s -o /dev/null -w "%{http_code}\n" "http://127.0.0.1:8899/pro/run?target=x"                              # 402 (no key)
curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer test_key" "http://127.0.0.1:8899/pro/run?target=x"  # 200 (paid key)
curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer wrong"    "http://127.0.0.1:8899/pro/run?target=x"  # 402 (bad key)

MCP stdio: deep=true without a key must print the UPSELL (never run premium); deep=false returns the local free result.

Production env (set in Vercel, sourced from config/)

STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, CLOUDFLARE_ACCOUNT_ID/API_TOKEN/KV_NAMESPACE_ID, optionally SERVICE_KEY. Everything degrades gracefully if a lane is unconfigured — the x402 gate + 402 always work even with no Stripe/KV. Never set the deep engine to run client-side.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured