skill2mcp
skill2mcp

skill2mcp 是一个 TypeScript CLI/库,它将 SKILL.md 文档转换为 MCP 就绪的工具定义,并能从单个文件或整个技能目录生成最小化的可部署 MCP 服务器包。
生成的服务器使用官方 MCP TypeScript SDK (@modelcontextprotocol/sdk),并支持 stdio、http 或 both 传输方式。
为什么选择本项目
SKILL 文档通常是半结构化的 Markdown(前置元数据 + 正文 + 表格)。MCP 工具需要严格的契约(name、description、inputSchema)。
skill2mcp 通过分层流水线弥合了这一差距:
将 Markdown 解析为稳定的中间表示 (IR)
将 IR 转换为 MCP 工具定义
生成带有处理程序存根的可部署 MCP 服务器包
Related MCP server: Skillz
当前状态
MVP 已实现并可运行:
确定性解析器 (
strict,tolerant)用于缺失元数据回退的级联语义模式 (
semantic)工具转换 (
SchemaBuilder,ToolMapper,ToolValidator)带有 MCP 风格工具 JSON 的
inspect输出带有可部署 MCP 服务器包的
build输出生成的服务器支持
stdio+http用于迭代重新生成的
build --watch
安装
要求
Node.js 20+
npm 10+
本地安装
npm install构建 CLI
npm run build快速入门
1. 解析单个 SKILL
npm run parse -- ./fixtures/skills/valid-skill.md --mode strict2. 检查生成的工具定义
npm run inspect -- ./fixtures/skills --mode tolerant3. 生成可部署的 MCP 服务器包
npm run gen -- ./fixtures/skills --out ./generated/mcp-server --transport both --mode tolerant4. 运行生成的服务器
cd ./generated/mcp-server
npm install
npm run build
npm run start:stdio
# or
npm run start:httpHTTP 端点:
POST /mcpCLI 参考
parse
将 SKILL Markdown 转换为 IR JSON。
skill2mcp parse <input> [--mode strict|tolerant|semantic]参数:
<input>:.md文件或目录的路径
选项:
--mode: 解析器模式(默认为tolerant)--format: 当前为json
输出:
results[]: 包含已解析的SkillDocumentdiagnostics[]: 每个源文件的诊断信息
inspect
将已解析的 IR 转换为类似 MCP 的工具定义。
skill2mcp inspect <input> [--mode strict|tolerant|semantic]输出:
tools[]: 生成的工具定义 (name,description,inputSchema)results[]: 每个源文件的工具 + 诊断信息
build
从一个或多个技能生成可部署的 MCP 服务器包。
skill2mcp build <input> --out <dir> [--transport stdio|http|both] [--mode strict|tolerant|semantic] [--watch]参数:
<input>:.md文件或目录的路径
必需选项:
--out: 生成包的输出目录
可选选项:
--transport: 默认生成的服务器传输方式(默认为both)--mode: 解析模式(默认为tolerant)--watch: 在源文件更改时重新生成包
输出:
生成的包文件 (
package.json,tools.json,src/server.ts, 处理程序)JSON 格式的诊断摘要
解析模式
strict
在缺少必需元数据/模式时失败
最适合 CI 质量门禁
tolerant
在缺少字段时继续并发出警告
最适合批量处理质量参差不齐的技能
semantic
从容错解析开始
尝试通过 OpenRouter(配置后)进行语义提取
对未解析的字段应用确定性回退推断
保留诊断跟踪 (
SEMANTIC_*代码)
用于 semantic 的 OpenRouter 配置
环境变量:
OPENROUTER_API_KEY: 启用远程语义提取OPENROUTER_MODEL(可选): 默认为anthropic/claude-3.5-sonnetSKILL2MCP_CACHE_DIR(可选): 覆盖缓存目录OPENROUTER_HTTP_REFERER(可选): 作为 OpenRouter 请求头转发OPENROUTER_X_TITLE(可选): 作为 OpenRouter 请求头转发
缓存行为:
语义响应按内容哈希缓存在
.skill2mcp-cache/semantic-openrouter-cache.json中如果存在缓存,语义模式将重用缓存并避免额外的远程调用
规范的 SKILL.md 格式(推荐)
---
name: docx-generator
version: 1.0.0
description: Generate Word docs from structured markdown
tags: [documents, office]
---
## Parameters
| Name | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| content | string | yes | | Markdown content |
| title | string | yes | | Document title |
## Examples
**Input:** `{ content: "# Hello", title: "Report" }`
**Output:** report.docx generated at /outputs/
## Triggers
- "generate document"
- "create report"生成的包结构
generated/mcp-server/
package.json
tsconfig.json
README.md
tools.json
src/
server.ts
generated-tools.ts
handlers/
index.ts
<tool_name>.ts开发
脚本
npm run build # compile TypeScript
npm run test # run test suite
npm run parse # parse command entry
npm run inspect # inspect command entry
npm run gen # build command entry测试套件
当前的自动化覆盖范围包括:
解析器行为 (
strict,tolerant,semantic)模式构建器和工具映射
inspect 命令输出契约
端到端构建产物生成
工程规范
遵循
AGENTS.md中的存储库协作规则产品/业务指令受
ROADMAP.md约束AI 生成的提交信息必须使用
[AI]前缀
发布产物
本仓库包含:
双重许可分发:
MIT OR Apache-2.0CHANGELOG.mdCONTRIBUTING.mdRELEASE_CHECKLIST.md
协作模型
治理和决策规则:
GOVERNANCE.md行为准则:
CODE_OF_CONDUCT.md安全报告:
SECURITY.md支持渠道:
SUPPORT.md
已知限制
参数解析目前假设
## Parameters中使用 Markdown 表格格式语义模式优先处理缺失的元数据,并在提取可用时可能丰富缺失的参数
监视模式跟踪当前树;如果稍后添加了深层嵌套文件夹,请重启监视以获得完整覆盖
路线图对齐
当前的实现遵循 ROADMAP.md 中的分阶段交付。
GenAI 集成策略(启用时)优先考虑 OpenRouter 作为默认提供商策略,如路线图指令中所定义。
许可证
根据以下任一协议许可:
MIT 许可证 (
LICENSE-MIT)Apache 许可证 2.0 (
LICENSE-APACHE)
由您选择。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceConverts AI Skills (following Claude Skills format) into MCP server resources, enabling LLM applications to discover, access, and utilize self-contained skill directories through the Model Context Protocol. Provides tools to list available skills, retrieve skill details and content, and read supporting files with security protections.327Apache 2.0
- Alicense-qualityDmaintenanceTurns Claude-style skills (SKILL.md files with resources) into callable MCP tools for any agent. Discovers skills from a directory, exposes their instructions and resources, and can execute bundled helper scripts.398MIT
- Alicense-qualityDmaintenanceTurns Claude-style skill folders into MCP tools, resources, and prompts for discovering and using skills.81MIT
- Alicense-qualityAmaintenanceExposes an agent's skills as MCP tools, allowing any MCP client to route requests and load skills on demand from a single .3md file.91MIT
Related MCP Connectors
MCP server for skill documentation, generated by doc2mcp.
Generate AGENTS.md, AP2 compliance docs, checkout rules, debug playbook & MCP configs from any repo.
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/agenttic-ai-dev/skill2mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server