MCP: A Universal Key for AI Agents
Introduction
mCP has been taking the AI world by storm and in this blog post, I’m going to break down what mCP is in as simple terms as possible, whether you’re a beginner or have a technical background.
We’ll cover:
- What mCP is and its potential impact.
- Demos of how it works.
- A step-by-step tutorial on connecting mCP servers to AI agents.
What is MCP?
mCP isn’t new. It was released in November 2024 by Anthropic. They described it as a way for AI assistants to connect to different systems where the data lives, including different content repositories, APIs and tools. mCP is like giving your AI a universal key which will grant it access to different components, tools, data resources, APIs, and everything else that previously required a manual connection. This is a game-changer for AI agents but don’t worry if that is still confusing I will give you some examples.
MCP vs. Current AI Agent Integrations
mCP standardizes how agents access and interact with external data resources. This allows AI agents the ability to scale. To illustrate this I will break down the differences in how they are built with traditional methods.
Demo: Firecrawl & Brave Search MCP Servers
Let’s explore two example mCP servers: Firecrawl and Brave Search. I’ll show you how they work and why they differ from previous AI agent setups. I’ll also walk you through connecting these mCP servers to your AI agents.
Firecrawl mCP Server
Firecrawl is a popular tool that scrapes website data and turns it into data ready for large language models. The Firecrawl mCP server provides access to all Firecrawl resources and tools without individual connections.
For example, asking the AI agent “What tools do you have?” will prompt it to use the firecrawl list tools functionality and present a list of available tools within the Firecrawl mCP server.
Previously connecting to these tools would require individual HTTP requests for each tool. With mCP, the AI agent can now execute the correct tool based on a query without specific prompting.
Example: Asking the agent to “scrape aiworkshop.me” results in the agent using the Firecrawl scrape tool to gather information from the website.
Comparison: Calendar Agent (Traditional Method)
A traditional calendar agent requires separate tools for updating, deleting, getting, and creating events. The AI agent needs a system prompt to instruct it which tool to use for which purpose.
mCP streamlines this by replacing manually added actions with a list of tools. Instead of having 8 different tools the agent has access to execute they are all in one list.
Benefits of mCP
- Eliminates the need for separate AI agents and parameters.
- Standardizes communication and access to different tools.
- Simplifies scaling AI agents.
Brave Search mCP Server
The Brave Search mCP server works similarly. Asking “What tools do you have access to?” lists the available tools (e.g., Brave Web Search, Brave Local Search).
Asking “What is the latest news related to OpenAI?” prompts the agent to use an execute tool and retrieves the latest news.
Walkthrough: Connecting mCP Servers
Important: Currently, mCP is only available on locally hosted instances because the mCP tool is currently a Community Node.
Here’s how to connect mCP servers to your AI Agents:
- Local Hosted Version: Make sure you are using a local hosted version and have access to your local host.
- Install Community Node: Go to your settings, click on the settings.
- Search for mCP: Search for “NN nodes mCP” and install it.
- Create New Workflow: Create a trigger node with an AI agent.
- Add Chat Model: Add your chat model and select your Open AI.
- Select Tool: Go to tools and search for MCP client tool (if installed).
- Click on create new credential Select the command line due to server scent event being more complicated.
- Connect Credentials: Grab credential requirements from mCP server you want to connect to. FireCrawl for our example.
- Command: npx
- Argument: dasy firecrawl-mcp
- Environment: FireCrawl API = ‘Your API Key’ You can get your free API key from Firecrawl API.
- Brave Search: Follow the same process for Brave Search to get your free API key. The command and argument are the same just change FireCrawl to Brave Search and the Environment variables name to the new mCP.
- List Tool
- Execute Tool
- AI Function
Troubleshooting
If the mCP client tool doesn’t appear, you need to enable tool usage. Copy the command from the documentation and paste it into your terminal and restart naden.
Testing
You can test your setup by asking “What tools do you have?” and then asking to scrape a website.
Conclusion
mCP offers significant potential for changing how AI agents interact with different data sources and APIs. It simplifies scaling AI agents and eliminates the need for manual connections. The functionality is being shipped off to the mCP server and it will reach out to the proper tool itself and grab that information without being connected manually. As the space evolves, mCP servers will become more powerful, leading to more robust AI agents.
Watch this video on Youtube