Book a free call

How Does the Model Context Protocol Work?

The Model Context Protocol lets an AI model call tools and read data through one standard plug. Here is how the host, client and server pass a request between them.

Hertiv engineering teamReviewed by a senior engineer
7 min read
How Does the Model Context Protocol Work?
On this page

Short answer

The Model Context Protocol is an open standard that lets an AI model talk to outside tools and data through a shared plug instead of a custom link for each one. A host app runs a client, the client connects to a server, and the server exposes tools, data and prompts. The model sends a request, the server runs it, and the answer comes back in the same format.

What is the Model Context Protocol?

The Model Context Protocol, often shortened to MCP, is a standard way for an AI model to reach tools and data that live outside the model. It defines how a model asks for something, how the answer is shaped, and how the two sides agree on what is available.

Before MCP, each tool needed its own link to each model, so a team that used five tools with three models had to build and maintain fifteen links. MCP replaces that with one plug: a tool that speaks MCP works with any model that speaks MCP.

The protocol is open, which means anyone can build a host, a client or a server that follows it. It does not run the model itself and it does not store your data. It only carries requests and answers between the parts that do.

Think of it like a power socket. The socket does not make the electricity, but every plug that fits it can draw power. MCP is the socket between models and the tools they use.

What are the parts of MCP?

MCP has three parts: a host, a client and a server. Each one has a single job, and the three together form one connection.

PartWhat it doesExample
HostRuns the model and the clientA chat app or coding assistant
ClientKeeps one connection to a serverThe link inside the host app
ServerExposes tools, data and promptsA docs server or a database server

The host is the app the user sees. It holds the model, shows the answers, and asks the user before a tool runs when the action matters. The host can run more than one client at once, so one chat app can talk to a docs server and a calendar server at the same time.

The client is the connection itself. It starts the session, asks the server what it offers, and sends each request in the agreed format. One client talks to one server, which keeps the traffic simple to trace.

The server is the part that owns the tools and the data. It lists what it can do, runs each request, and returns the result. A server can be local, running on the same machine, or remote, running on a service you trust.

How does a request flow through MCP?

A request flows through MCP in a short loop. The model decides it needs something outside its own knowledge, the host sends the request, the server runs it, and the result comes back to the model.

The loop has five steps:

  1. Ask. The model reads the user request and decides which tool fits, based on the list the server shared.
  2. Check. The host shows the user what will run, when the action changes data or costs money.
  3. Call. The client sends the tool name and its inputs to the server in the standard format.
  4. Run. The server runs the tool against its own data and returns the result.
  5. Answer. The model reads the result and writes the reply to the user.

Each step is a message in the same format, so either side can log the whole exchange. That log is useful when a tool returns the wrong data or a request fails, because you can see exactly which step broke.

The model never talks to the tool directly. The server sits between them, which means the server can check permissions, limit what the model can see, and refuse a request that breaks its rules.

What can a server expose?

A server can expose three things: tools, resources and prompts. Each one gives the model a different kind of help.

What the server exposesWhat it gives the modelExample
ToolsActions the model can runSearch the docs, file a ticket
ResourcesData the model can readA policy file, a price list
PromptsReady-made instructionsA triage template for support

Tools are the most powerful of the three, because they change things. A tool can search, create, update or delete, so servers should only expose tools the model is allowed to use, and hosts should ask the user before a tool that changes data runs.

Resources are read-only data the model can pull into its context. A resource might be a single document, a list of files, or a live feed. The model reads the resource and uses it to answer, without changing anything.

Prompts are templates the server offers to the host. A support server might offer a triage prompt that tells the model how to sort tickets. Prompts keep the instructions in one place, so every model that connects uses the same wording.

When a client first connects, the server lists all three. The host shows the list to the model, and the model picks from it. Nothing is hidden: the model only sees what the server chose to expose. For a plain definition of the pieces, see what the Model Context Protocol is.

How do you connect a model to an MCP server?

You connect a model to an MCP server by picking a host, adding the server to its settings, and testing one tool call before you trust it with real work.

A workable sequence:

  1. Pick a host. Choose an app that supports MCP and fits how your team works, such as a chat app or a coding assistant.
  2. Find a server. Use a server built for the tool you need, such as a docs, database or ticket server.
  3. Add the connection. Put the server's command or address in the host settings, with the keys it needs.
  4. Check the list. Open the connection and read the tools and resources the server exposes.
  5. Test one call. Run a harmless read, such as a search, and check the result is right.

Start with read-only servers. A search or a lookup cannot change your data, so a mistake costs little. Add tools that change data only after the read-only calls work well.

Keep keys and tokens out of shared files. A server that reaches your data needs a key, and that key should live in the host's own settings, not in a chat log or a shared document. A team that needs a custom server can look at MCP server development for how one is built and secured.

Example (hypothetical): a support agent checks an order

Example (hypothetical): a support team handles 120 tickets a day. Each ticket takes a support agent about 3 minutes to answer by hand, because the agent must open the order system, find the order, and copy the status into a reply. That is 120 times 3 minutes, which is 360 minutes, or 6 hours a day.

The team connects its chat app to an MCP server that exposes one tool: look up an order by number. The model reads the ticket, calls the tool with the order number, and gets the status back in seconds.

With the tool, each ticket takes about 1 minute to answer, because the model drafts the reply from the tool result and the agent only checks it. That is 120 times 1 minute, which is 120 minutes, or 2 hours a day.

The team saves 360 minus 120 minutes, which is 240 minutes, or 4 hours a day. The saving comes from one tool call, not from a new model, which is why teams often start with a single high-volume lookup before they add more tools.

What are the common mistakes?

The most common mistakes are exposing too much, skipping the user check, and trusting tool results without checking them.

  • Exposing every tool. A server should expose only what the model needs. Each extra tool is an extra way for a bad prompt to change data.
  • Skipping the user check. Tools that change data should ask the user first. An automatic write is a mistake waiting for a bad input.
  • Trusting results blindly. A tool can return stale or wrong data. The model should show its source, and the user should check it.
  • Sharing keys in plain text. Keys belong in the host settings, not in chats or shared docs.
  • Adding tools before the first one works. One working tool teaches more than five half-connected ones.

Key takeaways

  • MCP is one standard plug between models and outside tools
  • A host runs the model, a client keeps the connection, a server exposes tools and data
  • Requests run in a five-step loop: ask, check, call, run, answer
  • Servers expose tools, resources and prompts — tools change things, so guard them
  • Start with read-only servers and test one call before trusting real work

Frequently asked questions

What is the difference between MCP and function calling?

Function calling is how one model asks to run one tool, usually built into that model. MCP is a standard that any model and any tool can follow, so the same server works with many models. Function calling is the model-side mechanism, while MCP is the shared standard around it, so the two solve different parts of the same problem.

Do I need MCP to give a model tools?

No. Many models have their own tool systems. MCP is useful when you want the same tools to work across models, or when you want a standard way to add new tools without building a custom link each time.

Is MCP the same as an API?

No. An API is a way for one program to ask another for data, usually with its own format. MCP is a standard format for that conversation between a model and a server, so many tools can share one shape of request and answer.

How much does it cost to use MCP?

The protocol itself is open and free to use. Costs come from the model calls, the servers you run, and the time to build and secure them. The main parts of the bill are model calls, the servers you run, and the time to build and secure them.

Can an MCP server change my data?

Only if it exposes a tool that changes data and the host lets it run. Read-only servers cannot change anything. For tools that write, set the host to ask the user first, and give the server the smallest permissions it needs.

Who runs the MCP server?

Either you or a service you trust. A local server runs on your own machine and keeps data close. A remote server runs on someone else's service, which is easier to share but needs a key and a clear idea of what data it can reach.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning to connect your model to your tools? Talk to Hertiv.

A senior engineer replies within one business day. Or see our MCP Server Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call