What it is
The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. An MCP server sits in front of a system, often wrapping an API you already run, and tells any compatible AI application what it can do, how to call it and what comes back. The application's client connects, lists the tools and lets the model choose among them.
The choice is rarely MCP or API. The API remains the system of record. MCP is the layer that makes it usable by an agent: discoverable at runtime, described for a model, governed in one place and reusable by every client. Use a direct API when your own code decides what to call; use MCP when a model decides.
How it works
Wrap the API
Put an MCP server in front of an existing REST, GraphQL, SQL or file-based system.
Describe tools for a model
Give each tool a clear name, description and typed schema around a task, not an endpoint.
Connect a client
The AI application opens a session and negotiates capabilities with the server.
Discover
The client lists the server's tools, resources and prompts, and they enter the model's context.
Call and enforce
The model picks a tool, the server checks authentication, scopes and limits, runs the action and returns a result.
Observe and audit
Each call is logged and traced, so you can govern, debug and cost it per tool.
Why choose MCP over calling an API directly
MCP does not replace APIs. An MCP server usually sits in front of an existing API and presents it to AI applications in a form they can discover and use safely. The benefits come from that layer.
Build the integration once
A REST API needs a separate connector for every AI application that calls it. An MCP server is written once and works with any MCP-capable client: a chat assistant, an IDE, a coding agent or your own agent. N applications times M systems becomes N plus M.
Discovery at runtime
An agent asks an MCP server what it offers and gets names, descriptions and typed input schemas back. With a plain API, a developer reads documentation and hand-writes each tool definition. New or changed capabilities reach the agent without a redeploy.
Designed for a model, not a developer
Good MCP tools are shaped around tasks (find_overdue_invoices) rather than endpoints (GET /v2/invoices?status=). Descriptions, argument names and error messages are written for the model to read, which measurably improves tool selection and recovery.
A consistent contract
Every server speaks the same protocol: the same handshake, the same way to list and call tools, the same error shape, the same progress and cancellation behavior. Agent code stops carrying per-vendor special cases.
Context beyond function calls
MCP defines resources (data the application can read), prompts (reusable templates) and, on the client side, sampling and elicitation. A bare API only gives you request and response.
A single point of control
Because every tool call passes through a server, that server is where you enforce authentication, scopes, rate limits, redaction, approvals and audit logging, instead of trusting each agent to behave.
Portability and less lock-in
Tools defined as MCP servers are not tied to one model vendor's function-calling format. You can change models or agent frameworks and keep the integrations.
An ecosystem to reuse
Open-source and vendor-supplied servers already exist for common systems such as source control, databases, ticketing, cloud platforms and documents, so many integrations start from something maintained rather than from scratch.
MCP vs. API at a glance
| Question | Direct API | MCP server |
|---|---|---|
| Primary consumer | Developers writing application code | AI applications and agents, discovered at runtime |
| Integration effort | One bespoke connector per application and system | One server per system, reused by every client |
| Capability discovery | Read the docs, hand-write the tool definitions | tools/list returns names, descriptions and schemas |
| Interface shape | Resource and endpoint oriented (CRUD) | Task oriented tools, plus resources and prompts |
| Statefulness | Usually stateless request and response | Session with negotiated capabilities; can stream progress and notifications |
| Error handling | HTTP status codes and vendor-specific bodies | Structured results with errors the model can read and recover from |
| Auth and permissions | Per API, wired separately in each client | Standard authorization (OAuth 2.1 for remote servers), enforced at the server |
| Change management | Breaking changes ripple into every caller | Server absorbs API changes; the agent re-discovers the tools |
| Best for | Deterministic code paths, high throughput, fixed integrations | Agents that choose what to call, across many systems, with oversight |
Inside an MCP server
The Model Context Protocol is an open standard, introduced by Anthropic in 2024 and now supported across many AI applications and vendors. It uses JSON-RPC messages between a client (inside the AI application) and a server (in front of a system). The application holds one client connection per server.
What a server can offer
Tools
Actions the model can request: query a database, create a ticket, run a report. Each has a name, a description and a JSON Schema for its arguments. Model-controlled, so it needs the strictest permissions.
Resources
Read-only data the application can attach as context: a file, a schema, a knowledge-base article, a record. Identified by URI. Application-controlled rather than model-controlled.
Prompts
Reusable, parameterized templates a user can invoke, such as a code-review or incident-triage workflow. User-controlled.
Sampling and elicitation
Client-side features a server can ask for: sampling lets a server request a model completion through the client, and elicitation lets it ask the user for missing input mid-task.
How the conversation goes
client -> server initialize protocol version, client capabilities
server -> client initialized server capabilities (tools, resources, prompts)
client -> server tools/list what can you do?
server -> client [ { name, description, inputSchema }, ... ]
client -> server tools/call name + arguments chosen by the model
server -> client result | error content the model reads nextA minimal server
This server exposes one read-only tool and calls an existing billing API behind it. The API stays the system of record. The server adds the schema, the description and the policy point.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({ name: "billing", version: "1.0.0" });
// A task-shaped, read-only tool. The description is written for the model.
server.tool(
"find_overdue_invoices",
"List invoices overdue by at least minDays. Read-only. Returns id, customer, amount and days overdue.",
{ minDays: z.number().int().min(1).default(14) },
async ({ minDays }) => {
const rows = await billingApi.listOverdue(minDays); // the existing REST API, behind the server
return { content: [{ type: "text", text: JSON.stringify(rows) }] };
},
);
await server.connect(new StdioServerTransport());Where servers run
Local (stdio)
The client launches the server as a subprocess and talks over standard input and output. Simple, no network exposure, runs with the user's own credentials. Good for developer tools and desktop assistants.
Remote (streamable HTTP)
The server runs as a shared service behind HTTPS. It supports many users and agents, central updates and OAuth-based authorization. This is the usual shape for enterprise deployments.
The role of MCP servers in agentic AI
An agent is only as capable, and as safe, as its tools. In an agentic system the MCP server is the boundary between the model's reasoning and the enterprise's real systems. Six roles follow from that.
The tool layer
The server is where an agent's reach into the enterprise is defined. What the agent can do is exactly the set of tools its servers expose, no more.
Translation
It wraps existing REST, GraphQL, SQL, SOAP or file-based systems and presents them in a model-friendly form, so legacy systems join agent workflows without being rewritten.
Context supply
Through resources, it feeds agents the data they need: schemas, policies, customer records, runbooks. That makes it a natural delivery path for retrieval and grounding.
Policy enforcement point
Authentication, per-user scopes, rate limits, input validation, output redaction, approval prompts and audit logs live here, outside the model's control and so outside the reach of prompt injection.
Composition across agents
Many agents and many models can share the same server, and servers can themselves be clients of other servers, so shared capabilities stay in one place.
Observability
Every call is a discrete, named event with arguments and a result, which gives you traces, cost and error rates per tool without instrumenting the agent.
How it fits the agent loop
At the start of a run the agent connects to its servers and lists their tools, which become part of the model's context. In each step the model decides whether to call one, the client sends the call to the right server, the server enforces policy and runs the action, and the result returns as an observation. Because discovery is dynamic, a team can add or change a tool without touching the agent, and a different agent can reuse it the next day.
Multi-agent systems
MCP connects agents to tools and data. Protocols such as Agent2Agent (A2A) connect agents to each other. They are complementary: specialist agents each use their own MCP servers, while an orchestrator coordinates the specialists.
When a plain API is still the right choice
Choose MCP when a model decides what to call. Keep the API when your own code does.
Deterministic code paths
If a script always calls the same endpoint with the same shape, a direct API call is simpler, faster and cheaper. Discovery and model-readable descriptions add nothing.
High-throughput services
Service-to-service traffic at scale has no model in the loop and should not pay for an extra hop.
Fixed, well-understood integrations
A single stable integration used by one application rarely justifies a server.
Streaming, bulk and binary workloads
Large data transfers belong on the native API or a storage link, with MCP passing a reference rather than the payload.
Security and governance
Giving an agent tools gives it power, and the MCP server is the right place to limit it. These practices apply to servers you build and servers you adopt.
- Least privilege per tool. Separate read tools from write tools, scope credentials to the user, and expose only what the task needs.
- Human approval for irreversible actions. Mark destructive tools clearly and require confirmation before they run.
- Treat tool output as untrusted input. A server returning web pages, tickets or emails can carry hidden instructions. Sanitize and limit what flows back into the model.
- Trust only vetted servers. A third-party server runs with real access. Review its source, pin versions and prefer servers you host or have audited.
- Authenticate remote servers properly. Use OAuth-based authorization with per-user tokens. Never pass a user's token through to a downstream API unchanged.
- Log every call. Record who, which tool, which arguments and what came back, so you can audit and investigate.
- Watch for tool sprawl. Dozens of overlapping tools waste context and confuse selection. Curate a small set per agent.
Adopting MCP step by step
Start with the agent's job
List the systems an agent needs and which actions are read-only versus state-changing.
Wrap existing APIs
Put an MCP server in front of the APIs you already have. Keep the APIs as the system of record.
Design task-shaped tools
Fewer, clearer tools beat a one-to-one mirror of every endpoint. Write descriptions for the model.
Put policy in the server
Authentication, scopes, redaction, rate limits and audit before the first agent connects.
Evaluate tool use
Test whether agents pick the right tool with the right arguments, and keep those tests in CI.
Roll out gradually
Begin with read-only servers, add write tools behind approvals, and expand as traces show it is safe.
Code and message flows are illustrative and simplified. The protocol is evolving, so check the current specification at modelcontextprotocol.io before building.
Key concepts
- MCP host, client and server
- The host is the AI application, it holds one client per server, and each server fronts one system.
- Tools
- Model-controlled actions with a name, description and JSON Schema for arguments.
- Resources
- Read-only data, identified by URI, that an application can attach as context.
- Prompts
- Reusable, parameterized templates that a user can invoke.
- Transports
- stdio for local servers and streamable HTTP for shared, remote ones.
- Authorization
- OAuth-based authorization for remote servers, with per-user scopes enforced at the server.
- Tool poisoning and prompt injection
- Hostile content in tool descriptions or tool output that tries to steer the model.
- Function calling
- The model-side mechanism for requesting a call. MCP standardizes where the tools come from, and function calling is how the model asks for one.
Tools & platforms
SDKs and frameworks
Clients and hosts
Gateways and operations
Skills employers look for
- Explaining when MCP adds value over a direct API, and when it does not.
- Designing task-shaped tools with clear descriptions, schemas and error messages.
- Building MCP servers in TypeScript or Python and testing them with MCP Inspector.
- Securing servers: least privilege, OAuth, approvals, redaction and audit logs.
- Defending against prompt injection and tool poisoning from untrusted tools and outputs.
- Evaluating tool selection and argument accuracy across models and agents.
Enterprise use cases
Enterprise agent platform
One governed catalog of servers for CRM, ERP, ticketing and data, shared by every agent and assistant.
Legacy modernization
Expose older SOAP, database or file-based systems to agents without rewriting them.
Developer tooling
Give coding agents access to repositories, CI, issue trackers and internal docs.
Customer and employee assistants
Let assistants look up records and take approved actions with per-user permissions.
Common pitfalls
- Mirroring every endpoint as a tool — hundreds of low-level tools confuse the model and eat context; design around tasks.
- Treating MCP as a security boundary by itself — it is where you enforce security, not security on its own.
- Installing unvetted third-party servers — a server runs with real access, so review, pin and host what you trust.
- Skipping evaluation — test that agents choose the right tool and arguments, not just that the server responds.
- Using MCP where code decides — a fixed, deterministic call is simpler and faster as a direct API call.
How MrAI.dev helps
We assess which of your APIs agents should reach, design task-shaped MCP servers with authentication, scopes, redaction and audit built in, and evaluate tool use before anything touches production systems.
Book a discovery call