Building MCP servers

Writing, testing, debugging and deploying your own MCP server with the official SDKs.

These guides walk through a server from first tool to remote deployment, using the official SDKs and the MCP Inspector. Pick the TypeScript or Python guide, then debug it locally before you put it behind a URL.

Read in this order

  1. Build an MCP server in TypeScript with the official SDK

    Install @modelcontextprotocol/server, register a tool with a Zod schema, and serve the same factory over stdio or Streamable HTTP.

  2. Build an MCP server in Python with the official SDK

    Install the mcp package, put @mcp.tool() on a type-hinted function, and serve it over stdio or Streamable HTTP with mcp.run().

  3. Debug an MCP server with MCP Inspector: web UI, CLI and CI

    Point the official Inspector at a stdio command or an HTTP URL, read the JSON-RPC traffic, pick the protocol era, and turn the CLI into a CI check.

  4. Run a remote MCP server: Streamable HTTP, sessions and auth

    What changes when an MCP server leaves localhost: one POST endpoint, no protocol sessions in revision 2026-07-28, a Host allowlist, and bearer tokens bound to your server.

MCP server, MCP transport, stdio transport, Streamable HTTP, Tool bundle