A Complete Guide to Building AI Agents That Actually Work
Model Context Protocol
MCP stands for Model Context Protocol. Anthropic defines it as an open protocol that standardises how your LLM applications connect to and work with your tools and data sources. Think of it like a USB port for AI.
Remember the chaos that preceded the USB standard? Connecting your computer to a microphone or webcam meant hunting for special cords, buying adapters, and writing custom software for each device. USB solved this by creating a universal standard that just works.
Building AI agents faced the same problem. Do you want your scheduling agent to access your calendar, email, note-taking app, Zoom, and Calendly? You’d need to custom-write code for each tool’s specific API. It was a massive pain.
MCP changes everything by standardising how AI agents interact with external tools and data. Within months of launch, over 20,000 pre-built MCP servers became available. Anyone can now easily write, publish, and use them.
Let me show you how easy it is. Say you want your AI to access real-time stock market data.
You can grab the Alpha Vantage MCP server, copy the configuration into your AI application like Claude Desktop, and immediately start asking questions like “plot the coffee stock market prices for the past 10 years.” The AI uses the tool, retrieves the data, and creates a visualisation. Done.
Understanding MCP requires knowing three key components: Host, Client, and Server. The Host is any LLM application that wants to use MCP tools. Claude Desktop, n8n, and custom AI agents are all examples of hosts. The Server is a lightweight program that exposes specific capabilities. These range from accessing stock market data to performing time zone conversions and executing database queries. Thousands exist. The Client lives inside the host and invokes the MCP protocol to maintain the connection between host and server.
MCP servers contain three major elements: tools, resources, and prompt templates. Tools are functions that the client can invoke. Sending a Gmail message, performing calculations, and updating database records. Resources are read-only data exposed by the server. Think markdown notes, tracking logs, or database records. If you’re calling a weather API repeatedly, you might store that data as a resource rather than spamming the tool over and over. Prompt templates are structured blueprints, so users don’t need to engineer perfect prompts themselves. If you’re building an MCP server that summarises meeting transcripts, you can include an optimised prompt template. Users just input specifics, and the template handles the rest.
MCP uses a three-phase communication lifecycle. First comes initialisation, when the client and server establish a connection. Then, there is the message exchange, where the client requests tools and the server responds. Finally, termination, when they stop interacting. The transport layer handles the transmission of messages. For local servers running on your machine, it’s like cooking at home and passing notes to your friend. For remote servers, there are two approaches: HTTP with Server-Sent Events, which is stateful, similar to a sit-down restaurant where the waiter remembers your order, and Streamable HTTP, which supports both stateful and stateless interactions.
Using n8n, you can build an MCP server without writing code. Create a new workflow, add a server trigger, and attach tools like a calculator or Gmail sender. Set up your credentials, configure the model's parameters, save the settings, and retrieve the production URL. Then create an AI agent workflow in n8n, attach the MCP client tool, paste your server endpoint, select HTTP Streamable transport, and you’re done. Your agent can now use those tools. Want to switch hosts? Just update the configuration file for Claude Desktop or any other compatible application.
Coding gives you more control. You can add resources and prompt templates, which n8n currently doesn’t support. A Google Sheets MCP server built with code can include tools for listing, reading, writing, and appending sheets. It can provide resources for accessing sheet data. It can also include prompt templates for analysing data, creating reports, or managing form-to-sheet workflows. The implementation uses decorated functions to define tools and resources. Prompt templates are hardcoded directly into the server. The result is an AI that can list your spreadsheets, read specific data, analyse it using optimised prompts, and even create visual dashboards automatically.
MCP represents a fundamental shift in how we build AI applications. The ease of connecting any AI application to any tool or data source will drive massive innovation, just like USB did for hardware. Whether you’re building internal tools for your team, creating B2B solutions, or experimenting with AI agents, MCP gives you the power to quickly prototype and deploy sophisticated systems. The standardisation means you write once and use it everywhere. The possibilities really are endless. And now you know how to tap into them.


