What an MCP server is and when a product needs one
A plain explanation of the Model Context Protocol for CTOs: hosts, clients and servers, tools, resources and prompts, the two transports, OAuth for remote servers, and how to decide whether your product needs an MCP server or a plain API.
- Written by
- Baraqix Engineering
- Published
- Read
- 9 min
- Filed under
- agents
Contents10 sections
An MCP server is a service that exposes your product's actions and data to AI assistants and agents through the Model Context Protocol, an open standard. The assistant connects, asks which tools and resources exist, and calls them by name with structured arguments. A product needs one when assistants it does not control must act inside it, under permissions you define.
This note covers what a CTO needs to decide whether to build one, including the common case where a plain API is enough. Protocol details are checked against the revision of the specification dated 28 July 2026, the latest at the time of writing.
What the protocol defines
MCP is built on JSON-RPC 2.0 messages and names three roles. The host is the AI application a person uses, such as a chat assistant or an IDE. Inside the host, each client communicates with exactly one server, and a host can run several clients at once. The server is your code. It exposes capabilities and answers requests, and it can be a local process or a remote service.
The split matters for security. The host enforces consent and security policy. The specification's design principles say a server should not be able to read the whole conversation or see into other servers. Your server receives a request to run one tool with some arguments, and little beyond that.
Tools, resources and prompts
A server can offer three kinds of capability, and the specification separates them by who is in control.
- Tools are model controlled. They are functions the language model can discover and call, such as looking up an order or creating a ticket. A client lists them with tools/list and runs one with tools/call.
- Resources are application controlled. They are data the client attaches as context, each identified by a URI, such as a file or a record. The client application decides when to attach them.
- Prompts are user controlled. They are templates a person chooses to run, the kind of thing an assistant shows as a slash command or a menu option.
Most product integrations start with tools. A tool definition has a unique name, a description, and an input schema written in JSON Schema. A display title is optional. Here is a small one.
{
"name": "get_order_status",
"title": "Order status",
"description": "Returns the status, items and delivery date of one order that the signed in user is allowed to see. Read only. Cannot change or cancel an order.",
"inputSchema": {
"type": "object",
"properties": {
"order_id": {
"type": "string",
"description": "The order identifier shown to the customer, for example ord_1042"
}
},
"required": [
"order_id"
],
"additionalProperties": false
}
}The description is the text the model reads when it decides whether to call the tool, so it says what the tool does, what it returns and what it cannot do. Setting additionalProperties to false means the model cannot pass a field nobody planned for. Tools can also carry annotations about their behaviour, but the specification tells clients to treat annotations as untrusted unless they come from a trusted server. The control has to live in your code.
Local and remote: the two transports
The specification defines two standard transports. With stdio, the client launches the server as a subprocess on the same machine, and the two exchange newline delimited JSON-RPC messages over standard input and output. This is the shape of a developer tool, such as a server that reads a local repository.
With Streamable HTTP, the server runs as an independent process that can handle many client connections. It exposes a single HTTP endpoint. Every client message is a POST to that endpoint, and the server answers each request with a JSON object or an event stream scoped to that request. That revision also removed the protocol level sessions and the separate GET stream of earlier versions. Every request now carries its own protocol version and capabilities, so a remote MCP server scales like any other stateless HTTP service. This is the shape of a product integration: a server you host, reached by assistants over the internet.
The HTTP transport comes with security requirements that are easy to miss. Servers must validate the Origin header on incoming connections to prevent DNS rebinding attacks, should bind only to localhost when running locally, and should authenticate every connection.
Authentication for remote servers
Authorization is optional in the specification, but a remote server that touches customer data needs it. For stdio, the specification says to skip its authorization flow and read credentials from the environment. For HTTP, it defines a flow built on the OAuth 2.1 draft.
- Your MCP server acts as an OAuth resource server. It accepts access tokens and validates them.
- An authorization server issues the tokens. It can run with your MCP server or be a separate system.
- Your MCP server must publish OAuth Protected Resource Metadata (RFC 9728), which tells a client where to find the authorization server. A client finds that document through the WWW-Authenticate header on a 401 response or at a well known address.
- The client sends the user through a browser sign in with PKCE and names your server as the intended resource (RFC 8707), so the token it receives is meant for your server alone.
- Your server must reject any token that was not issued for it, and must never pass the token it received on to an upstream API. A call upstream uses a separate token from that API's own authorization server.
That last rule deserves the closest look in any review. A server that forwards the token it received to a downstream API has become a way around that API's own checks.
Permissions are your job
The protocol carries the call. It does not decide what your user is allowed to do. The specification says tools represent arbitrary code execution, hosts must obtain explicit user consent before invoking any tool, and a human in the loop should be able to deny a call. Servers must validate all tool inputs, implement proper access controls, rate limit tool invocations and sanitise tool outputs. Clients should log tool usage for audit purposes.
OAuth scopes give you the coarse control. Your server can answer with a 403 and an insufficient_scope error when a token lacks a scope, and the specification lets it return only the tools a caller's scopes permit when the client asks for the list. The fine control is the authorization your product already applies, such as whether this user may see this order. The MCP server should ask your existing services that question every time.
Where it sits in a backend
The diagram at the top of this note is the backend shape from the Backend and APIs section of our services page. Clients pass an authentication and rate limit gate and reach an API. The API calls domain services, which read and write Postgres, cache in Redis and put slow work on a job queue for background workers. Logs and metrics come from every layer.
An MCP server belongs at the API layer. It is one more entry point behind the same gate, calling the same services, so an agent acting for a user gets exactly that user's permissions, and every tool call lands in the same logs as every API request. The MCP server is a door into your backend, not a second backend. A server with its own database connection and its own idea of who may do what will drift from the rules your product enforces. A thin server over services you already test stays small and inherits every fix.
When a product needs one
Two situations justify the work.
- Your customers use AI assistants and want them to act inside your product. A customer asks their assistant to check an order or open a support ticket, and the assistant needs a governed way in. One MCP server works with any host that speaks the protocol, so you build and secure one integration.
- Your own agents need governed access to several internal systems. One server per system, each with narrow tools and its own scopes, gives every agent the same permission model and the same audit trail. The host composes the servers, and the protocol keeps each one isolated from the others.
When a plain API or a function call is enough
If the only agent that will ever call your code is one you build, running in your own backend, you do not need a protocol between them. A function call inside the agent, meaning a tool definition in the model request that maps to a function in your service, gives the same narrow surface with one fewer process, one fewer transport and no OAuth flow.
If the caller is another company's software, written by their developers, a documented REST API is the right interface, because a person reads the documentation and writes the integration. MCP earns its place when the caller is a model and the capabilities have to be discoverable, either by hosts you did not write or by several agents of your own. Sometimes the honest answer is a simpler system with no model in it at all.
| Situation | What to build |
|---|---|
| Customers want their AI assistant to act inside your product | A remote MCP server over Streamable HTTP, with OAuth |
| Internal agents need several systems under one permission model | One MCP server per system, narrow tools, scoped tokens |
| A developer tool that works on local files or a local database | A local MCP server over stdio, credentials from the environment |
| Your own agent calls your own services | A function call inside the agent, no protocol |
| A partner's developers integrate with your product | A documented REST API |
The design rule we apply
The rule from our phone ordering agent applies directly here. Keep a dangerous capability off the tool surface, instead of adding it and relying on everyone being careful not to call it. An agent that cannot do a thing does not need a prompt telling it not to. For an MCP server, that rule turns into four habits.
- Narrow tools. A tool like get_order_status with one argument, never a general query tool with a free text field.
- Read only by default. Start with tools that read. Add a write tool only when there is a reason, one at a time. Our NL2SQL system runs its generated SQL read only for the same reason.
- Nothing destructive on the surface. Deletes, refunds, permission changes and bulk updates stay out of the tool list. If a person needs them, a person does them in the product.
- An audit log on the server. Every tool call is written with the user, the tool, the arguments and the outcome, whether or not the client keeps its own log.
How we approach this for a client
On our services page, MCP sits under AI integration: agents that call your tools through MCP servers with permissions you define. The first step is a Discovery Sprint, two weeks at a fixed price agreed before we start. It runs the agent loop against your real data and ends with an architecture document and a working spike in a repository you own, and you keep both whether or not we continue. For an MCP server, the architecture document is where the tool list gets decided, along with the tools that stay off it.
Baraqix Engineering. Written by the engineers who did the work.
NOTE/04. First published .