
- BLOG
MCP Architecture for Enterprise Applications: Design, Components, and Deployment Patterns
Published: November 24, 2026
Route Optimization API
Optimize routing, task allocation and dispatch
Distance Matrix API
Calculate accurate ETAs, distances and directions
Directions API
Compute routes between two locations
Navigation API & SDK
Turn by Turn Instructions for Drivers & Technicians
Route Optimization Software
Plan optimized routes with 500+ Constraints
Product Demos
See NextBillion.ai APIs & SDKs In action
Location Reasoning AI
Help your AI agents answer location-based questions
AI Route Optimization
Learns from Your Fleet’s Past Performance
Platform Overview
Learn about how Nextbillion.ai's platform is designed
On-Premise Deployments
Take Full Control of Your Maps and Routing
Table of Contents
Most enterprise MCP projects begin the same way: one server, one client, one developer’s machine. Turning that into shared infrastructure changes the question from how the protocol works to how the system should be built.
Gartner projects that 75% of API gateway vendors will add MCP features by the end of this year, which shows where the industry expects traffic to flow. NextBillion.ai’s open-source MCP server, which turns routing, geocoding and mapping APIs into agent tools, makes a handy worked example of the layering involved.
So how should an enterprise team organise hosts, servers, gateways and identity from day one? Let’s find out!
You already know the three roles. A host runs the AI experience, a client inside it holds one connection, and a server wraps a system and exposes tools, resources or prompts. At enterprise scale those roles stay the same. The things that built around them changes: identity, networking, policy, logging and ownership.
Consider a rollout as six architecture layers. Each one has an owner and a decision attached.
Layer | Decision it forces | Usual owner | Typical building blocks |
Hosts and agents | Which assistants and agent platforms may connect | Platform or AI team | Desktop assistants, IDEs, internal agent frameworks |
Client layer | Which SDK and version policy to follow | Application teams | Official SDK clients, custom connectors |
Gateway or control plane | Where policy, routing and audit live | Platform and security | API gateway with MCP support, dedicated MCP gateway |
MCP servers | Build, buy or adopt each one | Domain teams | Custom servers, open-source servers, vendor-hosted endpoints |
Identity and secrets | How users and servers prove who they are | Security and IAM | OAuth 2.1 authorisation server, secrets manager |
Observability | What gets logged, traced and alerted on | Platform and operations | Structured logs, trace IDs, dashboards |
MCP specifies the process by which an agent identifies and invokes capabilities and how authorisation is managed using HTTP. It says very little about several things that decide whether a rollout succeeds. These include:
Those gaps are not flaws. They are the part of the architecture that belongs to you. WorkOS’s enterprise rollout analysis highlights four recurrent requirements: audit trails, single sign on, predictable gateway behaviour and portable configuration.
Abstract diagrams only go so far, so here is a concrete server. NextBillion.ai publishes an open-source MCP server on GitHub. It exposes 27 tools: 16 that call NextBillion’s APIs for geocoding, place search, routing, distance matrices, isochrones and static maps, four that search the product documentation, and seven that do geometry work locally. The way the repository is organised shows how to structure a domain server, whatever your domain happens to be.
Layer | What it holds | Why it is kept apart |
Core and tools | Server assembly, spec compliance and error mapping, plus one file per tool, grouped by product (places, routing, maps, docs) | Tool logic can change without touching protocol handling |
API client | A shared HTTP client that deals with authentication, timeouts, retries and key redaction | Every tool gets the same safe behaviour, and secrets are handled in one place |
HTTP and identity | The Streamable HTTP app, bearer-token verification and a built-in OAuth authorisation server | Network and sign-in concerns stay separate from tool code |
Distribution | Client setup: Code and Codex plugins that contain only the server URL, plus snippets for Cursor and manual configuration | Reaching a new client means adding setup steps, not rewriting logic |
The README is explicit that the plugins carry no code, only the URL. A fix to a tool therefore lands once, on the server, and reaches every client without anyone updating anything.
The README’s section on how the hosted server works reads like a checklist of the decisions in this guide.
Concern | What the README describes | Why it matters |
Credentials | No server-wide key. Every API call uses the caller’s own key, sealed into OAuth tokens or sent as a bearer header | Calls are made with the identity of whoever asked |
Sign-in | The server is its own OAuth 2.1 authorisation server. PKCE is required, and the key is checked once with an unbilled request | Follows the specification’s authorisation model |
Lazy authentication | A host can connect, list tools and use the documentation tools without signing in. The first API call gets a 401 challenge that triggers sign-in | Easy trials without exposing billable calls |
State | Stateless: one server instance per request, built from that request’s credentials. Tokens are encrypted, and nothing is stored server-side | Simple to scale, with no credential store to breach |
Logging | Method, path, status and duration are logged, never headers, bodies, keys or tokens | Useful for operations without capturing secrets |
Network | Calls to the API leave from a fixed egress address | Customers can allow-list it if their key has an IP restriction |
The repository also ships a Dockerfile, so teams that cannot use a hosted endpoint can build the image and run it in their own environment. The README lists the settings a self-run instance needs, including its public URL and the key used to seal tokens, and notes that the hosted deployment is managed as code on Cloud Run. In pattern terms, one codebase can be consumed as a vendor-hosted endpoint or as a self-hosted service. For the mapping-specific side, such as how routing, geocoding and matrix calls should be combined, see our guide to MCP Integration Patterns for Mapping, Routing and Geocoding APIs.
Where a server runs shapes who can reach it, how it is secured and who gets paged when it fails. Most enterprises settle on one of four patterns, and many combine them.
Pattern | How it runs | Best for | Main watch-out |
1. Local stdio | The host launches the server on the user’s machine | Pilots, developer tools, single-user work | Credentials and updates live on every laptop |
2. Self-hosted remote | A Streamable HTTP service in your own cloud or VPC | Internal systems and sensitive data | You own scaling, patching and authentication |
3. Managed remote | A vendor-operated endpoint your clients connect to | SaaS connectors and fast rollouts | Data leaves your perimeter; check residency and SLAs |
4. Gateway-fronted fleet | A central gateway sits in front of many servers | Many teams and strict governance | The gateway becomes critical infrastructure |
The host starts the server as a child process and talks to it through standard input and output, known as stdio. There is no network exposure and no HTTP authentication to design, so it is the quickest route to a pilot.
Here the server runs as an ordinary service over Streamable HTTP inside your own cloud account or VPC. The July 2026 specification made this much easier to operate. Requests no longer depend on a protocol-level session, so any instance can answer any call. A standard load balancer is enough, and sticky routing is not needed.
A provider runs the endpoint, and your clients connect to it. This is the managed route. Managed platforms take on scaling and patching, so teams reach production sooner.
As servers multiply, teams add an MCP gateway: a control plane between agents and servers. It checks who is calling, decides which tools that caller may use, keeps a record of every call and directs the traffic. Interest is strong. Gartner’s 2025 Software Engineering Survey projects that 75% of API gateway vendors and 50% of iPaaS vendors will have MCP features by the end of 2026.
Few enterprises pick only one pattern, which is why hybrid setups are so common. A common split keeps sensitive systems self-hosted behind the gateway, uses managed endpoints for ordinary SaaS connectors, and leaves stdio for individual experiments.
The choice rarely comes down to a single factor. Here’s how you can decide:
Factor | Leans self-hosted | Leans managed |
Data sensitivity | Regulated, personal or commercially sensitive data | Low-sensitivity or public data |
Engineering capacity | A platform team that can run services long term | A small team with competing priorities |
Time to production | Weeks are acceptable | Needed in days |
Customisation | Custom tools, policies or network rules | Standard connectors are enough |
Compliance evidence | You must show your own controls and logs | Provider certifications are accepted |
Cost shape | Infrastructure and staff time | Subscription or usage fees that grow with seats or calls |
Upgrade burden | You track specification changes yourself | The provider absorbs protocol updates |
Patterns make more sense against real workloads. Here are some illustrative scenarios to help you out:
Use case | Likely pattern | Why |
Dispatch assistant estimating delivery windows | Self-hosted behind a gateway | Routing tools are called constantly, and customer addresses are involved |
Field service scheduling agent | Self-hosted remote | Technician and customer locations should stay in your network |
Last-mile operations desk | Managed or self-hosted, behind a gateway | Demand peaks, so scaling matters more than customisation |
Construction fleet and site logistics | Local stdio pilot, then shared remote | Start small, then share once sites and routes are mapped |
Once a server leaves a developer’s laptop, identity becomes the biggest design task. The specification gives a clear framework for it, and that framework applies to HTTP transports.
The MCP server acts as an OAuth 2.1 resource server. The client acts as the OAuth client, and a separate authorisation server issues the tokens. Four controls do most of the work:
Control | How it works | Risk it closes |
Protected resource metadata (RFC 9728) | The server publishes where its authorisation server lives, and an unauthenticated call is answered with a pointer to it | Clients guessing or hard-coding where to sign in |
Resource indicators (RFC 8707) | The client names the target server when it asks for a token | A token being valid across unrelated servers |
PKCE | The client proves it started the sign-in flow | Interception of authorisation codes |
Audience validation | The server rejects any token not issued for it | A token for one server being replayed at another |
The specification forbids token passthrough, which means forwarding the token a client sent you on to a downstream API. A server that calls an upstream service must obtain its own credential for that service. If that were allowed, a token meant for one service could unlock another, logs would no longer show who really asked, and the server could end up acting with permissions it was never meant to hold. Security teams call this the confused-deputy problem.
NextBillion’s hosted server shows one answer. It keeps no server-wide key. Each caller signs in once with their own NextBillion API key, which the server seals into the OAuth tokens it issues, and scripts can send the key as a bearer header instead. For a self-run instance, the key that seals those tokens belongs in a secrets manager, kept separate for each environment and rotated on a schedule.
Approach | Strength | Limitation |
Shared service credential | Simple to set up, with one key per environment | The audit trail shows the server, not the person, and everyone shares one rate limit |
Per-user delegated access | Precise audit and permissions for each person | More setup, and every downstream API must support it |
Protocol-level sessions are gone in the latest release, so capacity planning now looks much more like ordinary web services. Version-level detail sits in our MCP Specification and Compatibility guide. For architecture, four consequences matter:
Every tool an agent can see costs context and adds a choice, so tool sprawl is a real design risk. NextBillion’s own server has 27 tools in three groups, which is a good reason to filter at the gateway. Expose tools in small, purpose-based groups, and use the gateway to give each team only what it needs. A routing assistant might see geocoding and directions tools, while a finance agent sees none of them.
Signal | Why it matters |
Calls per tool and per caller | Shows adoption and exposes misuse |
Latency per tool, including the upstream API | Separates a slow server from a slow downstream service |
Errors by type | Tells bad inputs apart from outages |
Denied calls | Evidence that policy is working |
Upstream quota use | Stops one agent from exhausting a shared API key |
Trace ID across host, gateway and server | Lets you follow one request from end to end |
Recent versions of the protocol reserve space in the _meta field for standard trace identifiers, so one trace ID can travel with a call from the host to the server and back.
A dispatcher asks an assistant which of ten deliveries will miss their window. The host, the gateway and the server each log their part, including the distance_matrix call. With one trace ID, an engineer can see in seconds whether a slow answer came from the model, the gateway or the mapping API. This is an illustration, not a real deployment.
Teams that go well grow in stages.
Phase | Goal | Pattern | Ready to move on when |
1. Pilot | Prove value with one team | Local stdio or a vendor-hosted endpoint | A named use case saves measurable time |
2. Shared internal | Let several teams use common servers | Self-hosted remote with OAuth | Authentication and logging work for every user |
3. Governed fleet | Add central policy and audit | Gateway-fronted | Security signs off on audit and access rules |
4. Optimise | Cut cost and noise | Curated tool sets per team | Tool-selection errors and spend are falling |
If your agents need location intelligence, such as geocoding customer addresses, calculating travel times for a dispatch plan or drawing a route on a map, NextBillion’s MCP server gives them 27 ready-made tools. Sixteen of them call NextBillion’s APIs, including the routing and distance-matrix capabilities covered at nextbillion.ai/routing.
If your NextBillion API key has an IP allowlist, allow the server’s fixed egress address, which the README lists. And if policy rules out a vendor-hosted endpoint, the repository’s Dockerfile lets you run the same server yourself.
Enterprise MCP is less about the protocol and more about the decisions around it. Choose where each server runs, put identity first, curate the tools agents can see, and log every call from day one. Start small with a local pilot, grow into self-hosted or managed servers as demand appears, and add a gateway once several teams share the load. NextBillion’s open-source server shows the layering to aim for, from small tools and a shared client to built-in sign-in and URL-only client setup. Get those foundations right, and the number of servers can grow without governance falling behind.
The way an organisation arranges hosts, clients, servers, gateways, identity and logging so many teams can use MCP tools safely.
Self-host for sensitive data or custom controls. Go managed for common SaaS connectors and speed. Many firms mix both.
Not for a pilot. Once several teams share servers, a gateway gives you central authentication, policy and audit.
For HTTP transports, yes. It uses OAuth 2.1 with the server as a resource server. Local stdio servers usually rely on environment credentials.
It means forwarding a client’s token to another API. The specification bans it because one service’s token could then unlock another.
Yes. It runs as a hosted service at mcp.nextbillion.io, and the open-source repository also lets you run it yourself with Docker.
Bhavisha Bhatia is a Computer Science graduate with a passion for writing technical blogs that make complex technical concepts engaging and easy to understand. She is intrigued by the technological developments shaping the course of the world and the beautiful nature around us.