MCP
ProductionModel Context Protocol — Anthropic
Overview
MCP is the open standard for connecting AI assistants to external tools and data sources. When Claude, ChatGPT, or any AI assistant needs to search the web, query a database, or call an API, it uses MCP. SettleGrid adds per-call billing to any MCP server with 2 lines of code.
How It Works
An MCP server exposes "tools" — functions that AI assistants can call. When an assistant needs a capability (like web search or code analysis), it discovers available MCP servers and calls their tools with structured arguments. The server processes the request and returns results.
The protocol uses JSON-RPC 2.0 over stdio or HTTP transports. Each tool declares its name, description, and input schema so that AI models can decide when and how to invoke it. MCP servers can also expose "resources" (read-only data) and "prompts" (reusable templates).
SettleGrid wraps this flow with automatic metering: every tool call is validated, charged, and recorded. The SDK intercepts the JSON-RPC call, checks credits, executes your handler, and meters usage — all before the response is returned to the AI assistant.
How SettleGrid Integrates
SettleGrid's SDK wraps your MCP tool handler with billing. The sg.wrap() function intercepts each call, validates the consumer's API key, checks their credit balance, executes your handler, and meters the usage — all in under 50ms. No changes to your tool's logic required. The consumer passes their API key in the MCP _meta field, and SettleGrid handles the rest.
Key Specs
| Protocol | MCP — Model Context Protocol |
| Backer | Anthropic |
| Detection Header | x-api-key / _meta.settlegrid-api-key |
| Identity Type | api-key |
| Payment Type | credit-balance |
| Status | Production |
Code Example
Here is how a developer's tool works with MCP via SettleGrid:
import { settlegrid } from '@settlegrid/mcp'
const sg = settlegrid.init({
toolSlug: 'my-web-search',
pricing: { defaultCostCents: 5 },
})
// Wrap your existing handler — billing is automatic
const search = sg.wrap(async (args: { query: string }) => {
const results = await searchWeb(args.query)
return { content: [{ type: 'text', text: JSON.stringify(results) }] }
}, { method: 'search' })Start monetizing with SettleGrid
Free forever — 50,000 ops/month, progressive take rate. Add billing to your MCP tool in under 5 minutes.
Get Started Free