text stringlengths 0 59.1k |
|---|
- Accessing my computer's **filesystem** (reading/writing files). |
- **Browsing the web**. |
- Interacting with **databases**. |
- Connecting to specific **APIs** (like GitHub, Slack, Google Maps, etc.). |
- Running **local scripts** or applications on my machine. |
The main benefit I see is **standardization**. It makes life _much_ easier. Developers can create tools (MCP servers) knowing that any compatible agent can use them, and agent builders like me can easily add diverse capabilities without writing tons of custom integration code for each one. |
## Why Should I Care About MCP? |
Okay, standardization is cool, but what does that _really_ mean for me when I'm trying to build a useful AI agent? Here's why I find it valuable: |
1. **Easier Tool Integration:** This is the big one. I don't need to become an expert in every single API or system I want my agent to interact with. If someone's already built an MCP server for it (like reading files or searching the web), I can often just "plug it in" to my agent configuration. Less custom code, fas... |
2. **Access to Specialized Tools:** The AI community is building amazing things! Maybe someone created a powerful MCP server for complex financial data analysis, controlling smart home devices, or generating specific types of images. MCP allows me to potentially leverage that specialized work directly in my agent. |
3. **Reusability:** An MCP server built for one purpose (e.g., interacting with GitHub) isn't tied to just one specific agent or even one agent framework. If another agent or platform supports MCP, that same server can potentially be reused there. Build once, use many times. |
4. **Focus on Agent Logic:** Because MCP handles the _how_ of communication, I can spend more of my time and brainpower designing the _what_ and _why_ of my agent its goals, its personality, its core decision-making process rather than getting bogged down in the plumbing of tool connections. |
## Finding MCP Servers |
So, where do I find these useful MCP servers? The ecosystem is definitely growing. While there isn't one single, official, all-encompassing directory (yet!), here are the places I usually look: |
- **Official Examples:** The creators of MCP (Anthropic) and communities maintain lists of reference implementations and examples. These are great starting points: |
- [Model Context Protocol - Example Servers](https://modelcontextprotocol.io/examples) |
- **Community Aggregators:** Several websites have popped up specifically to collect and categorize MCP servers developed by the community. These can be gold mines: |
- [mcp.so](https://mcp.so/) |
- [MCP Explorer by Composio](https://mcp.composio.dev/) |
- **Tool/Platform Documentation:** Sometimes, the documentation for a specific service or tool (like a database, an API platform like Stripe, or even software like Blender) might mention if an official or community-built MCP server is available. |
- **Package Managers:** I can also search package managers like npm (for Node.js/TypeScript projects) for packages often named like `@modelcontextprotocol/server-*` or similar. |
## Introducing VoltAgent |
Before we dive into building, let me briefly mention [**VoltAgent**](https://github.com/VoltAgent/voltagent). It simplifies building sophisticated AI agents, handling things like state management, tool usage, and, crucially for this post, integrating external systems like MCP servers. It lets me focus more on the agent... |
### VoltAgent and MCP |
VoltAgent makes integrating MCP servers relatively straightforward. The core idea is to define the servers you want to use within an `MCPConfiguration` object and then pass the tools provided by that configuration to your `Agent`. |
VoltAgent handles the process of: |
1. **Starting the Server:** Running the command you specify for the MCP server (like `npx @modelcontextprotocol/server-filesystem ...`). |
2. **Connecting:** Establishing communication with the running server. |
3. **Fetching Tools:** Asking the server what capabilities (tools) it offers. |
4. **Making Tools Available:** Exposing these tools (like `readFile`, `writeFile`) so your agent's LLM can understand and decide to use them. |
You essentially declare _what_ server you want and _where_ it is, and VoltAgent takes care of wiring it up to your agent. |
### Let's Build an Example with VoltAgent |
Let's build something. I'll show you how I created a very basic VoltAgent project and connected it to the standard filesystem MCP server. This will allow our agent to read files from a specific directory on my computer. |
 |
<GitHubExampleLink |
repoUrl="https://github.com/VoltAgent/voltagent/tree/main/examples/with-mcp-server" |
npmCommand="npm create voltagent-app@latest -- --example with-mcp-server" |
/> |
#### Setting Up the Project |
The quickest way to get started with VoltAgent is using the `create-voltagent-app` command-line tool. Let's call our project `mcp-filesystem-agent`. I opened my terminal and ran: |
```bash |
npm create voltagent-app@latest mcp-filesystem-agent |
``` |
This command guides you through setup. I mostly chose the defaults but made sure to select **TypeScript**. (For more details, check the [VoltAgent Quick Start guide](/docs/quick-start)). |
After it finished, I navigated into the new project directory: |
```bash |
cd mcp-filesystem-agent |
``` |
This sets up a basic project structure: |
``` |
mcp-filesystem-agent/ |
βββ src/ |
β βββ index.ts # Our main agent logic goes here! |
βββ package.json # Project dependencies |
βββ tsconfig.json # TypeScript configuration |
βββ .gitignore # Files for Git to ignore |
βββ .env # For API keys (you'll need to add your key here) |
``` |
#### Implementing the Agent and MCP Configuration |
Now for the core part. I opened `src/index.ts` and set up the MCP configuration and the agent definition. |
```typescript title="src/index.ts" |
import { openai } from "@ai-sdk/openai"; |
import { VoltAgent, Agent, MCPConfiguration } from "@voltagent/core"; |
import { VercelAIProvider } from "@voltagent/vercel-ai"; |
// Node.js 'path' module helps create safe, cross-platform file paths |
import path from "node:path"; |
const mcpConfig = new MCPConfiguration({ |
servers: { |
filesystem: { |
// 'stdio' means VoltAgent will run this as a local command-line process |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.