Skip to content
Greg King
01 / CASE STUDY

Production MCP Server for Multi-Host AI Clients

Took a customer-facing Model Context Protocol server from research prototype to production across Claude, ChatGPT, Microsoft Copilot, and Cursor—holding p95 latency under 1s with end-to-end OAuth verification.

Role
Lead Software Engineer
Domain
AI Systems & Backend
Timeline
Jul – Oct 2026
Outcome
p95 latency < 1s
  • TypeScript
  • Node.js
  • MCP
  • OAuth 2.0
  • End-to-End Testing

01 / Problem & Constraints

Customers increasingly live inside external AI workspaces—Claude, ChatGPT, Microsoft Copilot, and Cursor—and wanted to query their own SaaS workspace data directly from those tools without exporting spreadsheets or switching tabs.

Turning an early Model Context Protocol (MCP) research prototype into a customer-facing production service surfaced four tight constraints:

  • Multi-host compatibility: Different AI hosts have subtle quirks in how they handle tool descriptions, argument schemas, OAuth handshakes, and payload size limits.
  • Strict multi-tenant authorization: An external AI client must inherit the exact tenant and role permissions of the authenticated user—never broader, never cached across users.
  • Interactive latency budget: Tool calls happen mid-turn inside a chat loop; slow responses degrade the entire user experience, so we targeted p95 latency under 1 second.
  • Production confidence without manual smoke tests: Because auth flows and transport layers behave differently once deployed, unit tests alone weren’t enough to trust releases.

02 / System Architecture

Rather than exposing raw database queries or building a parallel permissions layer, the MCP server acts as a thin, model-ergonomic translation boundary sitting in front of existing tenant-scoped domain APIs.

Production MCP Server Architecture Flow from external AI hosts (Claude, ChatGPT, Copilot, Cursor) through an OAuth and tenant-scoped boundary into a compact MCP tool surface and scoped domain APIs, verified by an end-to-end OAuth test suite. EXTERNAL AI HOSTS Claude ChatGPT Microsoft Copilot Cursor MCP AUTH & TENANT-SCOPED BOUNDARY OAuth Gate Token validation Tenant context Role scoping MCP TOOL SERVER Compact Tool Catalog Strict Schema Validation Bounded Responses p95 latency < 1s APPLICATION LAYER Scoped Domain APIs Existing permissions Multi-tenant data Read-focused contracts DEPLOYED VERIFICATION End-to-end tests run real OAuth flows & tool calls against deployed environments before release.
Fig. 01 — Logical request path from external AI hosts through tenant-scoped OAuth and a compact MCP tool surface into existing domain APIs.

Every external request clears OAuth validation and resolves tenant and user scope before reaching the tool router. Tools are intentionally modeled around user-level questions rather than mirroring low-level internal REST endpoints one-to-one, and response payloads are shaped to stay concise inside an LLM context window.

03 / Key Architectural Trade-offs

DecisionChosen ApproachAlternative ConsideredWhy
Tool Surface DesignCompact, task-oriented tool catalog with strict input schemas and bounded output shapesAuto-generating one MCP tool per internal REST endpointBloated tool catalogs confuse model tool selection, inflate context usage, and leak internal API quirks into prompts.
Authorization BoundaryDelegate authorization through OAuth-authenticated calls into existing scoped domain APIsDirect database reads with re-implemented permission checksRe-implementing complex role/tenant rules invites drift and security bugs; reusing domain boundaries preserves a single access-control model.
Release VerificationDeployed end-to-end test suite exercising live OAuth and real tool invocationsMocked unit tests onlyOAuth redirects, token refresh, and host-protocol edge cases only break against real deployed infrastructure.

04 / Failure Modes & Edge Cases

Shipping across four different AI hosts uncovered issues that never show up in a local single-client demo:

  • Ambiguous tool descriptions causing mis-routing: When two tools had overlapping descriptions or weakly constrained parameter schemas, models routinely picked the wrong tool or invented invalid filter formats. Tightening schemas and making tool boundaries mutually exclusive eliminated most bad calls.
  • Oversized responses degrading reasoning: Returning full, unfiltered API payloads blew up token budgets and slowed downstream model turns. Trimming payloads to the fields models actually need simultaneously improved response latency and answer quality.
  • Auth drift across environments: Running real OAuth end-to-end tests against the deployed server caught configuration and scope regressions before customers ever hit them.

05 / Outcome

The server moved from a July research prototype to production in October, enabling customers to securely interact with their workspace data across Claude, ChatGPT, Microsoft Copilot, and Cursor. Usage accelerated rapidly post-launch (mid-November usage already surpassed October’s full-month total) while maintaining p95 latency under 1 second and backing every release with deployed OAuth end-to-end verification and automated evals.