A Model Context Protocol (MCP) hub that seamlessly connects AI clients with intelligent agents, enabling powerful cross-platform communication across multiple AI ecosystems.
MCP Agent Server creates a bridge between MCP-compatible clients (like Claude Desktop, VS Code, Cursor, etc.) and specialized AI agents. It enables you to:
- Create and configure multiple specialized agents with different capabilities
- Connect these agents to your MCP clients
- Compose agents into master agents for complex workflows
- Build AI applications with advanced capabilities through tools and MCP servers
This project leverages the mcp-ai-agent framework to simplify agent creation and management.
- Multiple Agent Support: Create and manage different specialized agents
- Agent Composition: Combine specialized agents into master agents
- Custom Tool Integration: Create your own tools or use existing MCP servers
- Preconfigured Servers: Easy access to popular MCP servers like Sequential Thinking, Brave Search, and Memory
- AI SDK Integration: Support for multiple LLM providers including OpenAI, Anthropic, Google, Mistral, Groq and others through Vercel AI SDK
- Node.js (v16+) installed
- An API key for your chosen AI model provider (OpenAI, Anthropic, Google, etc.)
- Any API keys required by specific MCP servers you want to use
-
Clone the repository:
git clone <repository-url> cd mcp-agent-server
-
Install dependencies:
npm install
-
Build the project:
npm run build
-
Get the full path to the generated
dist/index.js
file:pwd # Example output: /Users/username/Projects/mcp-agent-server # Full path would be: /Users/username/Projects/mcp-agent-server/dist/index.js
You can create a personalized agents configuration file that overrides the default agents-config.ts
by creating a file named my-agents-config.ts
in the project root. The server automatically detects and uses this file if it exists. The file needs to export an array of agent configurations.
To create your custom configuration:
- Create a new file called
my-agents-config.ts
in the project root - Import the necessary dependencies:
import { AIAgent, Servers } from "mcp-ai-agent"; import { anthropic } from "@ai-sdk/anthropic"; // Import other AI SDKs as needed
- Define your agents with their tools, models, and configurations
- Export an
agents
array containing all your agent configurations
Here's an example of a custom agents configuration with specialized tools and Claude models:
// my-agents-config.ts
import { AIAgent, Servers } from "mcp-ai-agent";
import { anthropic } from "@ai-sdk/anthropic";
// Choose the Claude model you want to use
const model = anthropic("claude-3-5-haiku-20241022");
// const model = anthropic("claude-3-7-sonnet-20250219"); // Uncomment for a more powerful model
// Code Context Agent
const codeContextAgent = new AIAgent({
name: "Code Context Agent",
description: "Use this agent to analyze and understand code in your projects",
toolsConfigs: [
Servers.sequentialThinking,
{
mcpServers: {
codeContext: {
command: "node",
args: ["/path/to/code-context-mcp/dist/index.js"],
},
},
},
],
model,
});
// Web Search Agent
const webSearchAgent = new AIAgent({
name: "Web Search Agent",
description: "Use this agent to search the web",
systemPrompt: "Prefer to use brave search to search the web for information.",
toolsConfigs: [Servers.sequentialThinking, Servers.braveSearch],
model,
});
// Master Agent that can manage other agents
const masterAgent = new AIAgent({
name: "Master Agent",
description: "An agent that can manage other specialized agents",
model,
toolsConfigs: [
{ type: "agent", agent: codeContextAgent },
{ type: "agent", agent: webSearchAgent },
// Add more agents as needed
],
});
// Export the agents array
export const agents: AIAgent[] = [
codeContextAgent,
webSearchAgent,
masterAgent,
];
You can include as many specialized agents as needed, such as:
- Code analysis agents
- Development environment agents
- Knowledge base agents (Obsidian, etc.)
- Project management agents (Jira, etc.)
- Google Drive/Workspace agents
- Web search agents
- Design tool agents (Figma, etc.)
Important: After creating or updating your custom configuration, remember to:
- Run
npm run build
to rebuild the project- Restart your MCP client to apply changes
You can use agents-config.ts
as a reference for creating your custom configuration. The default configuration includes:
- Sequential Thinking Agent: For complex problem solving
- Brave Search Agent: For web searching
- Memory Agent: For storing and retrieving information
- Master Agent: Combines multiple agents
- Calculator Agent: Provides basic calculation tools
Important: After making changes to your agent configurations, remember to:
- Run
npm run build
to rebuild the project- Restart your Claude client to apply changes
- On Windows, you may need to completely close Claude using Task Manager (Ctrl+Alt+Del) as it can continue running in the background
// Creating a specialized agent
const sequentialThinkingAgent = new AIAgent({
name: "Sequential Thinker",
description:
"Use this agent to think sequentially and resolve complex problems",
toolsConfigs: [
{
mcpServers: {
sequentialThinking: {
command: "npx",
args: ["-y", "@modelcontextprotocol/server-sequential-thinking"],
},
},
},
],
model: openai("gpt-4o-mini"),
});
// Creating a Claude-powered agent
import { anthropic } from "@ai-sdk/anthropic";
const claudeAgent = new AIAgent({
name: "Claude Assistant",
description: "A powerful AI assistant using Claude's capabilities",
toolsConfigs: [
{
mcpServers: {
memory: {
command: "npx",
args: ["-y", "@modelcontextprotocol/server-memory"],
},
},
},
],
// Using Claude's latest Sonnet model
model: anthropic("claude-3-7-sonnet-20250219"),
});
// Creating a master agent that uses multiple specialized agents
const masterAgent = new AIAgent({
name: "Master Agent",
description: "An agent that can manage other agents",
model: openai("gpt-4o-mini"),
toolsConfigs: [
{
type: "agent",
agent: sequentialThinkingAgent,
},
{
type: "agent",
agent: memoryAgent,
},
{
type: "agent",
agent: braveSearchAgent,
},
],
});
Note: The mcp-ai-agent framework supports various AI models through the AI SDK. You can use models from providers such as OpenAI, Anthropic, Google Generative AI, Mistral, Groq, and many others. Check the AI SDK Providers documentation for the complete list of supported models and their capabilities.
Add the MCP Agent Server to your MCP client configuration:
Edit your claude_desktop_config.json
:
{
"mcpServers": {
"mcp-agent-server": {
"command": "node",
"args": ["/full/path/to/mcp-agent-server/dist/index.js"]
}
}
}
Important: After making changes to
claude_desktop_config.json
, remember to:
- Restart your Claude client to apply changes
- On Windows, you may need to completely close Claude using Task Manager (Ctrl+Alt+Del) as it can continue running in the background
Follow the specific client's instructions for adding MCP servers, using:
- Command:
node
- Args:
["/full/path/to/mcp-agent-server/dist/index.js"]
Once configured, your agents will appear as tools in your MCP client. For example, in Claude Desktop, you can use them by:
- Typing
/
to view available tools - Selecting one of your configured agents
- Following the prompts to provide context and a specific task
You can create custom tools directly in your agent configuration:
const calculatorAgent = new AIAgent({
name: "Calculator Agent",
description: "A calculator agent",
toolsConfigs: [
{
type: "tool",
name: "multiply",
description: "A tool for multiplying two numbers",
parameters: z.object({
number1: z.number(),
number2: z.number(),
}),
execute: async (args) => {
return args.number1 * args.number2;
},
},
// Add more tools...
],
});
The mcp-ai-agent framework supports various MCP servers:
- Sequential Thinking: For breaking down complex problems
- Memory: For persistent storage of information
- Brave Search: For web searches
- And many more...
- If agents fail to initialize, check that the MCP servers are correctly configured
- For "npx" commands, ensure the full path is specified if needed
- Verify all required API keys are available in your environment
- Check that the MCP client is correctly configured to use the MCP Agent Server
- Make changes to the TypeScript files
- Rebuild with
npm run build
- Restart your MCP client to load the changes
MCP Agent Server comes with a command-line interface (CLI) for working with agents.
You can test individual agents directly from the command line without connecting to an MCP client, this is helpful for debuging purposes.
npm run test-agent -- --name="Agent Name" --prompt="Your test prompt" --context="Optional context"
For example, to test the Brave Search Agent:
npm run test-agent -- --name="Brave Search" --prompt="What is the capital of France?" --context="I need geographical information"
You can also run the command directly:
node dist/index.js test-agent --name="Sequential Thinker" --prompt="How would I approach solving a complex math problem?"
Or test the Master Agent which combines multiple specialized agents:
node dist/index.js test-agent --name="Master Agent" --prompt="Store this information: Claude is an AI assistant by Anthropic" --context="I need to test the memory capabilities"
The test command will:
- Find the specified agent by name
- Initialize the agent
- Send your prompt and context
- Display the agent's response
This is useful for:
- Testing new agent configurations
- Debugging agent issues
- Verifying agent functionality before connecting to an MCP client
The test command will list all available agents if you provide an invalid agent name.
This project is licensed under the MIT License.