Labsco
shadowcz007 logo

MCP Server Executable

156

from shadowcz007

An executable server for running MCP services, featuring tool chaining, multi-service management, and plugin support.

🔥🔥🔥✓ VerifiedFreeNeeds API keys

MCP EXE

MCP Server.exe

小智 & Cursor 的 MCP 启动器 - MCP For Cursor&xiaozhi

MCP Server.exe 是一个强大的可执行服务器,它不仅能够运行标准的 MCP (Model Context Protocol) 服务,更提供了丰富的高级功能:

  • 工具链式调用:支持将多个工具按序组合,实现复杂的自动化流程
  • 多 MCP 服务组合:可同时运行和管理多个 MCP 服务,支持 SSE 和 stdio 双模式
  • 插件化工具系统:支持自定义工具的动态加载和配置
  • 灵活的部署选项:从单机运行到分布式部署,满足各类集成场景
  • 自动重载:监听 --mcp-config--mcp-js 变更,自动重启生效

MCP Server.exe is a powerful executable server that not only runs standard MCP (Model Context Protocol) services, but also provides rich advanced features:

  • Tool Chain Execution: Support sequential combination of multiple tools for complex automation
  • Multiple MCP Services: Can run and manage multiple MCP services simultaneously, supporting both SSE and stdio modes
  • Pluggable Tool System: Support dynamic loading and configuration of custom tools
  • Flexible Deployment: From standalone operation to distributed deployment, meeting various integration scenarios
  • Auto reload for config changes

Usage

# 推荐:通过 CLI 运行(无需本地构建)
npx mcp_exe --mcp-config ./examples/mcp.json

# 或运行打包后的可执行文件(Windows/macOS)
./executables/mcp_server-win-x64.exe --mcp-config ./examples/mcp.json

📚 详细文档 | Detailed Documentation

命令行参数 | Command Line Arguments

服务器支持以下命令行参数来自定义其行为:The server supports the following command line arguments:

参数说明默认值
--ws <url>WebSocket 服务器地址,启用 WebSocket 连接模式
--mcp-js <路径>MCP JavaScript 配置文件路径(支持 configureMcpmcpPlugin
--mcp-config <路径/json字符串>MCP JSON 配置文件路径或 JSON 字符串
--server-name <name>服务器名称mcp_server_exe

| --port <端口> | 服务器监听端口 | 3000 | | --transport <模式> | 传输模式,支持 ssestdio(非 WS 模式下生效) | sse | | --cronjob <路径/json> | 定时任务配置文件路径或 JSON 字符串 | 无 | | --cursor-link | 启动后在 Cursor 中快捷接入(SSE 模式) | 关闭 | | --log-level <level> | 日志级别:TRACE/DEBUG/INFO/WARN/ERROR/FATAL/OUTPUT | INFO | | --version <version> --description <desc> --author <author> --license <license> --homepage <url> | 元信息 | - |

提示:若提供 --ws 则优先使用 WebSocket 模式;否则未显式指定时默认使用 sse

配置文件格式 | Configuration File Format

服务器支持使用配置文件同时配置服务器参数和 MCP 功能:

module.exports = {
  // MCP 配置函数 | MCP configuration function
  configureMcp: function(server, ResourceTemplate, z) {
    // 配置资源和工具 | Configure resources and tools
  },
  // 可选:提供额外的 mcp 配置对象
  mcpConfig: { /* mcpServers/tools/toolChains/namespace */ }
}

自动重载 | Auto Reload

  • 监听 --mcp-config 文件变更:自动重新解析并重启服务(含工具链/命名空间/工具白名单等)
  • 监听 --mcp-js 文件变更:自动重新加载自定义 configureMcp/mcpPlugin

开发指南 | Development Guide

安装 | Installation

npm install

构建 | Build

yarn build # 或 npm run build

运行 | Run

npm start
# 或开发模式(SSE):
npm run dev
# WebSocket 开发:
npm run dev-ws
# Cronjob 开发:
npm run dev-cronjob

打包 | Packaging

# Windows 打包
npm run package-win

# macOS 打包(Intel/Apple Silicon)
npm run package-mac-intel
npm run package-mac-arm

打包后的可执行文件将生成在 executables 目录中。

日志 | Logging

  • 通过 --log-level 控制最小输出级别(默认 INFO
  • 控制台带时间戳/分类/颜色输出;OUTPUT 级别用于原样输出供工具解析

作为库使用 | Library API

自 v0.11.x 起,提供稳定导出:McpRouterServer

// CommonJS
const { McpRouterServer } = require('mcp_exe');

(async () => {
  const server = new McpRouterServer({ name: 'my-app' }, { transportType: 'sse', port: 3000 });
  await server.importMcpConfig(require('./mcp.json'), null);
  await server.start();
})();
// TypeScript / ESM
import { McpRouterServer } from 'mcp_exe';

const server = new McpRouterServer({ name: 'my-app' }, { transportType: 'stdio' });
await server.importMcpConfig(mcpJson, null);
await server.start();
  • 类型声明输出于 dist/index.d.ts,通过 types/exports 自动暴露。
  • CLI 仍通过 bin/cli.js 提供,库与 CLI 可并行使用。

📝 许可证 | License

MIT