Without MCP, the AI can only chat. With MCP, it acts: reads emails, queries a database, searches a web page, sends a Slack message. The trick is that you don’t connect one action at a time—you connect a server (an entire service, such as email) and it already announces all its tools at once. The agent sees the menu and chooses the right dish for the request.
Illustrative diagram — one connection (the server) provides a set of tools. The agent reads what’s available and decides which tool to use for each request.
🧩 What the protocol solves
What it is
MCP (Model Context Protocol) is a common language for AI to communicate with external services. Instead of wiring up one action at a time, a single connection exposes many tools from that service. Think of an email service: when you connect the email server, the agent gets access to "send," "draft," and "search messages"—all at once.
What is it?MCP server — a small program that bridges the AI and a service (email, database, web), translating what each side understands. Tool — a concrete action the server provides (e.g., “send email”), with a well-defined name and parameters.
The protocol solves the problem of “how AI discovers and uses an action”: it standardizes tool descriptions. That’s how the agent can decide on its own which tool to call, when call and with which parameters. This is how AI gets "arms"—it goes from just chatting to actually acting in the world.
Why learn
Understanding MCP means understanding where your agent’s capabilities come from. Without that, it seems like "magic"—and magic is hard to debug. Knowing that each capability is a server with tools tells you what to install, what’s missing, and what to turn off.
- •One connection, many actions: less configuration, more capability.
- •Single standard: the same protocol works for email, databases, the web, etc.
- •Foundation for the rest: the next topics only make sense once this is solid.
Key concepts
Common language between AI and service.
One connection, several tools.
From conversation to action.
Bridge to a service.
🤖 How the agent discovers and decides
What it is
As soon as the agent and MCP server connect, the agent begins to know all available tools from that server — names, descriptions, and parameters. From there, the decision is up to it: you describe the result in natural language ("send the team a notification"), and the agent chooses the right tool ("send message") and fills in the parameters.
What is it?Tool discovery — the moment when the agent reads the server’s “menu” and learns what it can do. Tool selection — the agent reasons about the request and decides which tool fits the goal.
Illustrative diagram — you don’t say “use tool X.” You describe the result; the agent compares the request with its known tools and chooses the best one.
Why learn
Knowing the agent makes the decision changes how you ask: you focus on the result, not in pointing out the tool. And when it chooses incorrectly, you correct it with context ("don't draft it, actually send it") instead of micromanaging. This also explains why a server that's "on but useless" still gets in the way: your tools are added to the list the agent has to evaluate.
🎯 Practical tip
If the agent picks the wrong tool, don’t dictate its name—clarify the outcome: “I want it to reach the customer’s inbox now, not be saved as a draft.” Outcome descriptions guide the choice better than commands.
Key concepts
Reads the menu when connecting.
The agent chooses the tool.
Describe the "what".
It fills it in automatically.
🔑 .mcp.json and the key at hand
What it is
Installing an MCP server creates (or edits) a file .mcp.json: it stores the server configuration and, when the service requires authentication, a space reserved for the API key. You paste the key itself manually in the file. Never in chat, and never ask the agent to enter it for you.
What is it?API key (API key) — a password that proves you’re allowed to use a service. .mcp.json — the configuration file that lists the servers and how to start them. Placeholder — the “hole” where the key should go, marked for you to fill in.
🎯 Goal: manually paste the API key into .mcp.json
{
"mcpServers": {
"firecrawl": {
"command": "npx",
"args": ["-y", "firecrawl-mcp"],
"env": {
"API_KEY": "<cole-sua-chave-aqui>"
}
}
}
}
✅ How to verify: switch <cole-sua-chave-aqui> with your actual key, save the file and restart the assistant. The key stays only in the local file—outside the chat history.
Why learn
A key pasted into chat becomes part of the conversation history—which may be logged, shared, or leaked. Pasting it into the file keeps the secret where only you (and the program) can access it. This is a security rule, not a style preference: treat every key like a password.
✓ Key in .mcp.json (by hand)
- ✓You paste the key directly into the configuration file.
- ✓The secret stays local, outside the conversation history.
- ✓You control who can see the file (and exclude it from version control).
✗ Key in chat
- ✗Paste the key into a message for the agent.
- ✗Ask the AI to “insert the key” for you.
- ✗Leave the key in logs, screenshots, or shared conversations.
Key concepts
Where the config lives.
Hole for the key.
You paste it, not the AI.
Key = password.
🏷️ Per project vs. global
What it is
MCP configuration can live in two scopes: global (applies to the whole machine; all projects can see it) or by project (.mcp.json stays inside the project folder and only applies there). The recommendation is to by project: it isolates the secrets and context for each job.
What is it?Global scope — configuration that applies everywhere on the machine. Per-project scope — configuration stored in the project folder that applies only while you work on it. Isolation — keep a project’s secrets and tools separate from those of other projects.
Illustrative diagram — globally, one leak contaminates everything; per project, each job stays in its own bubble.
Why learn
Global configuration can trigger a security warning on every restart (the program warns that global servers are active for every project). The fix is to move the config into the project folder. Project by project, you also prevent one client from “seeing” another client’s tools and keys—less risk, less noise.
🎯 Practical tip
Tired of the security warning every time you restart? Move the servers block from the global config to the .mcp.json inside the project folder. The warning disappears, and each project carries only what it needs.
Key concepts
Applies across the whole machine.
Recommended; isolates.
Global can alert you.
The warning fix.
🔎 Where to find servers
What it is
MCP servers are found in two main places: MCP directories (sites that catalog servers, like mcp.so) and in the GitHub (search for "MCP server" + the name of the service you want). Before installing, look for the target service's server; then follow its README.
What is it?MCP directory — an online catalog of ready-to-use servers, organized by category. GitHub — where the servers’ code lives; the README usually includes the installation command and which variables (such as the key) to set.
Why learn
Knowing where to look saves you from reinventing the wheel: in most cases, the server you need already exists. Knowing the common categories also speeds up the search—you know there's something for web scraping, databases, documents, and communication, so you go straight to it.
Common server categories
E.g.: Firecrawl — read web pages.
E.g.: Postgres, Supabase.
E.g.: Google Drive, Notion.
E.g.: Slack, Gmail.
🎯 Practical tip
Quick search: on GitHub, search for MCP server + the service name (e.g., MCP server notion). Prefer repositories with more stars and a clear README — they tend to be better maintained and safer.
Key concepts
Catalogs such as mcp.so.
"MCP server" + service.
Web, database, docs, chat.
Don't reinvent the wheel.
🩺 Check and diagnose
What it is
The command /mcp lists the installed servers and the status for each one (connected, with an error, etc.). That’s your "MCP health." And there’s a golden rule for diagnosis: if a newly installed server doesn’t appear in the list, restart the assistant first — that solves it most of the time.
What is it?/mcp — command that shows the servers and their status. Restart — close and reopen the assistant so it rereads the configuration; many servers only “appear” after that.
🎯 Goal: check the connected MCP servers
/mcp
✅ How to verify: the list shows each server and its status; if a new server doesn’t appear, restart the assistant and run /mcp again.
The complete sequence, step by step
Install the server
Find it in the directory/GitHub and follow the README. This generates or edits the .mcp.json.
Check the config
See the server block in the .mcp.json (preferably by project).
Paste the key manually
Replace the placeholder with the API key—in the file, never in chat.
Restart the assistant
Close and reopen to reread the configuration and load the server.
Verify with /mcp
Run /mcp; the server should appear connected. If it doesn’t, go back to step 4.
Why learn
Without the /mcp, you’re left in the dark: you don’t know whether the server connected, failed, or wasn’t even read. And without the habit of restarting, you waste time “fixing” what isn’t broken. Restarting is the first step for any MCP troubleshooting—cheap, fast, and almost always enough.
Key concepts
List servers + status.
Connected? Error?
Works in most cases.
Restart, run /mcp.
💸 Context cost
What it is
Each server active injects your tool definitions into the context from AI — and that consumes tokens. More connected servers mean more text the model has to read before responding, even if you don’t use any of them. The rule: turn off the servers you're not using to free up context.
What is it?Context — everything the AI “has in its head” during the conversation (your message + instructions + tool definitions). Token — a small piece of text the model counts; more text = more tokens = more cost and more noise.
Illustrative diagram — each server connects a block of definitions. Fewer blocks mean more room for the AI to think, lower costs, and less noise.
Why learn
Cluttered context has three costs: it uses more tokens (more expensive), confuses the agent (more tools to evaluate means a greater chance of choosing the wrong one), and slows everything down. Keeping only the servers needed for the current task active is the simplest way to reduce cost and errors at once.
✓ Turn off unused servers
- ✓Keep only the servers for your current work active.
- ✓Frees up context: fewer tokens, lower cost.
- ✓Fewer tools to evaluate = more reliable choices.
✗ Leave everything on all the time
- ✗Accumulating servers you don’t even use in that project.
- ✗Paying for tokens for idle tool definitions.
- ✗More noise = more chances the agent will choose the wrong tool.
🎯 Practical tip
Do a periodic “cleanup”: run /mcp, check the list and turn them off (or remove them from the .mcp.json) everything that isn’t part of the current project. Less noise = fewer errors + lower cost.
Key concepts
Each defined tool adds weight.
More tools, more errors.
What’s not in use, off.
More room to think.
You installed a server and an API key. Where does the key go—and what should you do if the server doesn’t appear in the /mcp?
📌 Module Summary
Next Module:
2.4 — Context & Tokens