Back to MCP directory
publicPublicdnsLocal runtime

cd-mcp-proxy

通过proxyMessage实现与MCP服务器的消息代理转发

article

README

🚀 消息代理服务项目

本项目实现了一个消息代理服务,通过导入 proxyMessage 函数,可将消息发送到服务器进行处理,为消息的传递和处理提供了便捷的解决方案。

🚀 快速开始

基础用法

// 从’@contextdepot/mcp-proxy/dist/index.js’导入proxyMessage
import proxyMessage from '@contextdepot/mcp-proxy/dist/index.js';

// 创建服务器并配置处理程序
const server = new Server(..);
..

export default class extends WorkerEntrypoint {
    // 向服务器发送消息
    async message(requestMessage): Promise<void> {
        return proxyMessage(server, requestMessage)
    }
};
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client