Integrations/Knowledge
Advanced18 min

Building Production MCP Servers

Build, version, deploy, and monitor production MCP servers with both the TypeScript SDK and FastMCP. Covers the build-vs-buy decision, schema versioning, deployment cost math, the gateway pattern for multi-server architectures, and three-tier health monitoring — because only 9% of remote MCP endpoints are fully healthy in the wild.

Quick Reference

  • Build custom MCP servers only for internal APIs with no community equivalent — 10,000+ public servers already exist
  • TypeScript SDK (@modelcontextprotocol/sdk v2): reference implementation, Express/Hono middleware support
  • Python SDK (FastMCP v2): Pydantic schemas, one-line mcp.run(transport='streamable-http')
  • Tool descriptions must start with a verb — the model uses the first word for tool identification
  • Schema versioning: additive changes are safe; renames/removals need major bumps + migration windows
  • Gateway pattern: mandatory at 3+ servers — single endpoint, centralized health, auto-namespacing
  • Three-tier health: Liveness (HTTP 200) + Readiness (tools/list) + Operational (tool call succeeds)
  • Dynamic tool loading: agents degrade past 7–10 tools — expose only task-relevant tools per session

Should You Build an MCP Server?

Before writing a single line of server code, spend two minutes on this decision. As of April 2026, over 10,000 public MCP servers exist — GitHub, Slack, Postgres, Stripe, Jira, and dozens of other standard integrations are maintained by their vendors or active communities. Building a custom server for one of these is waste. Build only when no public server covers your use case, or when you need to expose internal APIs that can never be public.

Need to expose a data sourceor API as MCP tools?Does a community MCP serveralready cover this? (10,000+ exist)YesUse communityserverNoWill this tool be reused acrossmultiple agents or clients?NoUse @tooldecoratorYesOnly need custom middlewareon top of a community server?YesUse client-sideinterceptorsNoBuild a custom MCP serverTypeScript SDK or FastMCP (Python)10,000+ public MCP servers exist — check before building

Build-vs-buy decision tree for MCP servers

ScenarioDecisionReason
Internal API (no public server exists)BuildNo alternative — your business logic lives here
GitHub, Slack, Postgres, StripeUse community serverVendor-maintained, tested against real API changes
Single agent needs one toolUse @tool decoratorMCP adds 10–50ms latency and a process boundary — justify it with reuse
Community server exists but needs custom auth/rate-limitWrap with interceptorsClient-side interceptors (see mcp-interceptors article) are cheaper than a new server
3+ agents need the same internal data sourceBuildThe reuse across agents justifies the maintenance cost
The single-agent rule

If a tool is used by exactly one agent and needs LangGraph State access, skip MCP entirely. Use a @tool decorator. MCP adds a process boundary, a network hop, and 10–50ms per call. That overhead is justified when multiple agents or clients share the server — not before.