Logo MCP Proxy

MCP Proxy

Tổ chức
openserv-labs

Lightweight reverse proxy + admin UI that turns your backend endpoints into multi-tenant Model Context Protocol tools for OpenServ—or any MCP-compatible agent.

Nhà phát hànhopenserv-labs
Kho mãmcp-proxy
Ngôn ngữTypeScript
Bản fork
2
Sao
16
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    MCP Proxy cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    16 sao và 2 bản fork từ kho mã được liên kết.

MCP Proxy

What is MCP Proxy?

MCP Proxy is a bridge between the OpenServ agent ecosystem and your own backend services. While it is designed with OpenServ in mind, it can be used with any client that speaks the Model Context Protocol (MCP). It allows you to define, manage, and expose custom "tools" (API endpoints) to MCP clients using a simple admin interface. Each tool is described with a name, description, and parameter schema, and is mapped to a backend endpoint.

Words to Know

  • Application Name: A unique identifier for your integration. Each Application has its own backend URL and set of tools.
  • Backend URL: The base URL where your backend services live. Each tool is mapped to a POST endpoint at ${backendUrl}/${toolName}.
  • Tools: Each tool is a function or API endpoint you want to expose to MCP clients. You define its name, description, and parameters in the admin UI.
  • Parameter Schema: Each tool has a schema describing the expected parameters (name, type, description) for validation and documentation.

How it Works

  1. Configure an Application

    • Go to /admin and enter a new Application Name and your backend URL.
    • Define tools for this application, specifying their names, descriptions, and parameters.
  2. Proxying Requests

    • When an MCP client connects (via /mcp?applicationName=... or /sse?applicationName=...), the proxy loads the tools and backend URL for that Application Name.
    • When the client calls a tool, MCP Proxy validates the parameters and forwards the request as a POST to your backend at ${backendUrl}/${toolName}.
    • The backend responds with JSON, which is returned to the client.
  3. Multi-Application Support

    • You can manage multiple Applications, each with its own backend and tool set.
    • This allows you to host multiple integrations or environments from a single MCP Proxy instance.

Example Use Case

Suppose you have a backend with endpoints like /weather, /stock, and /translate.
You want MCP clients (such as OpenServ agents) to be able to call these as tools.

  • In the admin UI, set Application Name: my-company
  • Backend URL: https://api.mycompany.com
  • Add tools:
    • weather (parameters: city, country)
    • stock (parameters: symbol)
    • translate (parameters: text, targetLanguage)

Now, any MCP-compatible client can connect to your MCP Proxy with ?applicationName=my-company and call these tools. The proxy will forward the requests to your backend, validate parameters, and return the results.


Real Hardware Example: Arduinogent

Arduino and MCP Proxy Integration

You can use MCP Proxy to connect real-world devices to MCP clients. For example, we created Arduinogent: a simple Arduino web server that exposes tool endpoints directly from an Arduino board. This lets you control or query your Arduino from any MCP-compatible client!

  • In the admin UI, set Application Name: arduino-lab
  • Backend URL: http://<your-arduino-ip> (a private, plain-HTTP backend, so set BACKEND_ALLOWED_HOSTS and BACKEND_ALLOW_HTTP - see Backend URLs)
  • Add tools, e.g.:
    • led (parameters: state)
    • temperature (no parameters)

Example Arduino code:

cpp
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
WebServer server(80);

void handleLed() {
  String body = server.arg("plain");
  // Parse JSON body for { "state": "on" } or { "state": "off" }
  if (body.indexOf("on") >= 0) {
    digitalWrite(LED_BUILTIN, LOW); // turn LED on
    server.send(200, "application/json", "{\"result\":\"LED on\"}");
  } else {
    digitalWrite(LED_BUILTIN, HIGH); // turn LED off
    server.send(200, "application/json", "{\"result\":\"LED off\"}");
  }
}

void handleTemperature() {
  float temp = 23.5; // Replace with real sensor reading
  server.send(200, "application/json", String("{\"temperature\":") + temp + "}");
}

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) delay(500);
  server.on("/led", HTTP_POST, handleLed);
  server.on("/temperature", HTTP_POST, handleTemperature);
  server.begin();
}

void loop() {
  server.handleClient();
}

Now, you can control your Arduino from any MCP client via MCP Proxy, just like any other backend!


Why use MCP Proxy?

  • No code changes to your backend: Just expose POST endpoints.
  • Centralized tool management: Add, update, or remove tools via the admin UI.
  • Parameter validation: Ensures clients send the right data.
  • Multi-tenant: Host multiple integrations with different backends.
  • MCP compatibility: Works out-of-the-box with OpenServ agents and any other MCP client.

Installation

Setup

  1. Clone the repository:

    bash
    git clone https://github.com/openserv-labs/mcp-proxy.git
    cd mcp-proxy
  2. Install dependencies:

    bash
    npm install
  3. Create a .env file in the project root (see .env.example):

    PORT=3000
    HOST=127.0.0.1
    MONGODB_URI=mongodb://localhost:27017/mcp-proxy
    ADMIN_TOKEN=<a long random secret>
    CORS_ORIGINS=
    LOG_LEVEL=info

    Generate the admin token with openssl rand -hex 32. The admin API is disabled until ADMIN_TOKEN is set - see Securing the admin API.

  4. Build the project:

    bash
    npm run build
  5. Start the server:

    bash
    npm start

Securing the admin API

The admin API (/admin/api/*) reads and writes the backend URL and tool definitions for every application, so it is protected by an admin credential.

Admin token

Every /admin/api/* request must carry the ADMIN_TOKEN as a bearer token:

bash
curl http://127.0.0.1:3000/admin/api/tools \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "X-Application-Name: my-company"

X-Application-Name selects which application to act on; it is not a credential. The admin UI at /admin prompts for the token and keeps it in the tab's sessionStorage only.

The server fails closed: if ADMIN_TOKEN is unset or shorter than 16 characters, every admin API request is rejected with 503 and the reason is logged at startup.

Network binding

The server binds 127.0.0.1 by default. To expose it, set HOST=0.0.0.0 - only behind a firewall or reverse proxy, and only with ADMIN_TOKEN set.

CORS

Cross-origin requests are refused unless CORS_ORIGINS lists the exact origins you want to allow (comma-separated), for example CORS_ORIGINS=https://admin.example.com. Setting CORS_ORIGINS=* restores the old allow-anything behaviour and is not recommended.

Backend URLs

An application's backend URL is fetched server-side, so a bad value turns the proxy into a relay into its own network. Backend URLs are therefore validated when they are stored and re-checked on every tool call, and the connection itself is restricted.

By default a backend URL must:

  • use https, with no embedded credentials and no query string or fragment;
  • point at a public host - loopback, private, link-local, carrier-grade NAT and reserved ranges are refused, including the 169.254.169.254 and fd00:ec2::254 cloud metadata endpoints.

Host names are additionally checked against the addresses they actually resolve to, at the moment the connection is made, so a name that resolves into private space cannot be used to get around the rule. Redirects are not followed, so a backend cannot bounce the proxy inward either. HTTP_PROXY/HTTPS_PROXY are ignored for backend calls for the same reason: a forward proxy would resolve the backend host itself, out of reach of these checks.

Two settings adjust this:

VariableEffect
BACKEND_ALLOWED_HOSTSComma-separated allow list; an entry may start with *. to match subdomains. When set, only these hosts are reachable, and they are trusted (private addresses are permitted).
BACKEND_ALLOW_HTTPSet truthy to permit http:// backends.

Backend request limits

VariableDefaultEffect
BACKEND_TIMEOUT_MS15000Total deadline for a backend call - not an idle timeout, so a tool that legitimately takes longer needs this raised.
BACKEND_MAX_RESPONSE_BYTES1048576Largest backend response the proxy will read. Larger responses fail the tool call.

To reach a backend on a private network - the Arduino example above, or a service on localhost - name it explicitly and allow plain HTTP:

BACKEND_ALLOWED_HOSTS=192.168.1.50
BACKEND_ALLOW_HTTP=true

Note that /mcp and /sse are the client-facing endpoints and carry no credential of their own, so anyone who knows an application name can trigger a tool call. The control on that path is which URLs the proxy is willing to fetch, not who may ask it to.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

MIT License

Copyright (c) 2025 OpenServ Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Cài đặt

TypingMind
{
  "mcpServers": {
    "openserv-labs-mcp-proxy": {
      "command": "node",
      "args": [
        "build/server.js"
      ]
    }
  }
}

Dùng MCP MCP Proxy với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối MCP Proxy, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm MCP Proxy làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của MCP Proxy.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "openserv-labs-mcp-proxy": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-proxy"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của MCP Proxy, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của MCP Proxy.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng MCP Proxy giúp tôi làm việc này không?
MCP Proxy
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng MCP Proxy.

Câu hỏi thường gặp

Máy chủ MCP MCP Proxy dùng để làm gì?

MCP Proxy là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP MCP Proxy với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng MCP Proxy với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP MCP Proxy với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối MCP Proxy, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP MCP Proxy với TypingMind?

MCP Proxy hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP MCP Proxy cung cấp những công cụ nào trong TypingMind?

MCP Proxy cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP MCP Proxy không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu MCP Proxy yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇