Cover image
Try Now
2025-04-10

启用基于云的AI服务可以通过HTTP请求访问基于本地STDIO的MCP服务器

3 years

Works with Finder

1

Github Watches

17

Github Forks

141

Github Stars

MCP Connect

License: MIT

███╗   ███╗ ██████╗██████╗      ██████╗ ██████╗ ███╗   ██╗███╗   ██╗███████╗ ██████╗████████╗
████╗ ████║██╔════╝██╔══██╗    ██╔════╝██╔═══██╗████╗  ██║████╗  ██║██╔════╝██╔════╝╚══██╔══╝
██╔████╔██║██║     ██████╔╝    ██║     ██║   ██║██╔██╗ ██║██╔██╗ ██║█████╗  ██║        ██║   
██║╚██╔╝██║██║     ██╔═══╝     ██║     ██║   ██║██║╚██╗██║██║╚██╗██║██╔══╝  ██║        ██║   
██║ ╚═╝ ██║╚██████╗██║         ╚██████╗╚██████╔╝██║ ╚████║██║ ╚████║███████╗╚██████╗   ██║   
╚═╝     ╚═╝ ╚═════╝╚═╝          ╚═════╝ ╚═════╝ ╚═╝  ╚═══╝╚═╝  ╚═══╝╚══════╝ ╚═════╝   ╚═╝   

The Model Context Protocol (MCP) introduced by Anthropic is cool. However, most MCP servers are built on Stdio transport, which, while excellent for accessing local resources, limits their use in cloud-based applications.

MCP Connect is a tiny tool that is created to solve this problem:

  • Cloud Integration: Enables cloud-based AI services to interact with local Stdio based MCP servers
  • Protocol Translation: Converts HTTP/HTTPS requests to Stdio communication
  • Security: Provides secure access to local resources while maintaining control
  • Flexibility: Supports various MCP servers without modifying their implementation
  • Easy to use: Just run MCP Connect locally, zero modification to the MCP server
  • Tunnel: Built-in support for Ngrok tunnel

By bridging this gap, we can leverage the full potential of local MCP tools in cloud-based AI applications without compromising on security.

How it works

+-----------------+     HTTPS/SSE      +------------------+      stdio      +------------------+
|                 |                    |                  |                 |                  |
|  Cloud AI tools | <--------------->  |  Node.js Bridge  | <------------>  |    MCP Server    |
|   (Remote)      |       Tunnels      |    (Local)       |                 |     (Local)      |
|                 |                    |                  |                 |                  |
+-----------------+                    +------------------+                 +------------------+

Prerequisites

  • Node.js

Quick Start

  1. Clone the repository
    git clone https://github.com/EvalsOne/MCP-connect.git
    
    and enter the directory
    cd MCP-connect
    
  2. Copy .env.example to .env and configure the port and auth_token:
    cp .env.example .env
    
  3. Install dependencies:
    npm install
    
  4. Run MCP Connect
    # build MCP Connect
    npm run build
    # run MCP Connect
    npm run start
    # or, run in dev mode (supports hot reloading by nodemon)
    npm run dev
    

Now MCP connect should be running on http://localhost:3000/bridge.

Note:

  • The bridge is designed to be run on a local machine, so you still need to build a tunnel to the local MCP server that is accessible from the cloud.
  • Ngrok, Cloudflare Zero Trust, and LocalTunnel are recommended for building the tunnel.

Running with Ngrok Tunnel

MCP Connect has built-in support for Ngrok tunnel. To run the bridge with a public URL using Ngrok:

  1. Get your Ngrok auth token from https://dashboard.ngrok.com/authtokens
  2. Add to your .env file:
    NGROK_AUTH_TOKEN=your_ngrok_auth_token
    
  3. Run with tunnel:
    # Production mode with tunnel
    npm run start:tunnel
    
    # Development mode with tunnel
    npm run dev:tunnel
    

After MCP Connect is running, you can see the MCP bridge URL in the console.

API Endpoints

After MCP Connect is running, there are two endpoints exposed:

  • GET /health: Health check endpoint
  • POST /bridge: Main bridge endpoint for receiving requests from the cloud

For example, the following is a configuration of the official GitHub MCP:

{
  "command": "npx",
  "args": [
    "-y",
    "@modelcontextprotocol/server-github"
  ],
  "env": {
    "GITHUB_PERSONAL_ACCESS_TOKEN": "<your_github_personal_access_token>"
  }
}

You can send a request to the bridge as the following to list the tools of the MCP server and call a specific tool.

Listing tools:

curl -X POST http://localhost:3000/bridge \
     -d '{
       "method": "tools/list",
       "serverPath": "npx",
       "args": [
         "-y",
         "@modelcontextprotocol/server-github"
       ],
       "params": {},
       "env": {
         "GITHUB_PERSONAL_ACCESS_TOKEN": "<your_github_personal_access_token>"
       }
     }'

Calling a tool:

Using the search_repositories tool to search for repositories related to modelcontextprotocol

curl -X POST http://localhost:3000/bridge \
     -d '{
       "method": "tools/call",
       "serverPath": "npx",
       "args": [
         "-y",
         "@modelcontextprotocol/server-github"
       ],
       "params": {
         "name": "search_repositories",
         "arguments": {
            "query": "modelcontextprotocol"
         },
       },
       "env": {
         "GITHUB_PERSONAL_ACCESS_TOKEN": "<your_github_personal_access_token>"
       }
     }'

Authentication

MCP Connect uses a simple token-based authentication system. The token is stored in the .env file. If the token is set, MCP Connect will use it to authenticate the request.

Sample request with token:

curl -X POST http://localhost:3000/bridge \
     -H "Authorization: Bearer <your_auth_token>" \
     -d '{
       "method": "tools/list",
       "serverPath": "npx",
       "args": [
         "-y",
         "@modelcontextprotocol/server-github"
       ],
       "params": {},
       "env": {
         "GITHUB_PERSONAL_ACCESS_TOKEN": "<your_github_personal_access_token>"
       }
     }'

Configuration

Required environment variables:

  • AUTH_TOKEN: Authentication token for the bridge API (Optional)
  • PORT: HTTP server port (default: 3000, required)
  • LOG_LEVEL: Logging level (default: info, required)
  • NGROK_AUTH_TOKEN: Ngrok auth token (Optional)

Using MCP Connect with ConsoleX AI to access local MCP Server

The following is a demo of using MCP Connect to access a local MCP Server on ConsoleX AI:

MCP Connect Live Demo

License

MIT License

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • https://reddgr.com
  • Delivers concise Python code and interprets non-English comments

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • GeyserMC
  • 与Minecraft客户端/服务器通信的库。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • awslabs
  • AWS MCP服务器 - 将AWS最佳实践直接带入您的开发工作流程的专门MCP服务器

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • 1Panel-dev
  • 💬MAXKB是一种现成的AI聊天机器人,它集成了检索功能增强的生成(RAG)管道,支持强大的工作流程并提供高级的MCP工具使用功能。

    Reviews

    1 (1)
    Avatar
    user_SRyQwY7F
    2025-04-17

    As a dedicated user of MCP-connect, I must say it has significantly enhanced my project collaborations. EvalsOne did a fantastic job with this application. The seamless interface and comprehensive features boost efficiency and streamline communication. I highly recommend checking it out on GitHub at https://github.com/EvalsOne/MCP-connect. This tool is essential for anyone looking to improve their project management and team connectivity.