MCP Architecture for Enterprise Applications

MCP Architecture for Enterprise Applications: Design, Components, and Deployment Patterns

Published: November 24, 2026

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!

MCP architecture

The Enterprise MCP Architecture at a Glance

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.

The Layers Around the Protocol


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

Where the Protocol Stops and Your Design Begins


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:

  1. Where the servers are located and who manages them

  2. What teams can access what capabilities 

  3. How calls are audited, and how long audit records are kept for

  4.  How credentials are issued, stored and rotated

  5.  How many tools a given agent should see at once

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.

Inside a Well-Built MCP Server: A Worked Example

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.

A Quick Overview of Four Layers, Four Jobs

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.

Design Choices Worth Borrowing

  • Small, single-purpose tools. Sixteen API tools, such as geocode_forward, directions and distance_matrix, each do one job. That tends to make it easier for an agent to choose between than one sprawling endpoint.

  • Explicit inputs. Coordinates always arrive as {latitude, longitude} objects. The server handles the underlying API’s coordinate-order conventions internally, so the model is never asked to remember them.

  • Local tools for local work. Seven geometry tools, such as measure and points_in_polygon, compute results inside the server with no API call and no sign-in. Results that return a shape are simplified to a vertex budget, which keeps them small in the model’s context.

  • Current protocol, graceful fallback. The server follows the July 2026 specification through the official TypeScript SDK, and serves older clients through the SDK’s legacy negotiation.

How the Hosted Service Handles Identity, State and Logs

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 

Running the Same Server Yourself


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.

MCP

Four Deployment Patterns for Enterprise MCP Servers

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

 

Pattern 1: Local Servers Over stdio

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.

  •  Fits when: one team is experimenting, or a tool only touches local files or the user’s own accounts

  • Costs you: every machine holds its own credentials and its own copy of the server, so rotating a key or shipping a fix means touching every laptop

Pattern 2: Self-Hosted Remote Servers


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.

  • Fits when: the server touches internal systems or regulated data that must stay inside your network

  • Costs you: scaling, patching, monitoring and the authorisation layer are all yours, and a remote server needs real authentication, covered later in this guide

Pattern 3: Managed or Vendor-Hosted Servers


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.

  • Fits when: you are connecting well-known SaaS tools, or engineering capacity is thin

  • Costs you: tool traffic and credentials pass through someone else’s infrastructure, so check data residency, audit-log export, uptime commitments and what happens to your configuration if you leave

Pattern 4: A Gateway in Front of Everything

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.

  • Fits when: several teams share servers, or compliance demands one audit trail

  • Costs you: a single choke point that needs high availability, careful policy design and its own on-call rota

Hybrid Setups Are the Norm

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.

Self-Hosted or Managed: A Decision Framework

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

Matching Patterns to Enterprise Use Cases

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

Identity, Authorisation and Secrets

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.

How MCP Authorisation Fits Together

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

 

Never Pass Tokens Through

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.

Shared or Per-User Credentials?

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

 

Scaling, Reliability and Observability

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:

  • Any instance can serve any request, so horizontal scaling and rolling deployments are straightforward. NextBillion’s hosted server works this way, building one instance per request

  • Clients cache list results for the period a server specifies (ttlMs)

  • An interrupted call cannot be resumed, so a retry may repeat a side effect. Design write tools to be idempotent

  • Older clients still exist, so keep a fallback path. NextBillion’s server leans on the SDK’s legacy negotiation for exactly this

Keeping the Tool List Under Control


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.

What to Log and Measure

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.

Example: Tracing One Routing Question

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.

A Practical Rollout Path

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

 

Pre-Production Checklist

  • Authentication follows the OAuth 2.1 flow, with audience validation on every token

  • No token passthrough to downstream APIs

  • Secrets come from a secrets manager, not from config files or prompts

  • Logs capture caller, tool, outcome and a trace ID

Where NextBillion.ai's MCP Server Fits

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. 

  • Start with the hosted endpoint: add https://mcp.nextbillion.io to an MCP client and sign in with your NextBillion API key in the browser. 

  • When you are ready to share it, apply the patterns above: decide whether traffic should pass through your own gateway, curate which tools each agent can see, and treat the API key as a managed secret.

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.

Conclusion

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.

FAQs

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.

About Author

Bhavisha Bhatia

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.

Ready to get started?

Table of Contents