Module 8

MCP (Model Context Protocol)


It is the standard for what you already do with function calling: the reusable way to expose tools and data to any assistant or agent.

Reading time: 3 min

Tools, resources and prompts

MCP (Model Context Protocol) is an open protocol for connecting AI applications to external systems. It defines three primitives a server can offer: tools, actions the model can execute (such as looking up an order); resources, data the application can read and add to the context (such as a document or a record); and prompts, reusable templates the user can invoke.

The difference is who is in control: tools are chosen by the model, resources by the application and prompts by the user. In practice, most servers start with tools only, which is what most closely resembles function calling.

Servers and clients

In MCP, the server is the program that exposes a system's capabilities (your customer support application, a database, an external service), and the client is what connects to it on behalf of an AI application, such as a desktop assistant, an IDE or your own agent. A single application can connect to many servers at once.

Servers can run locally (the client starts them as a process and talks to them over standard input and output) or remotely over HTTP, with authentication. A remote server is, for practical purposes, an API: it needs authentication, rate limits and the same least-privilege approach as any other.

MCP vs function calling

Function calling is the mechanism by which a model asks for tools within a specific application, and those tools are defined in that application's code. MCP standardises how those tools are exposed so that any compatible client can discover and use them without specific code.

They are not alternatives: under the hood, an MCP client ends up turning the server's tools into function calling for the model. The difference is reuse. If only your application uses the tools, direct function calling is simpler. If you want your system to be reachable from several assistants and agents, MCP saves you building an integration for each one.

Connectors

A connector is a ready-made MCP server for a specific service (an email client, a calendar, a code repository, a ticketing tool) that can be added to an assistant with little or no configuration.

They are the fastest way to give an assistant real context, but every connector widens what the model can see and do. Before enabling one, check which permissions it asks for, which data it exposes and who maintains it: a connector with write permissions is an entry point for indirect prompt injection.

Test yourself on this module

Copy this prompt and paste it into your AI (ChatGPT, Claude, Gemini…). It will give you a 20-question multiple-choice test on the module's concepts and then suggest a hands-on exercise.

Act as the examiner for Dani Pérez's "AI Engineering Guide". Examine me on the module "MCP (Model Context Protocol)" (https://daniperez.pro/en/resources/ai-engineering-guide/mcp).

Concepts covered by the exam:
- Tools, resources and prompts
- Servers and clients
- MCP vs function calling
- Connectors

Exam:
1. 20 multiple-choice questions, each with 4 options (a, b, c, d) and a single correct answer.
2. Ask about understanding and judgement (what each thing is for and when NOT to use it), not about memorising definitions.
3. Spread the position of the correct answer evenly across a, b, c and d.
4. Ask me the questions in 4 rounds of 5. Don't give any example answer (like "1a 2b 3c 4d 5a"): I already know to answer with the letters. Don't tell me whether I got them right until I have answered all 20.
5. At the end, mark them all: for each question, my answer, the correct one and a short explanation. Give me my score out of 20 and tell me which concepts I should review.

Hands-on exercise (after marking):
6. Ask me what application I have or want to build, and which language and framework I work with. If I don't have one, use this: a customer support application for an online shop, with tickets, customers, orders and a knowledge base (FAQ and return policies). In that case, focus the exercise on: exposing the customer support application as an MCP server so that any assistant or agent can look up tickets and orders.
7. Suggest an exercise that applies this module's concepts to that application: goal, requirements, criteria to consider it done and common mistakes to avoid.
8. Don't solve it for me. When I bring you my solution, review it against those criteria.