MCP servers: making every API a tool Claude can call
The Model Context Protocol lets Claude, Cursor, and other AI clients call APIs as tools. Here is what MCP actually is, what a minimal server looks like, and how we auto-expose every VectorFlowApp contract.
The Model Context Protocol (MCP) is Anthropic's open standard for letting AI clients call external tools. Claude Desktop uses it. Cursor uses it. Open-source clients like Zed and Continue are rolling it out. If you ship an API, a well-built MCP server is the shortest path to being callable from every AI assistant on earth.
This post is the thing I wish I'd read before building one. It covers:
- What MCP actually is (hint: it's simpler than most explanations make it sound)
- A minimal server you can run in a few dozen lines
- How we map every VectorFlowApp API contract into an MCP tool, automatically
MCP in one paragraph
MCP is JSON-RPC 2.0 over an HTTP endpoint (or stdio, if you're hosting a local-only server). The client sends three kinds of calls:
initialize— "hello, what version do you speak?"tools/list— "what can you do?"tools/call— "do this specific thing, here are the arguments"
That's the critical surface. There are optional methods (resources/list, prompts/list) but you can ship a useful server with just those three.
Here's what a tools/list response looks like:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "create_customer",
"description": "Create a new customer in the CRM",
"inputSchema": {
"type": "object",
"properties": {
"email": { "type": "string" },
"name": { "type": "string" }
},
"required": ["email", "name"]
}
}
]
}
}That's it. A tool is a name, a description, and a JSON Schema for its input. The AI picks when to call it and what to pass. Your job is to execute it when tools/call lands.
A minimal server
This is a full MCP server. Node.js on a bare HTTP server, no framework:
import http from "node:http";
const TOOLS = [
{
name: "add_numbers",
description: "Return the sum of two numbers",
inputSchema: {
type: "object",
properties: { a: { type: "number" }, b: { type: "number" } },
required: ["a", "b"],
},
},
];
async function handle(req: any) {
const { method, params, id } = req;
if (method === "initialize") {
return { protocolVersion: "2025-06-18", capabilities: { tools: {} } };
}
if (method === "tools/list") {
return { tools: TOOLS };
}
if (method === "tools/call") {
if (params.name === "add_numbers") {
const { a, b } = params.arguments;
return { content: [{ type: "text", text: String(a + b) }] };
}
}
throw new Error(`Unknown method: ${method}`);
}
http
.createServer(async (req, res) => {
if (req.method !== "POST") return res.end();
let body = "";
req.on("data", (c) => (body += c));
req.on("end", async () => {
const envelope = JSON.parse(body);
try {
const result = await handle(envelope);
res.setHeader("Content-Type", "application/json");
res.end(JSON.stringify({ jsonrpc: "2.0", id: envelope.id, result }));
} catch (e: any) {
res.end(JSON.stringify({ jsonrpc: "2.0", id: envelope.id, error: { code: -32601, message: e.message } }));
}
});
})
.listen(3000);Point Claude Desktop at http://localhost:3000 and it can now call add_numbers. That's a functional MCP server.
The real ones are bigger because they need: auth, auth token refresh, streaming responses, error-mapping, request timeouts, cancellation, structured content types (images, resources). But the shape doesn't change. It's still JSON-RPC with three or four methods on top.
What goes wrong in production
Three things trip people up:
1. Schema drift. Your tool's inputSchema is a contract with the AI. If you add a required field but don't update the schema, every call fails. If the schema doesn't accurately describe the API, the AI hallucinates arguments. We validate every tools/call against the stored schema before executing.
2. Idempotency and side effects. AI clients will retry. They will also call your tool twice because the user asked a question in two different ways. If create_customer isn't idempotent, you'll get duplicates. Give every tool call a request ID and dedupe on it.
3. Describing what the tool does. The description field matters more than any other. Claude decides whether to call the tool based on this description. "Create a customer" is bad. "Create a new customer record in the CRM. Call this when the user says they want to add, register, or onboard a new customer. Returns the created customer with an auto-generated ID." is good. One of the highest-leverage edits you can make on an MCP server is rewriting descriptions.
Our shortcut: contracts are already tools
VectorFlowApp has API contracts — a registry where every partner-facing endpoint has a method, path, request schema, response schema, and a human description. We built this before MCP existed, for API-management reasons: generating OpenAPI, enforcing JWT, validating payloads at the gateway.
When MCP landed we realized: an API contract is the same thing as an MCP tool, in a different wire format.
So the MCP server became ~a few hundred lines of mapping code. For each contract:
- Convert the HTTP method + path into a tool name (
createCustomer→create_customer) - Convert the request JSON Schema into the tool's
inputSchema - Use the contract description as the tool description
- On
tools/call, construct the HTTP call to the real gateway and forward the response
Pseudocode:
function contractToTool(contract) {
return {
name: toSnakeCase(contract.operationId),
description: contract.description,
inputSchema: contract.requestSchema,
};
}
async function callTool(contract, args) {
const url = buildUrl(contract.gatewayUrl, contract.path, args);
const method = contract.method;
const body = extractBody(contract, args);
const response = await fetch(url, { method, body, headers: authHeaders() });
return { content: [{ type: "text", text: await response.text() }] };
}Now every API contract a customer publishes is simultaneously an MCP tool. No extra work. If you publish an OpenAPI spec and attach a flow to it, Claude and Cursor can call it.
This is where MCP stops being an extra feature to build and starts being a new distribution channel. An enterprise building a procurement workflow can expose their contracts as MCP tools and let their sales reps interact with the whole stack from Claude.
Shipping advice
If you're building an MCP server for your product, in order of impact:
- Start with your highest-intent API. Don't try to expose everything. One well-described tool beats twenty poorly-described ones.
- Write the descriptions like you're training a new hire. "Call when the user wants to..." phrasing. State what the tool returns.
- Make it findable. Register at the MCP server directory once it's stable. Pricing doesn't matter if nobody knows the integration exists.
- Log what the AI actually calls. The gap between "what you thought Claude would do" and "what Claude does" is instructive. Our logs showed that AI clients call
list_tools 10x more thancreate_tools — because they explore before acting.
MCP is still early. The spec has shipped two versions already (2024-11-05 and 2025-06-18) and more are coming. But the primitive — "here are my tools, here is how to call them, let an AI pick" — is the distribution model for the next few years of enterprise software. The teams that get there first with real, well-described tools win.