Gen

MCP开发工具

提供方 未标注

开发工具 stdio · 本地进程 未标注 社区 / 第三方 Claude DesktopClaudeCursorVS Code
查看接入方式

将你编写的 TypeScript 函数转换为 MCP 服务器;工具、资源和提示的架构会从你的类型和 JSDoc 中自动推断。无需架构库、装饰器或样板代码。

一句话选型结论

按资料字段整理

Gen 属于开发工具类 MCP 服务器,stdio · 本地进程,鉴权方式未标注,可直接接入 Claude Desktop、Claude、Cursor 等,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类开发工具 传输方式stdio · 本地进程 鉴权未标注 部署方式本地部署
GitHub 星标 未标注 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

开发工具
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

开发

安装与配置

stdio · 本地进程 未标注
客户端在本机拉起子进程,数据不出本机
npx

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js 等运行时,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
代码与仓库操作

在对话里直接查代码、提 issue、走 PR,省掉来回切工具。

本地命令与脚本

把构建、测试、格式化这类重复命令交给模型执行。

接口联调与测试

让模型调你的接口、跑一遍用例,快速定位问题。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude Desktop、Claude、Cursor,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在开发工具场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Gen当前 未标注 stdio · 本地进程 本地部署 有 未标注
Git 838e2ec1 12 stdio · 本地进程 本地部署 有 2026-05-17
Markitdown MCP 2c653a5f 1 stdio · 本地进程 本地部署 有 2026-05-17
JavaGuide 未标注 stdio · 本地进程 本地部署 有 2026-04-11
awesome-claude-skills 未标注 stdio · 本地进程 本地部署 有 2026-04-26
Context7 831acf40 未标注 stdio · 本地进程 本地部署 有 2026-05-17

服务器档案

开发工具
字段来自项目仓库与公开索引,中文说明由本站标注
提供方未标注上游标注的维护方 未标注
分类开发工具本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式未标注远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验未标注上游最后核验时间

详细介绍

13.5 KB
来自项目仓库与上游目录的原文,未做删改

mcp-gen

> Turn your typed TypeScript functions into an MCP server. No schema library, no decorators, no boilerplate — the schema is inferred from your types.

mcp-gen reads exported TypeScript functions and generates Model Context Protocol tool, resource, and prompt definitions from them — using the TypeScript type checker (via ts-morph) to turn each parameter type into a JSON Schema and each JSDoc comment into a description. It can emit the schemas as JSON, serve a live MCP server, or open a live playground where you call your tools in a browser while you edit.

If your functions are typed, they're already MCP tools.


Quick start

Write plain, typed functions with ordinary JSDoc:```ts
// tools.ts

/*
* Greets a person by name and age.
* @param name - The person's name
* @param age - The person's age in years
/
export function greet(name: string, age: number): string {
return Hello ${name}, age ${age};
}

/*
* Echoes a message back after a tick.
* @param msg - The message to echo back
/
export async function slowEcho(msg: string): Promise<string> {
return echo: ${msg};
}


Generate the tool schemas:```bash
mcp-gen tools.ts
``````jsonc
{
  &quot;tools&quot;: [
    {
      &quot;name&quot;: &quot;greet&quot;,
      &quot;description&quot;: &quot;Greets a person by name and age.&quot;,
      &quot;inputSchema&quot;: {
        &quot;type&quot;: &quot;object&quot;,
        &quot;properties&quot;: {
          &quot;name&quot;: { &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;The person&#x27;s name&quot; },
          &quot;age&quot;:  { &quot;type&quot;: &quot;number&quot;, &quot;description&quot;: &quot;The person&#x27;s age in years&quot; }
        },
        &quot;required&quot;: [&quot;name&quot;, &quot;age&quot;]
      }
    }
    // ... slowEcho
  ]
}

The fastest way to actually try them — the live playground. It watches your file, renders an input form for each tool from the inferred schema, and runs it right in your browser while you edit:```bash
mcp-gen dev tools.ts # then open the printed http://127.0.0.1:4000/ URL


Or run it as a real MCP server:```bash
mcp-gen serve tools.ts --port 3000

serve binds 127.0.0.1 (loopback) by default — it executes your local code when its tools are called, so it isn't reachable off-machine unless you ask. To expose it on the network, opt in explicitly with --host (e.g. mcp-gen serve tools.ts --host 0.0.0.0); doing so prints a warning, since the endpoint is then reachable by other machines.

Before exposing it, turn on bearer-token authentication. Configure one or more keys with --api-key (repeatable) or the comma-separated MCP_GEN_API_KEYS environment variable — if any key is set, auth is on and every request to /mcp must carry Authorization: Bearer (a missing, malformed, or wrong key is rejected with 401 before any tool runs). With no keys set, auth is off and behavior is unchanged. When auth is on, the off-machine "no authentication" warning is replaced by a one-line confirmation that a token is required. See Deploying to production.

That's it. The parameter names, types, required-ness, and descriptions all come from the code you already wrote.

How it works

  • Types become schemas. Each exported function's parameters are converted to a JSON Schema inputSchema by the TypeScript type checker. Optional params (age?: number) are omitted from required; return types are captured (and Promise is unwrapped).
  • JSDoc becomes documentation. The function's summary becomes the tool description; each @param becomes that property's description.
  • Fail-loud, never fail-silent. A function that can't be converted to a valid schema — for example an unbound generic in input position (identity(value: T)) — is excluded and reported, never emitted as something broken. Clean functions are still generated; the exit code tells you if any failed (see below).

What it handles

It's built to work on real codebases, not just single-file toys:

  • generics (constrained and unbound), and a clear error on the ones that can't be represented
  • types imported from other modules and re-exported under aliases
  • multiple export styles (named, default, aliased)
  • tsconfig.json discovery and path-alias resolution
  • detection of non-serializable types (instead of emitting invalid schema)
  • async functions (awaited return types); a throwing tool returns isError rather than taking the server down

Resources & prompts

MCP servers can expose three kinds of things — tools (actions), resources (data), and prompts (reusable templates). mcp-gen infers all three from the same typed exports; a single JSDoc tag picks which one. An untagged function is a tool, exactly as before — nothing changes for existing code.

Resources — @resource

Tag a function with @resource and a URI. If the URI has {placeholders} that match parameter names, it becomes a resource template (the params validate the URL); with no placeholders it's a static resource. The return value is the content — a string is served as text/plain, anything else as application/json. Add @mime to override.``ts /** * Read a user record by id. * @resource users://{id} — templated: {id} matches theidparam * @param id - The user id */ export function getUser(id: string): { id: string; name: string } { return { id, name:User ${id}` };
}

/*
* The current app configuration.
* @resource config://app — static: no placeholders
/
export function appConfig() {
return { theme: "dark", version: "1.1.0" };
}

/*
* @resource info://build
* @mime text/plain — override the content type
/
export function buildInfo(): string {
return "mcp-gen build 1.1.0";
}


### Prompts — `@prompt`

Tag a function with `@prompt`. Its parameters become the prompt&#x27;s arguments (names and descriptions from `@param`). Return a **string** for a single user message, or an array of `{ role, content }` messages to pass them through as-is.```ts
/**
 * A code-review prompt.
 * @prompt
 * @param language - The programming language
 * @param code - The code to review
 */
export function reviewPrompt(language: string, code: string): string {
  return `Please review this ${language} code:\n\n${code}`;
}

Run mcp-gen serve and a connected MCP client can list and read your resources and get your prompts, alongside calling tools. Resources and prompts go through the exact same path as tools — same type inference, same validation, same execution — and the same fail-loud rule applies: e.g. a @resource template whose {var} doesn't match a parameter is excluded and reported, never half-registered.

CLI```

mcp-gen <file.ts> [--debug] [--tsconfig <path>] Generate tool schemas as JSON (stdout)
mcp-gen serve <file.ts> [--port N] [--host <addr>] [--api-key <key>]... [--tsconfig <path>] Start a live MCP server (default port 3000; binds 127.0.0.1; PORT/HOST env honored)
mcp-gen dev <file.ts> [--port N] [--tsconfig <path>] Live playground UI, watches + reloads (default port 4000)
mcp-gen check <file.ts> [--update] [--snapshot <path>] [--tsconfig <path>] Guard the tool surface against breaking changes (CI)


Generation writes machine-readable JSON to **stdout** (always includes `tools`; includes `errors`/`warnings` when present); human-readable messages go to **stderr**. Exit codes:

| Code | Meaning |
|---|---|
| `0` | every exported function converted cleanly |
| `1` | one or more functions failed — clean ones are still emitted, failures listed in `errors` |
| `2` | file-level failure (not found / unparseable / nothing servable) |

### Deploying to production

To run `serve` as a network-reachable MCP server, bind a public interface **and** require a bearer token. Pass the keys through the environment (not `--api-key`) so the secret never lands in shell history or a process listing:```bash
# one or more comma-separated keys; every caller must send `Authorization: Bearer &lt;key&gt;`
MCP_GEN_API_KEYS=&quot;$(openssl rand -hex 32)&quot; mcp-gen serve tools.ts --host 0.0.0.0
  • Keys via env in prod, not the CLI. --api-key is convenient for local testing, but a flag is visible to anyone who can list processes (ps); MCP_GEN_API_KEYS keeps the secret out of argv. Both sources are unioned, comma-split, and trimmed, and any non-empty key turns auth on.
  • PORT / HOST are honored. When you omit --port / --host, serve falls back to the PORT and HOST environment variables before its defaults (3000 / 127.0.0.1) — so it drops straight into a platform that injects PORT. An explicit --port / --host flag always overrides the env var.
  • Auth is fail-closed. With keys configured, a request to /mcp carrying a missing, malformed, or non-matching token is rejected with 401 {&quot;error&quot;:&quot;unauthorized&quot;} before the MCP transport — so no tool, resource, or prompt code runs. Keys are compared in constant time.
  • No keys = exposed and unauthenticated. Bind a non-loopback --host (or HOST) without any key configured and serve keeps printing the loud exposure warning. Configure a key to gate the endpoint (and silence the warning).

On a platform that injects PORT (and optionally HOST), you supply only the keys:```bash
MCP_GEN_API_KEYS="key-a,key-b" mcp-gen serve tools.ts --host 0.0.0.0 # PORT taken from the environment


### Guarding the contract — `check`

`check` is **`tsc` for your tool surface**: it snapshots the generated tools to a committed file and, on later runs, fails the build on **breaking** changes — so an agent-facing tool can&#x27;t silently change shape under its callers.```bash
mcp-gen check tools.ts --update      # write the baseline (the `jest -u` of tool contracts) — commit it
mcp-gen check tools.ts               # in CI: fail if the surface broke

Breaking changes (exit 1) are judged from the perspective of an existing caller: a tool removed or renamed, a property removed, a new required parameter, an optional param made required, a type change, an enum value removed, or any other narrowing of a nested sub-schema. Purely additive or loosening changes — a new tool, a new optional param, a relaxed requirement, a new enum value — are safe and never fail. Description and return-type changes are reported as notices.

Code Meaning
0 no breaking changes (or a successful --update)
1 at least one breaking change — named on stderr, full change list as JSON on stdout
2 file-level failure, bad usage, or a missing snapshot (never silently created — prints how to create a baseline)

The snapshot is deterministically normalized (tools and keys sorted, stable formatting), so it stays byte-stable and reviews cleanly in a PR. Defaults to .mcp-snapshot.json; override with --snapshot.

Live playground — dev

dev is a type-aware playground for the server a file defines. It watches the file, regenerates the tool surface on every save, and serves a tiny localhost web UI:```bash
mcp-gen dev tools.ts # then open the printed URL, e.g. http://127.0.0.1:4000/


Open the printed URL in a browser. For each tool it renders an input form from the inferred schema (string → text, number → number, boolean → checkbox, enum → dropdown, arrays/objects → a raw-JSON box), runs the tool on demand, and shows the **result**, the **generated `inputSchema`**, and the **raw JSON-RPC** request/response — the inspector view. Fail-loud excluded functions are listed greyed out with their reasons. Save the file and the page reloads itself, preserving what you&#x27;d typed.

Crucially, the playground runs each tool through the **exact same path** as `mcp-gen serve` — the same module loader and the same named→positional dispatch — so what you see in the browser is what the served server does. It binds `127.0.0.1` only (it executes your local code on request, so it is never exposed off-machine), defaults to port `4000`, and follows the same exit-code discipline as `serve`.

&gt; **Commit the `*.mcp-snapshot.json` file** — it&#x27;s the baseline every later `check` compares against, not build output. Don&#x27;t add it to `.gitignore`; check it in alongside your code so a PR&#x27;s diff shows exactly how the tool surface changed.

## Install```bash
npm install -g @zodromon/mcp-gen

The package is scoped (@zodromon/mcp-gen), but the command you run is just mcp-gen:```bash
mcp-gen tools.ts


Or run it without installing, via `npx`:```bash
npx @zodromon/mcp-gen tools.ts

From source (to develop or contribute):```bash
git clone https://github.com/zodromon/mcp-gen && cd mcp-gen
npm install
npm run build # → dist/
node dist/generate-mcp-schemas.js tools.ts


During development you can run it directly without building:```bash
npm run generate -- tools.ts        # via tsx

Requires Node.js. Dependencies: @modelcontextprotocol/sdk, ts-morph, typescript, jiti.

Scope, honestly

Good for: quickly exposing existing typed functions as MCP tools — internal tools, prototypes, anything where you'd rather not hand-write tool schemas.

Not trying to be the biggest MCP framework. It does one thing. If you want decorators, a plugin system, or a managed platform, other good tools fit better:

  • FastMCP — mature and popular; you declare params via a schema library (Zod/ArkType/Valibot).
  • simply-mcp-ts — decorator / functional / programmatic APIs.
  • The official MCP SDK — maximal control, more boilerplate.

mcp-gen's only real difference is taste: nothing is added to your functions — no schema library, no annotations beyond the JSDoc you'd write anyway. If that appeals, use it. If not, the others are great.

License

MIT. Free to use, fork, or ignore.

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
Gen 怎么安装?

在客户端按下面的安装命令接入:npx。装完在客户端配置里引用同一个包或端点。

Gen 怎么在 Claude Desktop、Claude、Cursor 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Gen 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Gen 需要 API Key 吗?

资料没有标注鉴权方式,是否需要密钥取决于服务本身,接入前按官方文档确认。

Gen 支持哪些客户端?

资料标注支持 Claude Desktop、Claude、Cursor、VS Code、Codex、Zed;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Gen 能提供哪些能力?

资料显示能力标签包括 开发。具体工具清单以官方文档为准。

Gen 需要什么运行环境?

属于本地进程,需要在本机装好运行环境。

Gen 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 未标注。