Behind the Curtain: How Terminal Coding Agents and MCP Work
This is an optional guide for the curious. You do not need to write code, and you do not need to install anything. It opens up the kind of AI agent that developers run in a terminal window, tools such as Claude Code and Codex CLI, and the plug standard called MCP that lets them reach other software. You will see what actually happens between "fix this bug" and a finished change, why these agents stop to ask permission, where their rules live, and where the real risks are. Everything you learned about agents in the earlier guides still applies. This one just shows the same loop with the cover taken off.
Difficulty: ★★☆☆☆ (No coding needed. You only read and think. A few short examples show what the files look like)
Required Tools: None. To try one yourself later, you need a terminal and a paid AI plan or an API key from one of the tools in Step 7
Updated: November 2026
Overview
Most of this track used agents that live in an app: you open a screen, describe a job, and the agent works in the cloud or on your connected accounts. Developers use a different kind of agent. It runs inside a terminal, the plain text window where programmers type commands, and it works directly on a folder of files on their own computer. It reads the files, edits them, runs the project's tests, reads what went wrong, and tries again.
It sounds like a different species. It is not. It is the loop from How an Agent Thinks: goal, plan, act, observe, check. The terminal version just has three very concrete tools, which are reading files, changing files and running commands, and that makes it an unusually clear window into how any agent works. If you understand this one, you will understand the quieter agents inside your email and calendar as well.
Underneath sits a second idea that you will keep meeting in 2026: MCP, the Model Context Protocol. It is a standard way of plugging an agent into a tool, such as a database, a calendar, a design file or a bug tracker, so that each tool does not need its own custom connector for every agent. Plain words: MCP is to agents what a USB port is to a laptop.
The guide moves in seven steps. First the tool trio and one full example of a session. Then permissions, because that is where safety lives. Then the instruction files and reusable skills that shape behaviour. Then MCP itself. Then the risks that come with plugging things in. Finally a map of the tools as of this month, and a safe way to try one.
The honest goal: after reading, "an agent that edits files and runs commands on a computer" stops sounding like magic or like a threat. You will know what it can touch, what it cannot, who decides, and what you would check before trusting one.
Who This Is Useful For
What You Will Learn
What You Need
1. Fifteen to twenty minutes. Nothing to install.
2. One recent job you wish software would do for you, so that you can imagine the agent doing it as you read.
3. Optional, for later: a spare folder with a few copies of non-important files, to practise on.
As of 16 November 2026. Tools and rules in this area change every few weeks. Names, prices and settings below are examples of the idea, not instructions, so go by each tool's official documentation before you act.
Step 1 — The Same Loop, With Three Hands
A chat AI can only talk. A terminal agent can touch a project, and it does it with three kinds of action:
Every other thing it does is built from these three. Searching, refactoring, installing something, fixing a failing test, writing documentation: reading, editing and running, repeated in a loop.
Notice how closely this matches the loop from the earlier guide. The goal is your request. The plan is a short list of steps the agent writes for itself. Acting is the three hands. Observing is reading the file contents and the command output. Checking is running the tests again and seeing whether they pass. The only new thing is that the "world" it acts on is a folder on a computer, which is a very good place for an agent: everything in it is text, and everything can be checked by running something.
That last point is the secret to why coding is the first job where agents became truly useful. A result can be tested. If the agent claims it fixed the bug, the test either passes or it does not. In most other jobs, for example a proposal or a plan, there is no such referee, so the checking falls back on you.
Pro tip: when you hear "agent" next time, ask the question these tools make easy: "what are its hands?" The list of things it can read, change and run is the whole of its power, and the whole of its risk.
Step 2 — One Session From Start to Finish
Here is an imagined session, in plain words. A developer has a small website. The sign-up form lets people submit an empty email address, and she asks the agent to stop that.
1. She types the goal in ordinary language: "The sign-up form accepts an empty email. Fix it and add a test."
2. The agent explores. It lists the project folder, finds the file that contains the form, opens it, and also opens the folder of tests to see how tests are written here. This costs nothing and changes nothing, so a good agent does it first.
3. It writes a short plan. For example: "Add a check in the form handler. Show an error message. Add one test for the empty case and one for a valid address."
4. It edits. For each file it proposes a diff. In the default setting the tool pauses and asks: "May I edit this file?" She looks at the diff and approves.
5. It runs the tests. It asks before the first command too: "May I run the test command?" She approves. One test fails.
6. It reads the failure. The error says the new message text does not match what the test expects. The agent decides the message in the code is what needs changing, edits it, and runs the tests again. This time they pass.
7. It reports. It summarises what it changed and why, and the developer can look at the full diff once more before keeping the work.
Three things deserve attention.
First, steps 2 and 6 are the agent reading what happened and changing course. That is the loop in action, and it is exactly what a chat AI cannot do.
Second, the human did not type any code. She did two jobs only: state the goal clearly, and approve or reject each action. The skill involved is judgement, not typing.
Third, in this example the agent made a small mistake at step 5, and nobody had to panic, because the tests showed it at once and every change was visible as a diff. Good setups are built so that mistakes show up early and can be undone.
Pro tip: the most reliable sessions begin with exploration and a plan. If you ever work with one of these tools, ask it for the plan first and read it before it edits anything. Correcting a plan takes ten seconds. Untangling a finished wrong change takes much longer.
Step 3 — Permissions: Why It Keeps Asking
The questions in Step 2 are not politeness. They are the central safety design. An agent that can run commands on your computer could, if it went wrong, delete files, send data out, or install something harmful. So these tools are built around permission.
Most of them offer a few levels of freedom, with different names in each product but similar ideas:
Behind the permission prompts there is often a second layer, a sandbox. A sandbox is a boundary the operating system enforces: for example, the agent may only touch this one folder and may not reach the internet, however it behaves. Permissions are the agent asking nicely. A sandbox is the walls of the room. Comparing the tools, the sandbox features differ a lot and keep changing, so this is worth checking in the current documentation of whichever tool you consider.
Three habits make an agent much safer in practice:
Pro tip: treat the "skip all permissions" setting like driving without a seatbelt in a car you do not fully know. It is not forbidden, and experienced developers use it in disposable environments such as a throwaway virtual machine. It is a bad idea on the computer that holds your real files and passwords.
Step 4 — The Rules It Reads Before Every Job
An agent starts every session knowing nothing about your project except what it can read. So these tools let you leave notes for it, and the notes are read automatically at the start.
CLAUDE.md. A shared standard called AGENTS.md, which sits next to the project's README, is read by a number of other tools. Same idea: standing instructions that you write once, so that you do not repeat them every session.What do these have in common? They all move knowledge out of your head and the agent's short-term memory and into files. Files persist, you can read them, and you can share them. This is also why the best way to improve an agent is rarely a cleverer request. It is a clearer instruction file.
Pro tip: treat an instruction file like onboarding notes for a new colleague who is smart but has never seen your work. Short and specific beats long and general: "run tests with npm test before saying you are done" is worth more than a page of values.
Step 5 — MCP: One Plug for Many Tools
So far the agent could touch files and run commands. But real work also involves tools that are not files: a ticket system, a database, a design document, a calendar. How does an agent reach those?
The old way was custom work. Each agent needed its own connector for each tool. Ten agents and ten tools meant a hundred connectors. MCP replaces that with one common plug. If a tool speaks MCP, any agent that speaks MCP can use it.
The roles are simple:
A server can offer three kinds of thing:
Behind the scenes, client and server exchange short structured messages in a format called JSON-RPC. There are two common ways of connecting them. A server on your own computer usually talks through the terminal's standard input and output, which is called stdio. A server somewhere on the internet talks over Streamable HTTP, the ordinary web protocol.
A tiny made-up example shows how plain the setup is. In most tools, adding a server comes down to a few lines like these:
name: tickets
command: run the "tickets" server program
access: can read and create tickets, cannot deleteAfter that, the agent can see the new tools and use them when your request needs them: "look at ticket 214 and tell me what the customer reported".
Where does MCP come from, and is it going to last? Anthropic created it and released it as an open standard in 2024. In December 2025 it was donated to the Agentic AI Foundation, a neutral group inside the Linux Foundation, which also took over the AGENTS.md standard mentioned in Step 4. A big revision of the specification dated 28 July 2026 made the protocol stateless, meaning that each request carries everything it needs, so servers are easier to run at scale. Those details are for developers, but they tell you the idea is now shared infrastructure rather than one company's feature.
Pro tip: when you hear "this product has an MCP server", read it as "an agent can use this product directly". It says nothing yet about whether that is a good idea. The next step covers that.
Step 6 — What Can Go Wrong When You Plug Things In
Every connection is a door. MCP makes doors easy to add, so you need a sense of which ones are safe. The main risks are all variations on a theme: the agent trusts text it reads.
Nobody has solved these completely, and the sources that describe them in detail are mostly vendor and researcher blogs, so keep a sensible scepticism about dramatic statistics. The defences, however, are consistent and not mysterious:
1. Connect few things, and ones you trust. Prefer servers from the product's own maker.
2. Give each connection the least access it needs, and read-only where possible.
3. Read the tool descriptions and permissions before you approve a new server, and be suspicious when something asks for far more than its name suggests.
4. Keep a human on anything that sends, spends or deletes. This is the same golden rule as in the Grok Bot guides, and it is the most effective defence because it does not depend on spotting the attack.
5. Do not mix highly sensitive data with untrusted content in one session. An agent that holds your confidential files should not also be reading random websites.
Pro tip: ask the question "what is the worst thing this connection could do if the AI were tricked?" If the answer is frightening, reduce the access until it is merely annoying.
Step 7 — The Tools Today, and How to Try One Safely
A snapshot of the main terminal agents as of mid-November 2026. Treat it as a map that will be out of date soon:
They differ in price, speed, sandbox features and which AI models they use, and those facts shift every month. The loop, the three hands, the permission levels and the instruction files are the same everywhere, and that is what this guide taught.
If you decide to try one, a gentle way is:
1. Pick a harmless project. A new empty folder, or a copy of something unimportant. Never your only copy of anything.
2. Keep the strictest permission level for the first sessions, so that you see every question.
3. Start with a small, checkable goal, such as "make a one-page web page with my name and three links, then open it". You can see the result with your own eyes.
4. Ask for the plan first, read it, then let it go ahead.
5. Read every diff and every command before approving. Notice how often you would have said yes without looking.
6. Do not connect any MCP server yet. Get comfortable with the basics first.
Where to learn more. For a structured, step-by-step path in Chinese, with exercises and a long list of curated resources, the open-source learning map awesome-agentic-ai-zh by WenyuChiou is an excellent next stop. It covers command-line agents, MCP, skills, hooks and sub-agents, and then moves toward building agents yourself. It is released under the MIT licence, and it is also available as a website in Traditional Chinese, Simplified Chinese and English. Credit for the map and its structure belongs to its author. This guide is an independent introduction and does not copy its text.
A trilingual learning map for agentic AI: from LLM basics to command-line agents, MCP and multi-agent systems, with exercises and curated resources. MIT licence.
Common Mistakes to Avoid
Going Further
Read one instruction file. If you work with a developer, ask to see the instruction file in one of their projects. It is a short, plain-language document and it shows you how a person is actually "managing" an agent.
Watch what the agent reads, not just what it does. The most useful instinct to build is noticing where the agent's text comes from: your request, your files, or someone else's web page. Only the first two are fully yours.
Learn to build one. Once the loop feels natural, a small agent is a surprisingly short program: a loop, a list of tools, and a limit on the number of rounds. The learning map in Step 7 has a path for that. You do not need to become a developer to appreciate how little is behind the curtain.
Come back in three months. The names and menus will have changed. If the ideas in this guide still describe what you see, you have learned the durable part.
Key Takeaways
When you next read a headline about an agent that "did something on its own", you now have the questions to ask: what were its hands, what was it allowed, what did it read, and who was watching? Those four questions work for every agent, in every year.