Counterparty MCP
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
Counterparty MCP
Pay-per-call counterparty due-diligence tools for AI agents, served as a stateless MCP server on Cloudflare Workers. Agents pay in USDC per tool call using the x402 MCP transport, with no account or API key needed.
Tool | Price | What it returns |
| free | Name, ticker or CIK to SEC CIK candidates |
| $0.01 | GLEIF LEI status, jurisdiction, address, direct and ultimate parent |
| $0.02 | Fuzzy OFAC SDN matches (aliases included), programs, Treasury links |
| $0.02 | Company profile and recent filings, with 8-K items decoded and red flags marked |
| $0.03 | Latest annual XBRL financials and ratios |
| $0.15 | Everything above in one call, with risk flags and evidence links |
Prices live in src/pricing.ts, the single source of truth that also generates llms.txt and pricing.json. Basic tools allow FREE_TRIAL_CALLS_PER_DAY unpaid calls per client per day.
Informational screening from public government data. Not legal advice and not a substitute for a regulated KYC/AML program.
Architecture
AI agent / MCP client Cloudflare Worker (stateless) External
───────────────────── ───────────────────────────── ────────
tools/list ───────────────────────────▶ /mcp (MCP SDK, Streamable HTTP, JSON mode)
tools/call (no payment) ───────────────▶ paywall ──▶ isError + x402 PaymentRequired
sign EIP-3009 for exact amount
tools/call + _meta["x402/payment"] ────▶ paywall
1. precheck: amount, payTo, network, expiry window
2. KV ledger (network:payer:nonce)
settled+same args → cached result, no charge
settled+other args → payment_already_used
3. per-payer daily spend cap (KV)
4. facilitator /verify ───────────────────────▶ x402 facilitator
5. run tool ──────────────────────────────────▶ OFAC / SEC / GLEIF
tool error → no settle → not charged (edge-cached)
6. facilitator /settle ───────────────────────▶ USDC on Base
settle fails → output withheld
7. store result in ledger (7 days), meter
result + _meta["x402/payment-response"] ◀─ Analytics Engine data point + Workers LogsThere is no database. KV holds the idempotency ledger, counters, and the OFAC sanctions index, which a cron trigger refreshes every 6 hours. Analytics Engine records usage and revenue. The Rate Limiting binding caps each client at 60 requests a minute. The server never holds a private key; it only receives payments to a public address.
Security model
Payment before work. The facilitator
/verifycall (read-only, moves no funds) runs before any tool executes. Settlement runs only after the tool succeeds.Replay protection, layered. (1) The EIP-3009 nonce is single-use on-chain, so the facilitator cannot settle it twice. (2) The payment must match this tool's exact amount, our
payTo, network and asset. (3) Authorizations valid for more than about 3 minutes are rejected. (4) The KV ledger rejects a used payment on a different request.Idempotency. Retrying the same tool and arguments with the same payment returns the stored result and does not charge again. That covers network timeouts.
No double charge, even under races. KV is eventually consistent, so two simultaneous duplicates can both run the tool. Only one can settle; the other gets a settlement error and no output.
Spending limits.
PAYER_DAILY_SPEND_CAP_USDper payer address per UTC day protects agents from runaway loops.Abuse and validation. Zod schemas on every input, a 64 KB body limit, a rate limit on hashed client IPs (raw IPs are never stored), and a guard against truncated sanctions downloads.
Secrets.
X402_PAY_TOis a public address. The only other secrets are facilitator API credentials (CDP_API_KEY_*orX402_FACILITATOR_AUTH), which cannot move funds. Never put a private key or seed phrase anywhere in this project.
Related MCP server: dyoe-agent-tools-mcp
Quick start (local)
npm install
cp .dev.vars.example .dev.vars # set X402_PAY_TO to your receiving address
npm test # 29 tests: payments, replay, idempotency, tools
npm run dev # http://localhost:8787Smoke test:
curl -s localhost:8787/mcp -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
curl -s localhost:8787/mcp -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"counterparty_brief","arguments":{"query":"AAPL"}}}'
# -> isError: true with x402 PaymentRequired (amount "150000" = $0.15 USDC)
curl -s localhost:8787/llms.txtDeploy
1. Testnet (Base Sepolia), the default config
npx wrangler login
npx wrangler kv namespace create LEDGER # paste the id into wrangler.jsonc
# Requires the Workers Paid plan ($5/mo): sanctions screening needs more than the Free plan's 10 ms CPU per request.
npx wrangler secret put X402_PAY_TO # your receiving wallet address (public)
# edit wrangler.jsonc: PUBLIC_BASE_URL, SEC_USER_AGENT (real contact email, required by SEC)
npm run deploy:testnetGet test USDC from the Circle faucet, then pay for a call with any x402-capable MCP client. Examples include the @x402/mcp client wrappers and Cloudflare Agents' withX402Client. Confirm the transaction on Base Sepolia's explorer.
2. Mainnet (Base)
The mainnet values are already in wrangler.jsonc under env.mainnet (same worker name, so the same URL switches over). The whole switch is:
npx wrangler secret put CDP_API_KEY_ID --env mainnet
npx wrangler secret put CDP_API_KEY_SECRET --env mainnet
npm run deploy:mainnetFirst real payment: npm run pay:test (see scripts/pay-test.ts) signs one $0.02 call with a payer key you set in PAYER_PRIVATE_KEY, locally, and prints the BaseScan link.
npm run deploy now also deploys mainnet. To go back to testnet, run npm run deploy:testnet. For reference, the mainnet values are:
Var | Mainnet value |
|
|
|
|
|
|
| A mainnet facilitator, such as Coinbase CDP |
For the Coinbase CDP facilitator (1,000 free settlements a month, then $0.001 each), set X402_FACILITATOR_URL to https://api.cdp.coinbase.com/platform/v2/x402. Then store a CDP API key as secrets:
npx wrangler secret put CDP_API_KEY_ID
npx wrangler secret put CDP_API_KEY_SECRET # base64 Ed25519 (CDP default) or PKCS#8 PEM EC keyThe server signs a fresh 120-second JWT for every /verify and /settle call (src/payments/cdp-auth.ts). It uses the same header and claims as Coinbase's @coinbase/cdp-sdk generateJwt, checked against the official SDK's output. This API key only authorizes facilitator calls; it cannot move funds. Before taking real money, verify the USDC address and EIP-712 name against the facilitator's /supported response and Circle's docs.
Then regenerate discovery files for your domain:
npm run gen:docs -- https://YOUR_DOMAIN eip155:8453Environment variables
Name | Kind | Purpose |
| secret | Receiving wallet address (public address only) |
| secret, mainnet | Coinbase CDP facilitator API key; signs a JWT per request |
| secret, optional | Static |
| var | Chain and token (CAIP-2 network id) |
| var | Facilitator base URL ( |
| var | Used in llms.txt and registry metadata |
| var | Unpaid basic-tool calls per client per day (0 disables) |
| var | Per-payer daily cap (0 disables) |
| var | Required by SEC fair-access policy: "App name contact@email" |
Revenue reporting
Analytics Engine is optional: enable it in the Cloudflare dashboard, then uncomment analytics_engine_datasets in wrangler.jsonc. When enabled, every call writes one data point: blob1=tool, blob2=outcome, blob3=payer, blob4=tx hash, double1=USD. Query it with the Analytics Engine SQL API:
SELECT blob1 AS tool,
SUM(_sample_interval) AS paid_calls,
SUM(_sample_interval * double1) AS revenue_usd,
COUNT(DISTINCT blob3) AS payers
FROM counterparty_mcp_usage
WHERE blob2 = 'paid' AND timestamp > NOW() - INTERVAL '30' DAY
GROUP BY tool ORDER BY revenue_usd DESCConversion funnel: compare payment_required against paid and trial counts. Settled revenue is also visible on-chain at your payTo address.
Distribution assets
GET /llms.txt,/llms-full.txt: agent-readable docs generated fromsrc/pricing.ts. Static copies are inpublic/.GET /pricing.json: machine-readable prices.GET /.well-known/mcp/server.jsonandserver.json: official MCP Registry metadata. Set yourio.github.<user>name, thenmcp-publisher publish.docs/LISTING.md: marketplace copy for MCPize, MCP-Hive, Smithery, Glama and others.
Other payment rails
MCPize (80% to you, hosting included, Stripe Connect payouts): list this server with its x402 per-call option, plus a subscription tier for card buyers.
MCP-Hive (70% to you): register the remote endpoint; subscribers pay from monthly credits.
Stripe MPP: add
mppx+stripefor fiat settlement into a Stripe balance. Stablecoins have a 0.01 USDC minimum; cards through SPTs have a $0.50 minimum, so sell card buyers prepaid bundles, not $0.02 calls. Stripe also accepts x402 on Base.
Project layout
src/index.ts Worker entry: routing, rate limit, CORS, MCP transport
src/mcp.ts Tool definitions (Zod schemas) wired through the paywall
src/payments/x402.ts x402 v2 types, requirements, precheck, facilitator client
src/payments/cdp-auth.ts Per-request JWT for the Coinbase CDP facilitator
src/payments/paywall.ts Verify → execute → settle, idempotency ledger, trial, spend cap
src/data/*.ts OFAC SDN parser + matcher, SEC EDGAR, GLEIF
src/discovery.ts llms.txt, pricing.json, server.json generators
test/ Vitest suite with fixtures and a fake facilitatorKnown limits
Live upstream calls to SEC, OFAC and GLEIF were not exercised in the build sandbox (its network blocks those hosts). Unit tests use fixtures built from the documented formats. Run a live check on testnet before launch.
Sanctions coverage is OFAC SDN only. The EU, UK and UN lists are free to add; OpenSanctions needs a commercial license.
Financials and filings cover SEC registrants only. For other companies, the brief still runs sanctions and LEI checks.
Available Tools
6 toolscounterparty_briefCounterparty due-diligence briefARead-onlyInspect
One call that resolves a company and returns: SEC profile, recent red-flag 8-K events, filing timeliness, annual financials and ratios, OFAC SDN screening of the name and former names, GLEIF LEI status and parents, and a list of risk flags with evidence links. Costs $0.15 USDC per call via x402.
Inputs: query (required).
financial_snapshotAnnual financial snapshotBRead-onlyInspect
Latest annual revenue, net income, assets, liabilities, equity, cash, debt and operating cash flow from SEC XBRL, plus liquidity and leverage ratios. Costs $0.03 USDC per call via x402 (a few free trial calls per day).
Inputs: cik (required).
lei_lookupGLEIF LEI lookupARead-onlyInspect
Look up a Legal Entity Identifier (LEI) by code or legal name: registration status (flags lapsed LEIs), jurisdiction, legal address, and direct/ultimate parent. Covers non-US entities too. Costs $0.01 USDC per call via x402 (a few free trial calls per day).
Inputs: lei, name.
resolve_companyResolve companyARead-onlyInspect
Find SEC-registered companies by name, ticker, or CIK and return CIK, ticker and match score. FREE. Use the returned CIK with sec_filings, financial_snapshot or counterparty_brief.
Inputs: query (required), limit.
screen_sanctionsScreen against OFAC SDNARead-onlyInspect
Fuzzy-screen a person or organization name (including known aliases) against the U.S. Treasury OFAC SDN list. Returns scored potential matches with programs and source links. Costs $0.02 USDC per call via x402 (a few free trial calls per day).
Inputs: name (required), type, threshold.
sec_filingsSEC filings digestARead-onlyInspect
Company profile and recent SEC EDGAR filings with 8-K items decoded into plain English and red-flag events marked (bankruptcy, auditor change, restatement, delisting, cyber incident, change of control). Costs $0.02 USDC per call via x402 (a few free trial calls per day).
Inputs: cik (required), forms, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Most tools target distinct lookups: company resolution, sanctions screening, SEC filings, XBRL financials, and LEI/GLEIF data. The main overlap is counterparty_brief, which bundles all of the above and could tempt an agent away from the cheaper single-purpose tools, but the descriptions make the distinction and pricing clear.
All names are lowercase snake_case, which is consistent and readable. They are not uniform verb_noun (two verb-led names alongside noun-led ones like sec_filings and financial_snapshot), but each name still clearly signals the resource or action.
Six tools is well-scoped for a counterparty due-diligence server. Each tool covers a distinct data source or aggregation workflow, and the free resolver plus paid specialized lookups form a sensible set.
Coverage is strong for the inferred domain: entity resolution, OFAC screening, SEC filings, financials, LEI/parent data, and a bundled risk brief. Minor gaps include non-OFAC sanctions lists, adverse media/litigation, and ongoing monitoring, but core workflows are covered.
Maintenance
Related MCP Connectors
Pay-per-call checks for AI agents: sanctions, MiCA, French KYB, AI Act. USDC via x402.
Pay-per-call US public data for agents: OFAC, SEC, FMCSA, NPI, VIN recalls, SAM.gov. x402 USDC.
SEC filings, email and web checks, US public data for AI agents. Pay per call: x402 USDC or card.
Pay-per-call OFAC address and sanctions screens, plus company data. x402 in USDC/XRP
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceKeyless, pay-per-call compliance & regulated-data tools for AI agents: OFAC wallet + sanctions/PEP + KYB screening, SEC filings, FRED economics, FDA recalls, federal awards, and continuous monitoring (watch a wallet/company/brand for status changes). USDC via x402 on Base/Solana, no API key, no signup.-
- AlicenseAqualityCmaintenanceTrust layer for AI agents: 22 pay-per-call x402 tools for scam and fraud checks, payment pre-flight, wallet screening, policy approvals, contact extraction and company research. Free preview with no wallet; paid calls settle in USDC on Base.2369 npmMIT
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to perform on-chain compliance checks such as sanctions screening and UK company verification, with autonomous payment via USDC using the x402 protocol.-
- AlicenseNot gradedqualityFmaintenanceArchived and no longer maintained. Tools and prices shown here are out of date. Use the maintained server: glama.ai/mcp/servers/OceanAlt666/oceanalt-aml-mcp (GitHub: OceanAlt666/oceanalt-aml-mcp).MIT