πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

mcp-agent-proxy

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mcp-agent-proxy

MCP proxy server that allows MCP clients to communicate with agent servers (Mastra, LangGraph, etc.)

0.0.10
Source
npm
Version published
Weekly downloads
59
-10.61%
Maintainers
1
Weekly downloads
Β 
Created
Source

MCP Agent Proxy

npm version License: MIT CI

Connect any MCP client to any agent server - creating an "Internet of Agents" through simple, composable primitives.

Supports Mastra ❀️ and LangGraph πŸ¦œπŸ•ΈοΈ servers! πŸŽ‰

Quick Start

Add this to your MCP client's configuration:

{
  "mcpServers": {
    "mcpAgentProxy": {
      "command": "npx",
      "args": ["mcp-agent-proxy@latest"]
    }
  }
}

That's it! The proxy lets your MCP client connect to different agent servers and exposes agent interactions as MCP tools. It automatically detects agent server types and adapts accordingly.

https://github.com/user-attachments/assets/9eaf1d36-298f-430f-b9e8-37e921cce2d1

What This Does

Instead of building complex protocols, we provide 5 simple tools that let agents discover, connect, and orchestrate across unlimited networks:

ToolPurpose
listAgentsDiscover available agents across all servers
describeAgentGet detailed agent capabilities for intelligent routing
callAgentExecute any agent with smart conflict resolution
connectServerDynamically add new agent servers at runtime
disconnectServerRemove dynamically connected servers

Supported Server Types

  • Mastra: Support for local and remote Mastra servers
  • LangGraph: Support for local and remote LangGraph instances
  • Extensible: Plugin architecture makes it easy to add support for other agent frameworks

The Network Effect

Agent servers can be MCP clients themselves, creating recursive agent networks:

Your MCP Client β†’ MCP Proxy β†’ Agent Server (Mastra/LangGraph) β†’ Agents -> MCP Proxy -> Other Agent Servers β†’ πŸš€ Agents

One configuration line unlocks entire ecosystems of AI capabilities.

Common Configurations

Multiple Servers (Mixed Types)

{
  "mcpServers": {
    "mcpAgentProxy": {
      "command": "npx",
      "args": ["mcp-agent-proxy"],
      "env": {
        "AGENT_SERVERS": "http://localhost:4111 http://localhost:2024"
      }
    }
  }
}

Cloud + Local (Mixed Mastra and LangGraph)

{
  "mcpServers": {
    "mcpAgentProxy": {
      "command": "npx",
      "args": ["mcp-agent-proxy"],
      "env": {
        "AGENT_SERVERS": "https://my-mastra.vercel.app http://localhost:2024"
      }
    }
  }
}

From Source (Development)

{
  "mcpServers": {
    "mcpAgentProxy": {
      "command": "node",
      "args": ["/path/to/mcp-agent-proxy/dist/mcp-server.js"],
      "env": {
        "AGENT_SERVERS": "http://localhost:4111"
      }
    }
  }
}

Usage Examples

Basic Agent Call:

Can you call the weatherAgent to get the current weather in New York City?

Network Exploration

Explore the agents you're connected to

Smart Conflict Resolution:

I need to use the weatherAgent from server1 specifically, not the default one

Dynamic Network Expansion:

Connect to the ML specialists at https://ml-specialists.vercel.app and then use their modelTrainer agent

Environment Variables

VariableDefaultDescription
AGENT_SERVERS(none)Space/comma-separated server URLs (supports Mastra and LangGraph)
MCP_SERVER_PORT3001Proxy server port
MCP_TRANSPORThttpTransport method (stdio/http)

Examples & Advanced Usage

Ready-to-use configurations in the examples/ directory:

For advanced configuration options, see CONFIGURATION.md.

Troubleshooting

NPX Issues:

npx clear-npx-cache
npx mcp-agent-proxy@latest

Port Conflicts:

"env": { "MCP_SERVER_PORT": "3002" }

Connection Issues:

  • Ensure agent servers are running and accessible
  • Check firewall settings and server URLs
  • For LangGraph: Default port is usually 2024 (langgraph dev)
  • For Mastra: Default port is usually 4111

Debug Mode:

DEBUG=mastra:* npx mcp-agent-proxy

Development

# Install dependencies
pnpm install

# Start development server
pnpm dev

# Build for production
pnpm build

# Run tests
pnpm test

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

MIT License - see LICENSE file for details.

πŸ“– Configuration Guide β€’ πŸš€ Examples β€’ πŸ› Issues β€’ πŸ’¬ Discussions

Building the Internet of Agents, one connection at a time.

Keywords

mcp

FAQs

Package last updated on 27 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts