Skip to content

Model Context Protocol (MCP) and MCP Servers for Developers

The Model Context Protocol is an open standard for connecting AI applications to your data and tools. A practitioner's guide to how MCP works, the host-client-server model, its tools, resources, and prompts, building an MCP server, and the security part most demos skip.

Artem Zaitsev
Artem ZaitsevCTO · Idealogic
Author: Artem ZaitsevPublished: Updated: Reading time: 20 minHow we write →
On this page
Idealogic: Model Context Protocol

Every team that builds with AI hits the same wall. Your coding agent is smart, but it can't see your database, your issue tracker, or your internal docs, so you write a custom integration to connect it. Then you do it again for the next tool, and again for the next model, and the connectors multiply until you're maintaining a small zoo of one-off adapters. The Model Context Protocol exists to kill that work. MCP is an open standard for connecting AI applications to the systems where your data and tools actually live, through one interface instead of many. This is a practitioner's guide to what MCP is, how it works under the hood, how it differs from plugins and hand-rolled integrations, how to build an MCP server, and the security part the demos tend to skip.

The short version

  • The Model Context Protocol (MCP) is an open standard Anthropic released in November 2024 that connects AI applications to external tools and data through one interface instead of a custom integration for every pairing.
  • It uses a host-client-server architecture: the host is the AI app you use, each client holds one dedicated connection, and a server exposes capabilities and can run locally or as a remote service.
  • A server offers three primitives split by who controls them: tools the model calls to take actions, resources the app pulls in as read-only context, and prompts the user invokes as templates.
  • Under the hood MCP is a JSON-RPC 2.0 protocol (the data layer) carried over stdio for local servers or Streamable HTTP for remote ones (the transport layer). The current spec is stateless.
  • You build a server with an official SDK by describing each tool's name, description, and JSON Schema, then test it with the MCP Inspector. The SDK handles the protocol, so most of the effort goes into designing good tools.
  • MCP can't enforce safety on its own, so a host must get explicit user consent before any tool call and treat each server as untrusted code: the main risks are malicious servers, prompt injection, and token mishandling.

What is MCP (Model Context Protocol) and why it exists

The Model Context Protocol is an open standard for connecting AI applications to external systems: your files, your databases, your APIs, your internal services. Anthropic released it in November 2024 and the official docs use a hardware analogy that lands well: think of MCP as "a USB-C port for AI applications." Before USB-C, every device needed its own cable. MCP is the standard plug, so an AI app and a data source can connect without a custom adapter for that exact pairing.

The problem it solves has a shape you can draw. Say you have a number of AI applications and a number of systems you want them to reach. Wire each one directly and you're on the hook for an integration per pair: that's the M times N problem, and it grows fast. Anthropic framed it plainly in the announcement: "Every new data source requires its own custom implementation, making truly connected systems difficult to scale." MCP turns the M times N tangle into M plus N. Each AI app implements the protocol once, each system exposes one MCP server once, and any app can talk to any server.

Each side implements the protocol once, turning the M times N integration problem into M plus N

The official spec puts the lineage in useful terms. MCP "takes some inspiration from the Language Server Protocol," the standard that lets one language server give editor features to a whole ecosystem of IDEs instead of every editor reimplementing support for every language. MCP makes the same move for AI: standardize the integration once so context and tools flow across the ecosystem and nobody rebuilds them for each tool and each model. That's the whole idea.

Adoption came early. At launch, Block and Apollo had already integrated it, and developer-tool companies including Zed, Replit, Codeium, and Sourcegraph were working with it. In December 2025 Anthropic donated MCP to the Agentic AI Foundation, a Linux Foundation fund it co-founded with Block and OpenAI, so the protocol no longer sits with one vendor. The official docs now name Claude, Visual Studio Code, and Cursor among the clients that support it.

MCP turns the M times N integration problem into M plus N. Each AI app speaks the protocol once, each system exposes one server, and the bespoke glue code stops multiplying.

One scope note before the architecture. MCP isn't a model or an agent framework, and it doesn't replace your APIs. The docs are careful here: MCP "focuses solely on the protocol for context exchange," and doesn't dictate how an application uses an LLM or manages the context it receives. MCP is the wiring between an AI app and the systems around it. What the model does with that connection is up to the application.

How MCP works: hosts, clients, and servers

MCP follows a client-server architecture with three participants, and once you have the names straight you understand most of how MCP works. The official architecture docs define them directly:

The relationship is one client per server, each with its own dedicated connection. An IDE acting as a host might run one client connected to a local filesystem server and another connected to a remote error-tracking server, both at once. That isolation is deliberate: each connection is independent, so one server can't see another's traffic.

Each client holds one dedicated, isolated connection to one server, local or remote

Data layer and transport layer

Under those roles, MCP is built in two layers. The architecture docs describe a data layer and a transport layer.

The data layer is the protocol itself. It "defines the JSON-RPC based protocol for client-server communication," built on JSON-RPC 2.0, and it covers how a client finds out what a server supports, plus the core primitives. This is the part developers care about, because it defines what a server can offer and how a client asks for it.

Older tutorials get one detail wrong, because it changed. In spec versions up to 2025-11-25, a connection opened with an initialize handshake in which client and server negotiated capabilities, and the session was stateful. The current 2026-07-28 specification describes MCP as a stateless protocol: every request carries the protocol version and the capabilities relevant to it, and a server advertises what it supports through a server/discover request that a client can send before anything else. If you maintain a server written against an earlier version, check which version your SDK targets.

The transport layer is how those messages travel, and the data layer doesn't care which one you pick. MCP defines two:

  • Stdio. Standard input and output streams, used when the server runs locally as a subprocess on the same machine. There's no network hop, which makes it fast and keeps the server reachable only by the local client.
  • Streamable HTTP. HTTP for remote servers, with optional Server-Sent Events for streaming. This is the transport for hosted MCP servers, carrying standard HTTP bearer tokens obtained through OAuth 2.1 flows and RFC 9728 Protected Resource Metadata discovery.

Because the transport is abstracted away, the same JSON-RPC messages work whether a server is a local process or a service across the internet. You design your tools and resources once, and where the server runs becomes a deployment choice.

AspectStdioStreamable HTTP
Where the MCP server runsLocal subprocess on the same machineRemote service
Network exposureNone, only the local client reaches itReachable over HTTP
AccessRuns with the local user's privilegesOAuth 2.1 bearer tokens
Best whenOne developer needs filesystem, git, or CLI accessTeammates, cloud agents, or CI share one server

MCP primitives: tools, resources, and prompts

What an MCP server exposes is called a primitive. A server offers three, and the easiest way to keep them straight is by who controls each one, which is how the official server docs frame it.

  • Tools are model-controlled. A tool is a function the AI can call to take an action: query a database, send a message, create a calendar event, write a file. The model decides when to invoke a tool based on the task. The spec is blunt that "tools represent arbitrary code execution" and need to be treated with caution, which is why the security section later in this piece matters. A client discovers tools with tools/list and runs one with tools/call.
  • Resources are application-controlled. A resource is read-only data the host can pull in as context: file contents, a database schema, API documentation, a knowledge-base article. Each resource has a unique URI, like file:///path/to/doc.md, and the application decides what to include and how. There are also resource templates, parameterized URIs such as a weather forecast keyed by city and date, so one definition serves a family of queries. Clients use resources/list and resources/read.
  • Prompts are user-controlled. A prompt is a reusable, parameterized template a person invokes deliberately, often surfaced as a slash command in the host UI. A "summarize my meetings" or "plan a vacation" template that takes structured arguments is a prompt. Clients discover them with prompts/list and fetch one with prompts/get.

Remember that split when you design a server. Tools are for the model to act, resources are for the app to supply context, and prompts are for the user to trigger a workflow. Keep the three apart and an MCP server stays predictable. Mix them, say by hiding a write action inside something you call a resource, and the server starts surprising people.

The protocol also defines a small set of client features that flow the other direction, from server to client. The current one is elicitation, where a server asks the user for more information mid-task. Sampling lets a server ask the host to run a language-model completion on its behalf, which the architecture docs call "useful when server authors want access to a language model, but want to stay model-independent." Don't build new servers around it, though. The same docs mark sampling and roots as deprecated as of protocol version 2026-07-28. Logging, which older guides list next to them, is a utility feature in the spec.

MCP vs plugins vs custom integrations

If you've wired AI into a product before, MCP looks familiar, and the natural question is what it buys you over the approaches you already know. The answer is standardization, and standardization pays off at the boundaries.

A hand-rolled integration is the baseline. You write code that connects one specific AI app to one specific system, exactly the way you want. It's as flexible as it gets, and it works. The cost shows up the second time: a different model, a different tool, a different app, and you're writing another adapter. Nothing you built transfers. This is the M times N tax in practice, and it's fine until you have enough pairs that maintaining them becomes the job. MCP's pitch is narrow: build the server once, and every MCP-speaking client can use it, today and as models change.

A plugin system is closer, but one vendor usually owns it. A plugin written for one platform's plugin format runs on that platform and nowhere else; the interface, the lifecycle, and the distribution all belong to whoever made the platform. MCP is an open specification rather than a single vendor's proprietary extension point, which matters over multi-year maintenance cycles. A server you write to the MCP spec isn't a bet on one company's roadmap. The docs lean on this: build to the standard and "integrate everywhere" a client supports it, with no rebuild per platform.

A standard isn't free, though. MCP adds a layer of indirection. For a single integration you'll build exactly once and never reuse, a direct call is simpler, and reaching for the protocol is overhead with no payoff. MCP earns its keep when you have more than one consumer, more than one system, or a real expectation that the models and tools underneath you will change. In AI, they usually do. Pay for the abstraction when the reuse is real, and skip it when it isn't.

ApproachReusable across apps and modelsOwnerBest when
Custom integrationNo, rebuilt per pairYouA single one-off connection
Vendor pluginWithin one platformThe platform vendorYou live inside one ecosystem
MCP serverYes, any MCP clientOpen standardMultiple consumers or changing models

Connecting an AI agent to the systems around your code is the broader discipline our AI integration services handle end to end, and MCP has quickly become the default way we do that wiring when more than one consumer is in play.

How to build an MCP server: the shape of it

You almost never implement the protocol by hand. The MCP project ships official SDKs for TypeScript, Python, Go, Rust, C#, and several other languages, so you describe what your server offers and the SDK handles the JSON-RPC and the transport. What follows is the shape of building an MCP server and the concepts you reason about. It isn't a line-by-line tutorial, because the SDK docs cover the exact calls and those change often enough that pinning them here would age badly.

Tools

Start with the tools, because that's where most of the value and most of the risk live. Each tool definition carries three things: a name, a description, and an inputSchema. The schema is plain JSON Schema, listing the arguments and their types, which is what lets a client validate a call before it runs. A flight-search tool, for instance, declares string arguments for origin, destination, and date, and marks which are required. The description field does real work. It's what the model reads to decide when and how to use the tool, so a vague description produces a tool the model misuses or ignores. Our explainer on how AI agents work goes deeper on tool design, and the rule carries over: narrow, well-described tools that are hard to misuse beat one clever do-everything tool.

Resources and prompts

Expose resources if the server has context to share. A resource is data behind a URI that the host can read. The design question is which reference material the AI needs (a schema, a doc set, a record) and which would only bloat the context window. Resource templates let one definition cover a parameterized family, so you're not hand-registering a thousand near-identical URIs.

Add prompts where a repeatable workflow deserves a named template the user invokes.

Choose a transport and test with the Inspector

Pick stdio if the MCP server runs locally beside the client, and Streamable HTTP if it runs as a remote service. That one choice determines deployment and most of your security posture, which the security section below covers.

Two habits help here. First, test the server in isolation before you connect it to anything real. The project ships the MCP Inspector, a tool for exercising a server's tools and resources directly, so you can confirm behavior without a full host in the loop. Second, design the tools for a model, because a model reads them differently than a human API consumer would. A model reads the descriptions, guesses at arguments, and can't see your intent, so the tools that work are the obvious ones with honest error messages that let the agent recover when a call goes wrong. The SDK takes care of the protocol, so most of your time goes into the tools the model reasons about. We make the same point in our piece on agentic coding: the quality of the tools sets the ceiling on what the agent can do.

Want MCP servers and AI integrations built by a team that does this daily?
We connect AI agents to real systems through MCP and bespoke integrations, with the security review, tool design, and testing that keep the connection safe rather than just functional.
See our AI integration work

Where MCP fits in agentic coding

MCP matters most inside the loop where an AI agent does real engineering work, because that loop runs on context, and delivering context is what MCP standardizes. An agent that can only see the files in front of it is guessing about everything else. An agent that can reach your database schema, your ticketing system, and your internal services through MCP servers writes code that fits your systems. Without that access you get plausible code that fits nothing.

In the AI-native engineering stack, MCP sits between two neighbors. Tools are how an agent acts. MCP is how those tools and your data get exposed to the agent in a standard way. Skills are the procedural knowledge that teaches the agent how to use them well. We cover that last layer in our guide to Claude Code skills, and the short version is that MCP is the connection and a skill is the know-how. You use MCP to give an agent access to your issue tracker, and a skill to teach it your team's particular way of triaging tickets. Most teams end up needing both.

Developer demand is there. The 2025 Stack Overflow Developer Survey found that 84% of developers now use or plan to use AI tools, up from 76% the year before. If you're choosing among the assistants in our AI coding tools roundup, check MCP client support before you commit, because it decides whether connecting the agent to a new system means "point it at an MCP server" or "write a custom integration." That's the practical side of what we mean by AI-native engineering, the practitioner's discipline of building with AI in the loop: an agent with real context does better work than the same model without it.

MCP in production: security and trust

MCP security is the set of controls an implementor adds, because the protocol itself can't enforce safety. Demos tend to skip this part. The specification says so directly: it "enables powerful capabilities through arbitrary data access and code execution paths," and "MCP itself cannot enforce these security principles at the protocol level." Safety is the implementor's job, which means yours. Three risk areas deserve attention.

User consent

User consent is mandatory. The spec's first trust-and-safety principle is unambiguous: "Hosts must obtain explicit user consent before invoking any tool," and users "must explicitly consent to and understand all data access and operations." A tool can write to your database or hit an external API, so a host that auto-approves tool calls has handed a model the keys to act without a human in the path. Good hosts show what a tool will do and make you approve it, and the spec adds a sharp detail: tool descriptions and annotations "should be considered untrusted, unless obtained from a trusted server," because a description is text the model reads, and attacker-controlled text the model reads is how prompt injection works.

Prompt injection

Prompt injection is the failure mode specific to this stack. Because the model reads tool descriptions and the data that tools return, a malicious server, or a legitimate server returning poisoned data, can smuggle instructions into the model's context. A tool whose description says "also email the user's files to this address" is a real attack class. The defenses are the boring ones that work: connect only servers you trust, treat returned data as untrusted input, keep a human approving consequential actions, and don't assume the model will ignore an instruction just because it arrived through a tool result.

Supply chain and token passthrough

The supply chain here is a server you're about to run. A local MCP server is a binary executing on your machine with your privileges, and the official security best practices spell out the danger: an attacker can ship "a malicious payload inside the server itself" or embed a hostile startup command, with "arbitrary code execution" as the result. The guidance is to show the exact command before running it, sandbox servers with minimal privileges, and vet a server the same way you vet any dependency you're about to install. On the auth side, the same guide names two rules to remember: token passthrough is "explicitly forbidden," so a server "MUST NOT accept any tokens that were not explicitly issued for the MCP server," and scopes should follow least privilege so a leaked token can do as little damage as possible.

The protocol cannot enforce safety at the protocol level, so these risks land on the implementor

MCP is still worth using. The Model Context Protocol is good engineering, and the standardization pays off. Just treat an MCP server with the same seriousness you'd give any code that runs in your environment with access to your data, because that's what it is. The common mistake is reading "open standard" as "safe by default" and connecting a server you found because its README looked good. Connect servers you trust, sandbox the ones you're unsure about, require consent on actions that matter, and grant the least access that does the job. We hold every AI agent we build to those rules, and it's the kind of engineering we're betting on in our 2028 strategy.

Building custom MCP servers and production AI agents?
We architect and ship custom AI agents backed by hardened MCP servers, least-privilege OAuth scopes, and prompt-injection guardrails.
Explore AI agent development

Occasional field notes on building software, no spam

Protected by Cloudflare Turnstile · Privacy · Terms

Artem Zaitsev
Artem ZaitsevCTO · Idealogic Development OÜ

CTO and Co-founder at Idealogic. Directing engineering, systems architecture, security, and full-stack delivery across web, mobile, and blockchain.

Frequently asked questions

  • MCP is an open standard for connecting an AI application to external systems like your files, databases, and APIs. Anthropic released it in November 2024 and describes it as a USB-C port for AI applications: instead of writing a custom integration for every tool and every model, you connect through one standard interface. An AI app speaks MCP, a system exposes an MCP server, and the two work together without custom glue code.

  • An MCP server is a program that exposes capabilities to an AI application over the protocol. It can offer three things: tools, which are functions the model can call to take an action like querying a database; resources, which are read-only data the application can pull in as context; and prompts, which are reusable templates a user can invoke. A server can run locally on your machine or remotely as a service, and one AI app can connect to many servers at once.

  • MCP has two layers. The data layer is a JSON-RPC 2.0 protocol that defines the messages: discovering what a server supports, plus the calls for tools, resources, and prompts. The transport layer is how those messages travel, either over standard input and output for local servers or over Streamable HTTP for remote ones. A host application creates one client per server, and the client discovers what a server offers before the model uses any of it. The current spec (2026-07-28) is stateless, so every request carries the protocol version and capabilities it needs. Earlier versions opened with an initialize handshake instead.

  • They differ by who controls them. Tools are model-controlled: the AI decides when to call them to perform an action, like sending a message or running a query. Resources are application-controlled: read-only data such as file contents or a database schema that the app pulls in as context. Prompts are user-controlled: templates a person invokes deliberately, often as a slash command. That split keeps actions, context, and user-triggered workflows apart.

  • Use one of the official MCP SDKs. They exist for TypeScript, Python, and several other languages, so you describe your tools and resources and the SDK handles the protocol. For each tool you give a name, a description, and an input schema in JSON Schema that defines its arguments. For resources you expose data under a URI. Then you pick a transport, standard input and output for a local server or Streamable HTTP for a remote one, and test the server with the MCP Inspector before connecting it to a real client. Most of the effort goes into designing good tools.

  • MCP is a connection standard, and the protocol itself can't enforce safety, so security is the implementor's job. The specification is direct that tools represent arbitrary code execution and that a host must obtain explicit user consent before invoking any tool. The real risks are a malicious or compromised server running code on your machine, prompt injection through tool descriptions or returned data, and token mishandling. The spec forbids passing user tokens through to downstream APIs and pushes least-privilege scopes. Treat an untrusted MCP server like any untrusted dependency: review it, sandbox it, and grant it the minimum access it needs.

  • Use stdio when the server runs on the developer's own machine and needs local filesystem, git, or CLI access without exposing a network port. Choose Streamable HTTP when multiple teammates, cloud agents, or CI pipelines share one centralized server, or when credentials and audit logs belong inside your cloud VPC rather than on employee laptops. Local stdio keeps setup fast for single-user tools. With Streamable HTTP, an operations team can manage OAuth scopes, rate limits, and revocation in one place.

  • Remote MCP servers running over Streamable HTTP authenticate requests with OAuth 2.1 bearer tokens scoped specifically to the MCP server, using OAuth 2.0 Protected Resource Metadata (RFC 9728) so clients can discover the authorization server automatically. The specification strictly forbids token passthrough, meaning an MCP server must validate tokens issued for its own audience rather than forwarding a client's raw token straight to downstream APIs. With that boundary in place, each upstream system enforces its own least-privilege access and keeps a clean audit trail.

Still unanswered
Ask us directly

A senior engineer replies under 4 hours.

Related expertise