Model Context Protocol (MCP): Connect AI to Your Tools and DataMCP in production · Lesson 14 of 18

Deploying remote MCP servers and publishing to registries

Article · 15 min · 9 min lecture

Video lecture

Deploying remote MCP servers and publishing to registries

15 chapters · about 9 min · full transcript

Coming soon

Chapter 1 of 15

Remote deployment and registries

  • Deployment targets
  • Production checklist
  • Protocol transition
  • Registries

The narrated lecture is in production

Every chapter is scripted and ready. Browse the chapters and read the full transcript now — the video will appear here when it’s published.

Chapters

From local to remote

Remote servers let many users and clients share one governed integration. A production remote server needs: HTTPS, OAuth (lesson 11), a stateless deployment that scales horizontally, observability, rate limiting, versioning and a documented support model.

Deployment targets

TargetWhy it fits MCPNotes
Container platforms (Cloud Run, AWS ECS/Fargate, Azure Container Apps, Kubernetes)Long-lived HTTP services, easy scalingStandard choice for most teams
Serverless functionsStateless 2026-07-28 servers fit wellWatch cold starts and timeouts for long tools; use tasks for long work
Edge runtimes (e.g., Cloudflare Workers, Deno, Bun)TypeScript v2 handler is web-standard fetchCheck library compatibility
API gateways / MCP gatewaysCentral auth, rate limits, logging across many serversIncreasingly common in enterprises

Production checklist for a remote server

  • TLS everywhere; HSTS on custom domains.
  • Auth: Protected Resource Metadata, audience validation, scopes per tool.
  • Statelessness: no in-memory session state; explicit handles for multi-step flows; shared state in a database or cache.
  • Idempotent writes with client-supplied keys (broken streams are re-issued, not resumed).
  • Timeouts and limits: per-tool timeouts, payload limits, result size caps, pagination.
  • Rate limiting per user and per tool, using Mcp-Method / Mcp-Name headers at the gateway.
  • Caching hints: ttlMs and cacheScope on list results; deterministic tool order.
  • Observability: OpenTelemetry traces (the spec documents propagating traceparent via _meta), structured logs without tokens or personal data, metrics per tool.
  • Versioning: semantic versions for your server; a changelog for tool changes; deprecate tools gracefully.
  • Backwards compatibility: serve 2025-era clients during the transition (official v2 SDKs can serve both from the same code).

Serving both protocol eras

The TypeScript v2 createMcpHandler serves 2025-era clients statelessly from the same factory by default; the Python v2 SDK similarly supports every protocol revision. Test with at least one older client (for example an older IDE build) and one current host before announcing an upgrade.

Registries and discovery

The official MCP Registry (currently in preview) is a metadata catalog for publicly accessible servers: it stores a server.json describing where to get or reach your server (npm, PyPI, Docker packages, or remote URLs), how to run it, and descriptive metadata. It supports namespace verification (for example io.github.username/… via GitHub login, or your own domain via DNS). It is intended mainly for downstream aggregators and marketplaces rather than direct consumption by hosts, and it does not host private servers. For internal servers, run a private registry or catalog (the registry defines an OpenAPI spec other registries can implement) or use your host platform's admin-managed connector list.

A remote entry looks like:

{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "com.example/acme-analytics",
  "title": "ACME Analytics",
  "description": "Read-only marketing analytics for ACME clients",
  "version": "2.0.0",
  "remotes": [{"type": "streamable-http", "url": "https://mcp.acme.example/mcp"}]
}

Publishing uses the mcp-publisher CLI (mcp-publisher init, mcp-publisher login github or DNS-based login, mcp-publisher publish). Check the registry docs for the current schema version and namespace rules.

Worked example: a SaaS vendor in Dubai launches an MCP integration

A Dubai-based social-media scheduling SaaS wants customers to use it from Claude, ChatGPT and IDE agents.

  1. Builds a TypeScript v2 server with 8 workflow-oriented tools (draft post, schedule post, list calendar, best-time suggestions, analytics summary, and so on).
  2. Deploys on a container platform behind an API gateway, with OAuth via its existing identity service, CIMD support and scopes posts:read, posts:write, analytics:read.
  3. Tools that publish content require posts:write via step-up and carry destructiveHint.
  4. Publishes server.json with its domain namespace and a streamable-http remote.
  5. Writes a public "Connect to Claude/ChatGPT/VS Code" guide, a changelog and a security page (data retention, scopes, contact).
  6. Monitors adoption per client type and errors per tool.

Hands-on: containerize a Python server

FROM python:3.12-slim
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN pip install --no-cache-dir uv && uv sync --frozen --no-dev
COPY server.py ./
ENV PORT=8080
# Bind to all interfaces inside the container; the platform's load balancer terminates TLS.
CMD ["uv", "run", "python", "-c", "import server, os; server.mcp.run(transport='streamable-http', host='0.0.0.0', port=int(os.environ['PORT']))"]

Binding to 0.0.0.0 is appropriate inside a container behind a load balancer; for local development keep 127.0.0.1. Put authentication in front (SDK auth settings or gateway), never expose an unauthenticated write-capable server publicly. For TypeScript, mount createMcpHandler with createMcpExpressApp({ host: '0.0.0.0', allowedHosts: ['mcp.example.com'] }) so Host validation still applies.

Pitfalls

  • In-memory state that breaks with more than one replica.
  • Publishing a server to a public registry without auth, rate limits or a security page.
  • Breaking tool changes without versioning or notice.
  • Forgetting older clients during the protocol transition.

Measuring success

Availability and p95 latency per tool, error rates by client type and protocol version, adoption (active users per host), and time to roll back a bad release.

Key takeaways

  • Remote servers need TLS, OAuth, statelessness, idempotent writes, limits, rate limiting and observability.
  • 2026-07-28 servers scale horizontally; route and meter with Mcp-Method and Mcp-Name headers at gateways.
  • Serve both protocol eras during the transition; official v2 SDKs support older clients.
  • The official MCP Registry (preview) catalogs publicly accessible servers via server.json; use private catalogs for internal ones.
  • Version tools, publish changelogs and never expose unauthenticated write-capable servers.

Check your understanding

Quick questions to lock in the lesson. They don’t count towards your certificate.

  1. You deploy three replicas of your server and multi-step flows randomly fail. What is the likely cause?
  2. Your company's internal HR MCP server should be discoverable by employees. Where should it be listed?
  3. Why must write tools on remote 2026-07-28 servers be idempotent?

Put it into practice

Containerize your server, deploy it to a staging environment with auth in front, test it with an older and a current client, and draft a server.json (public or private catalog).

Enrol for free to save your progress

Reading is always free. Enrol to keep your place, take the final assessment and earn a verifiable certificate.