Skip to content
Back to search

mcp_server_exe

小智 & Cursor 的 MCP 启动器 - MCP For Cursor&xiaozhi。打包成可执行文件。Turn MCP server into an executable file

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/shadowcz007--mcp-server-exe/badge.svg)](/listings/shadowcz007--mcp-server-exe)

HTML

<a href="/listings/shadowcz007--mcp-server-exe"><img src="/api/listings/shadowcz007--mcp-server-exe/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

最简单的使用方式 - 双击运行,或使用 npx 即可启动一个标准的 MCP 服务。

The simplest way - double-click to run, or start via npx.

# 双击运行 mcp_server.exe,或通过命令行启动
./executables/mcp_server-win-x64.exe
# 或
npx mcp_exe

默认配置 | Default Configuration: - 监听端口 | Listen Port: 3000(可通过 `--port` 修改) - SSE 路由 | SSE Endpoints: GET `/` 建立会话,POST `/sessions?sessionId=...` 发送消息 - 内置基础工具集 | Built-in Basic Tools - 自动重载 | Auto reload `--mcp-config` 与 `--mcp-js`

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 341 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ![MCP EXE](./assets/image.png)
  2. # MCP Server.exe
  3. > 小智 & Cursor 的 MCP 启动器 - MCP For Cursor&xiaozhi
  4. MCP Server.exe 是一个强大的可执行服务器,它不仅能够运行标准的 MCP (Model Context Protocol) 服务,更提供了丰富的高级功能:
  5. - 工具链式调用:支持将多个工具按序组合,实现复杂的自动化流程
  6. - 多 MCP 服务组合:可同时运行和管理多个 MCP 服务,支持 SSE 和 stdio 双模式
  7. - 插件化工具系统:支持自定义工具的动态加载和配置
  8. - 灵活的部署选项:从单机运行到分布式部署,满足各类集成场景
  9. - 自动重载:监听 `--mcp-config` 与 `--mcp-js` 变更,自动重启生效
  10. MCP Server.exe is a powerful executable server that not only runs standard MCP (Model Context Protocol) services, but also provides rich advanced features:
  11. - Tool Chain Execution: Support sequential combination of multiple tools for complex automation
  12. - Multiple MCP Services: Can run and manage multiple MCP services simultaneously, supporting both SSE and stdio modes
  13. - Pluggable Tool System: Support dynamic loading and configuration of custom tools
  14. - Flexible Deployment: From standalone operation to distributed deployment, meeting various integration scenarios
  15. - Auto reload for config changes
  16. ### Usage
  17. ```bash
  18. # 推荐:通过 CLI 运行(无需本地构建)
  19. npx mcp_exe --mcp-config ./examples/mcp.json
  20. # 或运行打包后的可执行文件(Windows/macOS)
  21. ./executables/mcp_server-win-x64.exe --mcp-config ./examples/mcp.json
  22. ```
  23. ## 🎯 主要使用场景 | Main Usage Scenarios
  24. ### 1. WebSocket 连接模式 | WebSocket Connection Mode
  25. 支持通过 WebSocket 连接到其他 MCP 服务,特别适合连接到 xiaozhi.me 等的接入。通过配置文件,可以轻松地将多个 MCP 服务接入到 xiaozhi.me。
  26. Support connecting to other MCP services via WebSocket, especially suitable for connecting to WebSocket-enabled MCP services like xiaozhi.me. Through configuration files, you can easily integrate multiple MCP services with xiaozhi.me.
  27. ![xiaozhi-mcp](./assets/xiaozhi-mcp.png)
  28. ```bash
  29. # 使用配置文件连接到 xiaozhi.me / Start in WebSocket mode
  30. npx mcp_exe --ws wss://api.xiaozhi.me/mcp/?token=...xxx --mcp-config ./examples/mcp-sse.json
  31. ```
  32. 配置示例 | Configuration Example (mcp-sse.json):
  33. ```json
  34. {
  35. "mcpServers": {
  36. "Model Server sse": {
  37. "url": "http://127.0.0.1:3000"
  38. }
  39. },
  40. "serverInfo": {
  41. "serverName": "ws-client-mcp-server",
  42. "version": "1.0.0",
  43. "description": "WebSocket 客户端的 MCP 服务器实例",
  44. "author": "shadow"
  45. }
  46. }
  47. ```
  48. WebSocket 模式特性 | WebSocket Mode Features:
  49. - 支持实时双向通信 | Support real-time bidirectional communication
  50. - 自动重连机制 | Automatic reconnection mechanism
  51. - 多服务统一管理 | Unified management of multiple services
  52. - 兼容标准 MCP 协议 | Compatible with standard MCP protocol
  53. 相关项目[可视化xiaozhi-mcp启动器](https://github.com/shadowcz007/xiaozhi-mcp-client)
  54. ### 2. 快速启动独立服务 | Quick Start Standalone Service
  55. 最简单的使用方式 - 双击运行,或使用 npx 即可启动一个标准的 MCP 服务。
  56. The simplest way - double-click to run, or start via npx.
  57. ```bash
  58. # 双击运行 mcp_server.exe,或通过命令行启动
  59. ./executables/mcp_server-win-x64.exe
  60. # 或
  61. npx mcp_exe
  62. ```
  63. 默认配置 | Default Configuration:
  64. - 监听端口 | Listen Port: 3000(可通过 `--port` 修改)
  65. - SSE 路由 | SSE Endpoints: GET `/` 建立会话,POST `/sessions?sessionId=...` 发送消息
  66. - 内置基础工具集 | Built-in Basic Tools
  67. - 自动重载 | Auto reload `--mcp-config` 与 `--mcp-js`
  68. ### 3. 组合多个 MCP 服务 | Combine Multiple MCP Services
  69. 使用与 **Cursor** 一致的 **mcp.json** 配置文件,通过配置文件组合多个 MCP 服务,支持同时使用 SSE 和 stdio 两种传输模式。这样可以根据不同的应用场景选择合适的传输方式,提高系统的灵活性和可扩展性。
  70. Use the same **mcp.json** configuration file as **Cursor** to combine multiple MCP services, supporting both SSE and stdio transport modes simultaneously.
  71. ```bash
  72. npx mcp_exe --mcp-config ./examples/mcp.json
  73. ```
  74. 配置示例 | Configuration Example (mcp.json):
  75. ```json
  76. {
  77. "mcpServers": {
  78. "Model Server sse": { "url": "http://127.0.0.1:9090" },
  79. "Model Server - stdio": { "command": "xxx", "args": ["--transport", "stdio"] }
  80. },
  81. "serverInfo": { "serverName": "dynamic-mcp-server" },
  82. "tools": [],
  83. "namespace": "."
  84. }
  85. ```
  86. - `tools`: 允许的工具白名单(为空数组表示不过滤)
  87. - `namespace`: 组合命名空间分隔符,默认 `.`(亦可使用 `::`)
  88. ### 4. 工具链式调用 | Tool Chain Execution
  89. 支持将多个工具组合成工具链,实现复杂的自动化流程。工具链可以灵活配置数据流转和结果输出。
  90. Support combining multiple tools into a tool chain to implement complex automation processes. Tool chains can flexibly configure data flow and result output.
  91. ```bash
  92. npx mcp_exe --mcp-config ./examples/product-hunt/mcp-tools.json
  93. ```
  94. 配置示例 | Configuration Example(节选,自定义按需调整):
  95. ```json
  96. {
  97. "toolChains": [
  98. {
  99. "name": "product_hunt_news",
  100. "description": "get product hunt news",
  101. "steps": [
  102. { "toolName": "get_product_hunt_url", "args": {} },
  103. { "toolName": "load_product_hunt_js_code", "args": {} },
  104. { "toolName": "browser_navigate", "args": {}, "outputMapping": { "url": "content.0.text" }, "fromStep": 0 },
  105. { "toolName": "browser_execute_javascript", "args": {}, "outputMapping": { "code": "content.0.text" }, "fromStep": 1 },
  106. { "toolName": "browser_close", "args": {} }
  107. ],
  108. "output": { "steps": [3] }
  109. }
  110. ]
  111. }
  112. ```
  113. 工具链特性 | Tool Chain Features:
  114. - 支持多步骤顺序执行 | Support multi-step sequential execution
  115. - 灵活的数据流转映射 | Flexible data flow mapping(`outputMapping`/`fromStep`)
  116. - 可从任意步骤获取结果 | Can get results from any step(`output.steps`)
  117. ### 5. 自定义工具的插件机制 | Custom Tools Plugin Mechanism
  118. 通过 JavaScript 配置文件,灵活定义工具、资源和提示。
  119. Flexibly define tools, resources, and prompts through JavaScript configuration files.
  120. ```bash
  121. npx mcp_exe --mcp-js ./examples/custom-mcp-config.js
  122. ```
  123. 配置示例 | Configuration Example (`custom-mcp-config.js`):
  124. ```javascript
  125. module.exports = {
  126. // 推荐导出名:configureMcp(也兼容 mcpPlugin)
  127. configureMcp: function(server, ResourceTemplate, z) {
  128. server.tool('myTool', '自定义工具示例', { /* zod schema */ }, async (args) => ({ content: [{ type: 'text', text: 'ok' }] }))
  129. server.resource('custom-echo', new ResourceTemplate('custom-echo://{message}', { list: undefined }), async (uri, { message }) => ({ contents: [{ uri: uri.href, text: message }] }))
  130. server.prompt('custom-prompt', { /* zod */ }, ({ message }) => ({ messages: [{ role: 'user', content: { type: 'text', text: message } }] }))
  131. }
  132. }
  133. ```
  134. ### 6. 定时任务模式 | Cronjob Mode
  135. 使用 `--cronjob` 定时执行工具。目前支持的操作:`listTools`、`callTool`。任务会在启动时立即执行一次,并按 `schedule` 周期执行,可通过桌面气泡/邮件/ntfy 推送结果。
  136. ```bash
  137. # 示例:结合自定义工具与定时任务
  138. npx mcp_exe --cronjob ./examples/cronjob.json --mcp-js ./examples/product-hunt/custom-mcp-config.js
  139. ```
  140. 配置示例 | Configuration Example(`examples/cronjob.json`):
  141. ```json
  142. {
  143. "tasks": [
  144. {
  145. "schedule": "*/30 * * * * *",
  146. "operations": [
  147. { "type": "callTool", "name": "get_product_hunt_url", "arguments": {} }
  148. ],
  149. "notify": [
  150. { "type": "desktop", "title": "任务执行结果", "icon": "" }
  151. ]
  152. }
  153. ]
  154. }
  155. ```
  156. 通知支持 | Notifications:
  157. - desktop: 系统气泡(需本地桌面环境)
  158. - email: 发送邮件(需提供 `to`、`subject` 等)
  159. - ntfy: 推送到 `ntfy`(需提供 `url`、`topic`、`tags`、`priority`)
  160. 注意:定时任务直接调用已组合的工具(含远端 SSE/本地 stdio 工具),无需在任务中指定传输。
  161. ### 7. 嵌入式集成 | Embedded Integration
  162. 作为独立进程集成到任何应用程序中。
  163. Integrate as a standalone process into any application.
  164. ```javascript
  165. // Node.js 示例 | Node.js Example
  166. const { spawn } = require('child_process')
  167. const mcpServer = spawn('./executables/mcp_server-win-x64.exe', [
  168. '--port', '3000',
  169. '--transport', 'stdio'
  170. ])
  171. mcpServer.stdout.on('data', (data) => {
  172. // 处理 MCP 服务器的输出
  173. })
  174. mcpServer.stdin.write(JSON.stringify({
  175. // 发送请求到 MCP 服务器
  176. }))
  177. ```
  178. ## 📚 详细文档 | Detailed Documentation
  179. ### 命令行参数 | Command Line Arguments
  180. 服务器支持以下命令行参数来自定义其行为:The server supports the following command line arguments:
  181. | 参数 | 说明 | 默认值 |
  182. |------|------|--------|
  183. | `--ws <url>` | WebSocket 服务器地址,启用 WebSocket 连接模式 | 无 |
  184. | `--mcp-js <路径>` | MCP JavaScript 配置文件路径(支持 `configureMcp` 或 `mcpPlugin`) | 无 |
  185. | `--mcp-config <路径/json字符串>` | MCP JSON 配置文件路径或 JSON 字符串 | 无 |
  186. | `--server-name <name>` | 服务器名称 | `mcp_server_exe` |
  187. | `--port <端口>` | 服务器监听端口 | 3000 |
  188. | `--transport <模式>` | 传输模式,支持 `sse` 或 `stdio`(非 WS 模式下生效) | sse |
  189. | `--cronjob <路径/json>` | 定时任务配置文件路径或 JSON 字符串 | 无 |
  190. | `--cursor-link` | 启动后在 Cursor 中快捷接入(SSE 模式) | 关闭 |
  191. | `--log-level <level>` | 日志级别:TRACE/DEBUG/INFO/WARN/ERROR/FATAL/OUTPUT | INFO |
  192. | `--version <version>` `--description <desc>` `--author <author>` `--license <license>` `--homepage <url>` | 元信息 | - |
  193. 提示:若提供 `--ws` 则优先使用 WebSocket 模式;否则未显式指定时默认使用 `sse`。
  194. ### 配置文件格式 | Configuration File Format
  195. 服务器支持使用配置文件同时配置服务器参数和 MCP 功能:
  196. ```javascript
  197. module.exports = {
  198. // MCP 配置函数 | MCP configuration function
  199. configureMcp: function(server, ResourceTemplate, z) {
  200. // 配置资源和工具 | Configure resources and tools
  201. },
  202. // 可选:提供额外的 mcp 配置对象
  203. mcpConfig: { /* mcpServers/tools/toolChains/namespace */ }
  204. }
  205. ```
  206. ### 自动重载 | Auto Reload
  207. - 监听 `--mcp-config` 文件变更:自动重新解析并重启服务(含工具链/命名空间/工具白名单等)
  208. - 监听 `--mcp-js` 文件变更:自动重新加载自定义 `configureMcp`/`mcpPlugin`
  209. ### 开发指南 | Development Guide
  210. #### 安装 | Installation
  211. ```bash
  212. npm install
  213. ```
  214. #### 构建 | Build
  215. ```bash
  216. yarn build # 或 npm run build
  217. ```
  218. #### 运行 | Run
  219. ```bash
  220. npm start
  221. # 或开发模式(SSE):
  222. npm run dev
  223. # WebSocket 开发:
  224. npm run dev-ws
  225. # Cronjob 开发:
  226. npm run dev-cronjob
  227. ```
  228. #### 打包 | Packaging
  229. ```bash
  230. # Windows 打包
  231. npm run package-win
  232. # macOS 打包(Intel/Apple Silicon)
  233. npm run package-mac-intel
  234. npm run package-mac-arm
  235. ```
  236. 打包后的可执行文件将生成在 `executables` 目录中。
  237. ### 日志 | Logging
  238. - 通过 `--log-level` 控制最小输出级别(默认 `INFO`)
  239. - 控制台带时间戳/分类/颜色输出;`OUTPUT` 级别用于原样输出供工具解析
  240. ### 作为库使用 | Library API
  241. 自 v0.11.x 起,提供稳定导出:`McpRouterServer`。
  242. ```js
  243. // CommonJS
  244. const { McpRouterServer } = require('mcp_exe');
  245. (async () => {
  246. const server = new McpRouterServer({ name: 'my-app' }, { transportType: 'sse', port: 3000 });
  247. await server.importMcpConfig(require('./mcp.json'), null);
  248. await server.start();
  249. })();
  250. ```
  251. ```ts
  252. // TypeScript / ESM
  253. import { McpRouterServer } from 'mcp_exe';
  254. const server = new McpRouterServer({ name: 'my-app' }, { transportType: 'stdio' });
  255. await server.importMcpConfig(mcpJson, null);
  256. await server.start();
  257. ```
  258. - 类型声明输出于 `dist/index.d.ts`,通过 `types`/`exports` 自动暴露。
  259. - CLI 仍通过 `bin/cli.js` 提供,库与 CLI 可并行使用。
  260. ## 📝 许可证 | License
  261. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.