mcpd-proxy

mcpd-proxy

An MCP server that acts as a proxy between IDEs and the mcpd daemon, exposing all mcpd-managed MCP servers through a unified interface.

Category
访问服务器

README

mcpd-proxy

An MCP (Model Context Protocol) server that acts as a proxy between IDEs and the mcpd daemon, exposing all mcpd-managed MCP servers through a unified interface.

Overview

┌─────────────┐   STDIO/JSON-RPC    ┌──────────────┐    HTTP/REST     ┌──────────┐
│  IDE/Editor │ ◄─────────────────► │  mcpd-proxy  │ ◄───────────────►│   mcpd   │
│ (VS Code,   │     MCP Protocol    │  MCP Server  │   Uses mcpd SDK  │  daemon  │
│  Cursor)    │                     │              │                  │          │
└─────────────┘                     └──────────────┘                  └──────────┘

mcpd-proxy aggregates tools, resources, and prompts from multiple MCP servers managed by mcpd into a single MCP interface, making it easy for IDEs to access all capabilities without managing individual server connections.

Features

  • Unified Interface: Single MCP server exposing all mcpd-managed capabilities
  • Tool Aggregation: Tools from all servers with server__tool naming convention
  • Resource Aggregation: Resources from all servers with server__resource naming and mcpd:// URIs
  • Prompt Aggregation: Prompts from all servers with server__prompt naming convention
  • Efficient Caching: Leverages SDK caching for health checks and tool schemas
  • Zero Configuration: Works out of the box with sensible defaults
  • TypeScript: Built with TypeScript for type safety

Prerequisites

  • Node.js 22.10.0 or higher (latest 22.x recommended)
  • mcpd daemon running and accessible
  • mcpd SDK (automatically installed as a dependency)

Installation

From npm (Recommended)

# Global installation
npm install -g @mozilla-ai/mcpd-proxy

# Or use directly with npx
npx @mozilla-ai/mcpd-proxy

From Source

# Clone the repository
git clone https://github.com/mozilla-ai/mcpd-proxy.git
cd mcpd-proxy

# Install dependencies
npm install

# Build the project
npm run build

Configuration

mcpd-proxy is configured via environment variables:

Variable Description Default
MCPD_ADDR mcpd daemon address http://localhost:8090
MCPD_API_KEY Optional API key for mcpd authentication (not set)

Usage

Running Directly

# Using npm package (recommended)
npx @mozilla-ai/mcpd-proxy

# With custom mcpd address
MCPD_ADDR=http://localhost:8090 npx @mozilla-ai/mcpd-proxy

# With API key
MCPD_ADDR=http://localhost:8090 MCPD_API_KEY=your-key npx @mozilla-ai/mcpd-proxy

# From source build
node dist/index.mjs

# From source with custom address
MCPD_ADDR=http://localhost:8090 node dist/index.mjs

VS Code Setup

Add to your VS Code MCP settings file (location varies by platform):

{
  "servers": {
    "mcpd": {
      "type": "stdio",
      "command": "npx",
      "args": ["@mozilla-ai/mcpd-proxy"],
      "env": {
        "MCPD_ADDR": "http://localhost:8090"
      }
    }
  }
}

Or if building from source:

{
  "servers": {
    "mcpd": {
      "type": "stdio",
      "command": "node",
      "args": ["<path-to-mcpd-proxy>/dist/index.mjs"],
      "env": {
        "MCPD_ADDR": "http://localhost:8090"
      }
    }
  }
}

Replace <path-to-mcpd-proxy> with the absolute path to your installation.

Reload VS Code: Cmd+Shift+P → "Developer: Reload Window"

Verify the connection in the MCP panel to see available tools.

Cursor Setup

Create or edit .cursor/mcp.json in your project directory, or ~/.cursor/mcp.json for global configuration:

{
  "mcpServers": {
    "mcpd": {
      "command": "npx",
      "args": ["@mozilla-ai/mcpd-proxy"],
      "env": {
        "MCPD_ADDR": "http://localhost:8090"
      }
    }
  }
}

Or if building from source:

{
  "mcpServers": {
    "mcpd": {
      "command": "node",
      "args": ["<path-to-mcpd-proxy>/dist/index.mjs"],
      "env": {
        "MCPD_ADDR": "http://localhost:8090"
      }
    }
  }
}

Replace <path-to-mcpd-proxy> with the absolute path to your installation, or use ${workspaceFolder} for relative paths.

Reload Cursor to apply the configuration.

See examples/ folder for configuration examples.

Development

Project Structure

mcpd-proxy/
├── src/
│   ├── index.ts               # CLI entry point
│   ├── server.ts              # MCP server implementation
│   ├── config.ts              # Configuration loader
│   └── apiPaths.ts            # API endpoint constants
├── tests/
│   └── unit/                  # Unit test files
│       ├── aggregation.test.ts
│       ├── apiPaths.test.ts
│       ├── config.test.ts
│       ├── parsers.test.ts
│       └── server.test.ts
├── .github/
│   └── workflows/             # GitHub Actions workflows
│       ├── tests.yaml
│       ├── lint.yaml
│       └── release.yaml
├── examples/
│   ├── vscode-config.json     # VS Code configuration example
│   └── cursor-config.json     # Cursor configuration example
├── dist/                      # Build output (gitignored)
├── package.json               # npm package configuration
├── package-lock.json          # npm dependency lock file
├── tsconfig.json              # TypeScript compiler configuration
├── tsconfig.test.json         # TypeScript test configuration
├── vitest.config.ts           # Vitest test configuration
├── vite.config.mts            # Vite build configuration
├── eslint.config.mts          # ESLint configuration
├── .prettierignore            # Prettier ignore patterns
├── .gitignore                 # Git ignore patterns
└── README.md                  # This file

Development Workflow

# Install dependencies
npm install

# Build once
npm run build

# Watch mode (auto-rebuild on changes)
npm run dev

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Type check without building
npm run typecheck

# Lint code
npm run lint

# Format code
npm run format

Manual Testing

Test the MCP protocol directly using JSON-RPC over stdio:

# Test initialize
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | node dist/index.mjs

# Test list tools
echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | node dist/index.mjs

Naming Conventions

Tools

Tools are exposed with the format: {server}__{tool_name}

Examples:

  • time__get_current_time - get_current_time tool from time server
  • github__create_issue - create_issue tool from github server
  • fetch__get_url - get_url tool from fetch server

This naming convention prevents tool name collisions between servers and makes it clear which server provides each tool.

Resources

Resources use a custom URI scheme: mcpd://{server}/{resource_uri}

Examples:

  • mcpd://filesystem/documents/file.txt
  • mcpd://database/users/123

Prompts

Prompts follow the same naming convention as tools: {server}__{prompt_name}

Architecture

Singleton McpdClient

mcpd-proxy creates a single instance of McpdClient at startup and reuses it for all requests. This is essential for:

  • Caching: Health check cache (10s TTL) and tool schema cache (60s TTL)
  • Performance: Avoids creating new HTTP connections for each request
  • Efficiency: Reduces load on mcpd daemon
const mcpdClient = new McpdClient({
  apiEndpoint: config.mcpdAddr,
  apiKey: config.mcpdApiKey,
  healthCacheTtl: 10,
});

MCP Protocol Handlers

The proxy implements the following MCP protocol handlers:

  • initialize - Handshake with IDE, declares capabilities
  • tools/list - Aggregates tools from all mcpd servers
  • tools/call - Parses tool name and forwards to mcpd
  • resources/list - Aggregates resources from all servers
  • resources/read - Forwards resource read requests to mcpd
  • prompts/list - Aggregates prompts from all servers
  • prompts/get - Forwards prompt requests to mcpd
  • ping - Health check endpoint

Troubleshooting

Cannot connect to mcpd daemon

Cause: mcpd daemon is not running or not accessible

Solution:

  1. Verify mcpd is running: curl http://localhost:8090/api/v1/servers
  2. Check MCPD_ADDR environment variable is correct
  3. Ensure no firewall blocking the connection

Server not found

Cause: Requested server doesn't exist in mcpd

Solution:

  1. List available servers: curl http://localhost:8090/api/v1/servers
  2. Check server is configured in mcpd
  3. Verify server is healthy: curl http://localhost:8090/api/v1/health/servers/<server-name>

VS Code not showing tools

Cause: VS Code may not have recognized the MCP server

Solution:

  1. Check VS Code developer console for errors (Help → Toggle Developer Tools)
  2. Verify the path to dist/index.mjs is correct and absolute (if building from source)
  3. Reload VS Code: Cmd+Shift+P → "Developer: Reload Window"
  4. Check mcpd daemon is running and accessible

Tools listed but execution fails

Cause: Server may be unhealthy or tool doesn't exist

Solution:

  1. Check server health via mcpd API
  2. Verify tool exists on the server
  3. Check mcpd logs for errors

Future Enhancements

  • Dynamic tool list updates (notifications/tools/list_changed)
  • Server filtering via MCPD_SERVERS environment variable
  • Improved unhealthy server handling

Related Projects

License

Apache-2.0

Contributing

See the main mcpd repository for contribution guidelines.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选