How to Use Claude's Model Context Protocol (MCP)

Connect Claude to your tools, databases, and APIs

Ad placeholder (leaderboard)

The Model Context Protocol (MCP) is an open standard that lets an AI client like Claude call your tools, read your data, and use your prompt templates through one consistent interface. Before MCP, every integration was bespoke; with it, a single server that exposes your database or API works with any MCP-compatible client — the “USB-C for AI tools” analogy is apt. This guide explains the protocol, walks through building a server with real tools, and shows how to test and publish it. The generator below scaffolds a starter server from your tool definitions.

What MCP is

An MCP server exposes three kinds of capability. Tools are actions the model can invoke — search_orders, create_ticket — and may have side effects. Resources are readable data the client can pull in as context, like a file or a database record. Prompts are reusable prompt templates the server offers. Most servers begin with tools, the most common and powerful entry point.

A client (Claude desktop, an IDE, your own app) connects to the server, reads the list of available tools with their descriptions and input schemas, and calls them when a user’s request matches. The model decides whether to call a tool from its name and description — so writing those well is the single highest-leverage thing you do.

Building and registering tools

A tool is three things: a name, a description the model reads to decide when to use it, and an input schema (typically JSON Schema) describing its parameters. You then implement a handler that receives validated inputs, does the work, and returns a result.

server.tool(
  "search_orders",
  "Search the orders table by customer email. Returns matching orders.",
  { email: { type: "string", description: "Customer email to search for" } },
  async ({ email }) => {
    const rows = await db.orders.findMany({ where: { email } });
    return { content: [{ type: "text", text: JSON.stringify(rows) }] };
  }
);

The description carries the weight. “Search the orders table by customer email” tells the model exactly when to reach for it; “does stuff” leaves it unused. Validate every input in the handler — MCP is a transport, not a security layer, so least-privilege credentials and input validation are on you.

Testing and publishing

For local use, the simplest transport is stdio: the server runs as a process the client launches, ideal for connecting Claude to your own machine. Add the server to the Claude desktop config file (its mcpServers block), restart, and the tools appear. Exercise each one and watch the server logs to confirm the inputs arrive as expected.

Once it works, publish it to an MCP catalogue so others can discover and install it, and host it over HTTP with authentication if it needs to be shared remotely. Use the generator below to scaffold a server from your tool list, then read how to build an AI agent to see how a model orchestrates these tools, and how to add AI to an existing app for wiring it into a product.

Ad placeholder (rectangle)