配置生成器

MCP Server 生成器

创建一个自定义 MCP server 起点,再按项目需求调整 handler、schema 和 package scripts。

最后更新: 2026年8月7日

Local-only generator

Parsing, selection, generation, copying, and downloads happen in this browser. No OpenAPI document, endpoint, key, or note is uploaded or collected.

1 · Define the server

Choose a narrow API surface

0 / 2 tools selected

OpenAPI JSON is parsed locally. YAML, remote URLs, callbacks, webhooks, and components are compatibility boundaries; convert them to JSON or endpoint lines first.

2 · Select tools

Expose only the operations you reviewed

3 · Download local files

Review the generated scaffold

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

// Expose a small, reviewed set of API operations to an MCP client.
// Generated from a locally pasted OpenAPI JSON document. Implement request logic and validate auth before production.

const server = new McpServer({
  name: "custom-api",
  version: "0.1.0"
});



const transport = new StdioServerTransport();
await server.connect(transport);

The server handler is intentionally a safe TODO. Add a reviewed HTTP client, parameter validation, timeout, host allowlist, and error redaction before production.

4 · Security gate

Do not ship until the boundary is explicit

0 / 8

Compatibility boundary

MCP transport and SDK notes

Generated code follows the TypeScript SDK registration shape and local stdio transport pattern. Verify the SDK version, client capability negotiation, tool annotations, structured content, and transport framing against your target client before rollout. This starter does not claim automatic compatibility with Streamable HTTP, legacy SSE, OAuth, remote deployment, or vendor-specific extensions.

当现有 marketplace server 没有覆盖你的私有数据、内部工具或团队工作流时,可以用 MCP Server 生成器创建一个小型自定义 server 起点。

会生成什么

起步输出包含 TypeScript package、stdio MCP server、一个示例 tool、mcp.json 片段和验证说明。先把它当作窄范围 MVP,再加入鉴权、持久化或写操作。

什么时候自建 Server

适合私有 API、内部文档、本地索引、产品专属流程,或需要稳定 schema 的工具。如果已有维护良好的 server 覆盖需求,优先使用现成方案。

上线检查

第一个 server 尽量保持只读,用环境变量放凭证,在仓库指令中记录命令,并在共享前从干净终端测试 mcp.json 里的完整命令。

常见问题

这和 MCP 配置生成器有什么区别?

配置生成器为已有 server 生成 mcp.json;这个页面生成可自行实现的 server 起步代码。

自定义 MCP server 应该用 stdio 还是 HTTP?

stdio 适合本地优先的简单起点。需要共享、部署或远程访问时再考虑 HTTP。

第一个 tool 应该做什么?

从一个只读工具开始,返回真正有用的上下文。写操作应等权限和审计行为清楚后再加。