Short version: pick one narrow job, connect Claude Code to only the tools that job needs, write down what “done” means, and require approval before any risky action. Then test the messy cases with real data. The loop is easy. The boundaries are the product.
What an AI agent actually is
At the simplest level, an AI agent is a model, a set of tools, and a loop.
The model reads a goal. It decides what to do. It calls a tool. It reads the result. Then it does it again, and again, until the job is finished. That loop is the whole trick. Take the loop away and you have a chatbot. Add the loop and real tools, and you have something that can book a call, update a CRM, or clean a spreadsheet without you touching it.
The tools are what matter most. A model with no tools can only talk. A model that can read a database, send a Slack message, or edit a file can act. So most of the work in building a good agent is not prompting. It is picking the right tools and wiring them in cleanly.
Where Claude Code fits
Claude Code is Anthropic's coding agent for the terminal. It can read and write files, run commands, and call connected tools while it works through a task. For an internal agent, that means you can focus on the job, permissions, and review points instead of rebuilding the basic tool-calling loop.
What MCP is and why it matters
MCP stands for Model Context Protocol. Anthropic released it as an open standard in November 2024 (see Anthropic's MCP announcement). The idea is simple. Instead of writing custom code to connect your agent to every single app, you connect it once to an MCP server, and that server hands the agent a clean set of tools.
Think of it like a USB-C port for AI applications. Before MCP, every connection was a one-off. MCP gives hosts and servers a shared protocol for discovering tools, resources, and prompts. The official architecture lives at modelcontextprotocol.io. I use it when that shared interface makes the integration easier to reuse and control.
I have wired agents into GoHighLevel, n8n, Notion, and Slack this way. The GHL agent pulls contacts, checks pipelines, and sends messages. The Notion one reads and writes tasks. Same pattern every time: the MCP server exposes the tools, and Claude Code decides when to call them.
A concrete step-by-step build
Here is the exact order I follow. Do it in this order and you will not paint yourself into a corner.
- Pick the job. One job, narrow and clear. Not "handle my whole business." Something like "when a new lead comes in, enrich it and add it to the CRM." A narrow job is testable. A vague job never ships.
- Wire tools via MCP servers. List every action the job needs. Reading a sheet? Sending a message? Match each action to a tool. If an MCP server already exists for that app, use it. If not, a bash or file tool often covers it.
- Give it a system prompt or skill. Tell the agent who it is, what the job is, and what "done" looks like. Be specific. Claude Code reads a project file for this, so the instructions live with the work.
- Add a loop and guardrails. Claude Code runs the loop. Your job is the guardrails: which tools it can use, what it must ask before doing, and a hard stop so it cannot run forever.
- Test on real tasks. Not made-up examples. Real leads, real files, real messages. Watch where it goes wrong, then fix the prompt or the tools. Repeat until it is boring and reliable.
A current setup example
Claude Code can add a remote MCP server from the command line. Notion provides a hosted endpoint, so the setup is one command:
claude mcp add --transport http notion https://mcp.notion.com/mcp Claude Code handles the connection and authentication flow. After that, inspect the available tools, keep the server scoped to the project or user that needs it, and review permissions before letting an agent write anything.
Common mistakes
I have made all of these, so learn from them.
- Too many tools at once. A model handed forty tools gets confused about which to reach for. Give it the few it needs for the job. Add more only when a real task proves you need them.
- No guardrails on actions that cannot be undone. Sending an email or deleting a record should ask first, or be behind a check. Reads are safe. Writes need a gate.
- Vague instructions. "Be helpful" produces nothing useful. "Add the lead to the New Leads pipeline stage, then tag it hot if the deal size is over 10k" produces a working agent.
- Skipping the real-task test. An agent that works on your clean example will still break on the messy real thing. Test on the mess.
- Building an agent when a script would do. If the steps never change, write a script. Agents earn their cost when the task is open-ended and hard to spell out in advance.
When to build vs buy
Build when the job is specific to you, touches your own systems, and would cost more to buy than to run. Most of my client agents fall here. There is no off-the-shelf tool that knows their exact GHL pipeline and their exact rules, so a custom agent on Claude Code plus a couple of MCP servers wins.
Buy when the problem is common and someone already solved it well. If a proven tool does the job for a fair price, use it. Do not build a worse version of a product that already exists just to say you built it.
The honest test is simple: could a normal script do this? If yes, write the script. It will be cheaper and easier to predict. If the task is open-ended, multi-step, and difficult to express as fixed rules, then an agent may earn its keep.
FAQ
What is an AI agent?
An AI agent is a large language model wrapped in a loop, with tools it can call. The model reads a goal, decides on an action, calls a tool, reads the result, and repeats until the job is done. The tools are what turn a chatbot into an agent that can act on real systems.
What is MCP and why does it matter?
MCP (Model Context Protocol) is an open standard from Anthropic for connecting AI models to tools and data. Instead of writing custom glue for every app, you point your agent at an MCP server and it gets a clean set of tools. One protocol works across Notion, Slack, databases, and more.
Do I need to know how to code to build an AI agent?
You need some comfort with the command line and JSON config, but you do not need to be a senior engineer. Claude Code writes most of the code for you. The hard part is picking the right job, wiring the right tools, and testing on real tasks.
How is Claude Code different from a chatbot?
A chatbot answers in text. Claude Code runs a loop with real tools: it reads and writes files, runs commands, and calls MCP servers. It can finish a multi-step task on your machine instead of just describing how to do it.
If you have one repeated job in mind, tell me what it is. I will tell you whether it needs an agent, a normal workflow, or something simpler. You can also read the plain MCP guide or how I ship web apps with AI.