MCP Remote Server

by sirmews
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Integrated for type checking and linting in the project, chosen for its 'gofmt'-like capabilities in JavaScript development.

  • Used as the JavaScript runtime for the MCP server, selected for its speed and all-in-one capabilities.

这是增强的自述文件,其中包含基于代码库的更多技术细节:

mcp-远程服务器

可配置的模型上下文协议 (MCP) 服务器,可从远程配置动态加载其功能。它利用ModelContextProtocol创建一个可与本地 MCP 客户端通信的本地服务器。

概述

mcp-remote-server充当 MCP 客户端和远程 API 之间的桥梁。它解析远程托管配置(通过MCP_CONTROL_PLANE_URL指定),该配置包含一系列工具、资源和提示符,每个都指向远程 API 端点。

主要特点

  • 动态配置:服务器功能通过远程 JSON 配置定义
  • 自动刷新:配置每 60 秒自动刷新一次
  • 支持所有 MCP 原语
    • 工具:通过远程 API 调用执行操作
    • 资源:将远程数据公开为可读资源
    • 提示:定义可重复使用的提示模板

配置格式

{ "tools": [{ "name": "tool-name", "description": "Tool description", "inputSchema": { "type": "object", "properties": { // JSON Schema for tool inputs } }, "handler": "https://api.example.com/tool-endpoint" }], "resources": [{ "uri": "resource://identifier", "name": "Resource Name", "description": "Resource description", "mimeType": "application/json", "handler": "https://api.example.com/resource-endpoint" }], "prompts": [{ "name": "prompt-name", "description": "Prompt description", "arguments": [{ "name": "arg-name", "description": "Argument description", "required": true }], "handler": "https://api.example.com/prompt-endpoint" }] }

处理程序 API 要求

远程处理程序必须返回适当格式的响应:

  • 工具处理程序:返回将被字符串化并包装在 MCP 工具响应中的 JSON
  • 资源处理程序:返回与指定 mimeType 匹配的内容
  • 提示处理程序:返回字符串(自动包装在消息中)或 MCP 格式的消息数组

安装

bun install

用法

  1. 设置您的控制平面 URL:
export MCP_CONTROL_PLANE_URL="https://your-config-endpoint"
  1. 运行服务器:
bun run index.ts

限制

  • 仅支持 HTTP/HTTPS 处理程序端点
  • 必须可以通过 HTTP GET 请求访问配置
  • 处理程序响应必须兼容 JSON
  • 仅在本地运行(标准 MCP 限制)

该项目是在 bun v1.1.32 版本中使用bun init创建的。Bun 是一个快速的一体化 JavaScript 运行时。我选择Bun是因为它速度快,而且我想尝试一些与众不同的东西。

这个项目也使用Biome进行类型检查和 linting。我选择 Biome 的原因和 Bun 一样。我想要一些不同的东西,并且希望 JS 能有一个类似gofmt的工具。这是一个很好的开始。

-
security - not tested
F
license - not found
-
quality - not tested

可配置的 MCP 服务器,可从远程配置动态加载功能,以将 MCP 客户端与远程 API 连接起来,从而执行操作、访问资源和利用提示模板。

  1. Overview
    1. Key Features
    2. Configuration Format
    3. Handler API Requirements
  2. Installation
    1. Usage
      1. Limitations
        ID: 2q6b1i9jpz