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.
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
| Decision | Chosen Approach | Alternative Considered | Why |
|---|---|---|---|
| Tool Surface Design | Compact, task-oriented tool catalog with strict input schemas and bounded output shapes | Auto-generating one MCP tool per internal REST endpoint | Bloated tool catalogs confuse model tool selection, inflate context usage, and leak internal API quirks into prompts. |
| Authorization Boundary | Delegate authorization through OAuth-authenticated calls into existing scoped domain APIs | Direct database reads with re-implemented permission checks | Re-implementing complex role/tenant rules invites drift and security bugs; reusing domain boundaries preserves a single access-control model. |
| Release Verification | Deployed end-to-end test suite exercising live OAuth and real tool invocations | Mocked unit tests only | OAuth 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.