Token导航 LogoToken导航TokenDH.com
MCP To Typescript Codegen logo
开发工具stdio官方级别未说明来源级核验

MCP To Typescript Codegen

MCP Server

mcp-to-typescript-codegen

从MCP(Model Context Protocol)服务器生成TypeScript类型的工具,适用于需要类型安全的前端和后端开发场景。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
代码生成开发工具JavaScript类型安全TypeScript

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

shawngustaw

提供方

shawngustaw

最后核验

2026/5/17 20:19

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx mcp-to-typescript-codegen --command "your-mcp-server"

详细介绍

mcp到打字代码生成器

从MCP(模型上下文协议)服务器生成TypeScript类型。

安装

npm install -g mcp-to-typescript-codegen

或者与npx一起使用:

npx mcp-to-typescript-codegen --command "your-mcp-server"

用法

标准传输(本地服务器)

# Basic usage
mcp-to-typescript-codegen --command "mcp-server"

# With arguments
mcp-to-typescript-codegen --command "npx" --args "@modelcontextprotocol/server-filesystem,/tmp"

# Custom output file
mcp-to-typescript-codegen --command "mcp-server" --output "./types/mcp.ts"

# With namespace prefix (for multiple servers)
mcp-to-typescript-codegen --command "apollo-mcp" --name Apollo --output "./types/apollo.ts"

HTTP传输(远程服务器)

mcp-to-typescript-codegen --server "http://localhost:3000/mcp"

选项

标志简短描述
--command -c生成MCP服务器的命令(stdio传输)
--args -a命令的逗号分隔参数
--server -sHTTP MCP服务器的URL(可流式传输HTTP)
--output -o输出文件路径(默认: generated/mcp-tools.ts)
`--name
`-n生成的类型名称的前缀(例如“Apollo”)
--debug-d从服务器打印原始工具架构
--help-h显示帮助

生成的输出

// Auto-generated by mcp-to-typescript-codegen
// Do not edit manually

export type ReadFileParams = {
  path: string;
};

export type ListDirectoryParams = {
  path: string;
};

export type ToolName = "read_file" | "list_directory";

export const toolNames = ["read_file", "list_directory"] as const;

随着 --name Apollo:

export type ApolloExecuteParams = {
  query: string;
  variables?: string;
};

export type ApolloToolName = "execute" | "introspect";

export const apolloToolNames = ["execute", "introspect"] as const;

使用生成的类型

import { ReadFileParams, ToolName } from "./generated/mcp-tools";

// Type-safe params
const params: ReadFileParams = {
  path: "/etc/hosts",
};

// Type-safe tool name
const toolName: ToolName = "read_file";

多个MCP服务器

为具有不同前缀的多个服务器生成类型:

# Apollo GraphQL MCP
mcp-to-typescript-codegen -c "apollo-mcp" -n Apollo -o "./types/apollo.ts"

# Filesystem MCP
mcp-to-typescript-codegen -c "npx" -a "@modelcontextprotocol/server-filesystem,/tmp" -n Filesystem -o "./types/filesystem.ts"

然后导入每个:

import { ApolloExecuteParams, ApolloToolName } from "./types/apollo";
import { FilesystemReadFileParams, FilesystemToolName } from "./types/filesystem";

许可证

麻省理工学院

目录标签

目录标签

代码生成开发工具JavaScript类型安全TypeScript本地部署MCP协议

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

mcp-to-typescript-codegen

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP