ClaudeMCPLevel 4: Multi-tool systems

How Do You Build Your Own MCP Server for Claude?

Use an official MCP SDK to write a small program that exposes a few tools, test it with the MCP Inspector, then connect it to Claude Code or Claude Desktop. Build one only when no existing connector covers your system. Start with two or three read-only tools for tasks you really do.

Prompt to copy
Build a minimal MCP server for [system] in [Python/TypeScript], using the official SDK and the stdio transport.

Expose only these tools:
1. [tool_name]: [what it does, and when to use it]
2. [tool_name]: [what it does, and when to use it]

Rules:
- Read-only. No writes or deletes.
- Read credentials from environment variables, and never log them.
- Never write to stdout. Log to stderr only.
- Return only the fields needed for the next step, and page long results.
- Return errors that say what went wrong and what to try next.

Then give me the exact commands to test it with MCP Inspector and add it to Claude Code.
  1. 1Pick 2 or 3 real tasks
  2. 2Write tools with an SDK
  3. 3Test with MCP Inspector
  4. 4Connect, then run evals
Follows the MCP tutorial and Anthropic's tool-writing advice. Test with the Inspector before Claude ever sees the server.
  • Tool loaded upfront4,096 characters
    also server instructions
  • Tool loaded through search16,384 characters
Where Claude Code cuts a tool description. Source: Claude Code's MCP docs, checked 6 November 2026.

Try it now

  1. 1In Claude Code, paste the prompt above for one real system, naming a test database or a sandbox API.
  2. 2Run the Inspector to confirm your tools appear: npx @modelcontextprotocol/inspector --cli node build/index.js --protocol-era modern --method tools/list.
  3. 3Add the server with claude mcp add --transport stdio my-server -- node build/index.js. Then run /mcp in a session to check that it's connected.
  4. 4Ask Claude a question only your server can answer. You'll know it worked if the answer contains real data from your system.

Use it when

Use it for an internal database, an in-house API or a system with no connector in the directory. It also fits when you want to give Claude a safer, narrower view of a system than its full API allows.

Skip it when

Don't build one if a directory connector already does the job, or for a one-off task a script can finish. Also, a remote server that handles other people's accounts is a security project. MCP's docs set strict rules for it, so don't take that on just to save some pasting.

Why it works

An MCP server is a program that offers tools, resources and prompts over a standard protocol, so one server works with any MCP client. There are two transports. Stdio runs on your machine and typically serves one client, while Streamable HTTP runs remotely and serves many. Anthropic's tool-writing guide warns that tools which simply wrap API endpoints often fail with agents, because agents have limited context. It recommends a few targeted tools for high-impact workflows, such as a search rather than a full list.

Example

Your support team keeps looking up order status in an internal tool with no connector. You build two tools: orders_search, which takes a customer email, and orders_get, which takes an order ID. Each returns the status, the items and the last update, rather than the whole 80-field record. Claude can then answer "Why is this customer's order late?" without seeing anything else in the database.

Going further

The spec changed in protocol version 2026-07-28, which is stateless with a server/discover request. The Inspector defaults to the legacy era, so run it with --protocol-era modern and again with legacy to cover both. Claude Code cuts a tool description or server instructions past 4,096 characters, or 16,384 for a tool loaded through tool search, so put key details and search terms first. For remote servers, MCP's docs say servers must not accept tokens that weren't issued for them, and that possession of a state handle isn't authentication.

Common mistakes

  • Using print() or console.log() in a stdio server. MCP's docs say writing to stdout corrupts the JSON-RPC messages and breaks the server.
  • Wrapping every API endpoint as its own tool, which gives Claude a long list to choose from and a lot of fields it doesn't need.
  • Passing the user's token straight through to the downstream API. MCP's security docs call this an anti-pattern and forbid it.
  • Testing only that it runs. Anthropic's guide recommends realistic, multi-step evaluation tasks with outcomes you can verify.

Sources

Checked 6 November 2026. Products change often, so confirm details with the vendor.

Related

Beyond the course