Skip to main content

mcp-to-skill

将任何 MCP 服务器封装为 Claude Skill,支持 stdio/SSE/HTTP 传输协议,提供 CLI 和 Python SDK 双模式。

Features

  • ✅ 双模式支持: CLI 命令行工具 + Python SDK
  • ✅ 多传输协议: stdio/SSE/HTTP
  • ✅ uv 依赖管理: 比 pip 快 10-100 倍
  • ✅ 自动 introspect: 自动获取工具列表
  • ✅ 一键转换: 从配置到可用技能
  • ✅ 统计追踪: 工具调用统计和日志
  • ✅ 上下文节省: 96%+ 上下文节省

Installation

Python SDK (pip)

pip install mcp-to-skill

Bun CLI (本地)

# 确保已安装 uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# 使用本地 lib.ts
bun lib.ts convert my-mcp.json

Usage

Python SDK

from mcp_to_skill import (
    MCPConfig,
    SkillConfig,
    Transport,
    convert_to_skill,
    validate_skill,
    test_skill,
    get_skill_status
)

# Convert MCP server to skill
config = MCPConfig(
    name="github",
    transport=Transport.STDIO,
    command="npx",
    args=["@modelcontextprotocol/server-github"],
    env={"GITHUB_TOKEN": "your-token"}
)

skill_info = convert_to_skill(config)
print(f"Skill created at: {skill_info.path}")

# Validate skill
validation = validate_skill(skill_info.path)
print(f"Valid: {validation['valid']}")
print(f"Tools: {len(validation['tools'])}")

# Get status
status = get_skill_status(skill_info.path)
print(f"Total calls: {status['stats']['total_calls']}")

CLI

# Convert
mcp-to-skill convert my-mcp.json

# Validate
mcp-to-skill validate ~/.claude/skills/my-mcp

# Test
mcp-to-skill test ~/.claude/skills/my-mcp --mode list

# Status
mcp-to-skill status ~/.claude/skills/my-mcp

# Reset stats
mcp-to-skill reset-stats ~/.claude/skills/my-mcp

Bun CLI (本地)

# Convert
bun lib.ts convert my-mcp.json

# Validate
bun lib.ts validate ~/.claude/skills/my-mcp

# Test
bun lib.ts test ~/.claude/skills/my-mcp --list

MCP Config Format

{
  "name": "my-mcp",
  "transport": "stdio|sse|http",
  "command": "npx",  // stdio only
  "args": ["@example/mcp-server"],  // stdio only
  "endpoint": "https://...",  // sse/http only
  "env": {"API_KEY": "your-key"},
  "keep_alive": {
    "enabled": true,
    "timeout": 3600
  }
}

Examples

Example 1: GitHub MCP (stdio)

from mcp_to_skill import MCPConfig, Transport, convert_to_skill

config = MCPConfig(
    name="github",
    transport=Transport.STDIO,
    command="npx",
    args=["-y", "@modelcontextprotocol/server-github"],
    env={"GITHUB_TOKEN": "ghp_your_token"}
)

skill = convert_to_skill(config)

Example 2: DeepWiki (SSE)

from mcp_to_skill import MCPConfig, Transport, convert_to_skill

config = MCPConfig(
    name="deepwiki",
    transport=Transport.SSE,
    endpoint="https://mcp.deepwiki.com/sse"
)

skill = convert_to_skill(config)

Example 3: Enable Process Reuse

from mcp_to_skill import MCPConfig, Transport, convert_to_skill

config = MCPConfig(
    name="my-mcp",
    transport=Transport.STDIO,
    command="npx",
    args=["@example/mcp-server"],
    keep_alive={
        "enabled": True,
        "timeout": 3600,
        "check_interval": 60
    }
)

skill = convert_to_skill(config)

API Reference

MCPConfig

@dataclass
class MCPConfig:
    name: str
    transport: Transport = Transport.STDIO
    command: Optional[str] = None
    args: Optional[List[str]] = None
    endpoint: Optional[str] = None
    env: Optional[Dict[str, str]] = None
    keep_alive: Optional[Dict[str, Any]] = None

convert_to_skill()

def convert_to_skill(
    mcp_config: MCPConfig,
    skill_config: Optional[SkillConfig] = None
) -> SkillInfo

validate_skill()

def validate_skill(skill_path: str) -> Dict[str, Any]

test_skill()

def test_skill(
    skill_path: str,
    mode: Literal["list", "describe", "call"] = "list",
    tool_name: Optional[str] = None,
    arguments: Optional[Dict[str, Any]] = None
) -> Dict[str, Any]

get_skill_status()

def get_skill_status(skill_path: str) -> Dict[str, Any]

reset_skill_stats()

def reset_skill_stats(skill_path: str) -> Dict[str, Any]

Performance

Context Savings

Tools MCP Skill Saved
8 4000 tokens 150 tokens 96%
20 10000 tokens 150 tokens 98.5%

Dependency Management

Metric pip uv Improvement
Install time 10s+ <1s 10x+
Virtual env Manual Auto ✅
Resolution Slow Fast 5x+

Process Reuse

Scenario Without Reuse With Reuse Improvement
First call 5s 5s -
Subsequent calls 5s <0.5s 10x
10 calls 50s 5s 10x

Requirements

Python SDK

  • Python 3.10+
  • httpx>=0.25.0

Bun CLI

Documentation

License

MIT

Credits

Based on mcp-to-skill-converter by GBSOSS

Metadata

Release files for mcp-to-skill 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-to-skill 2.0.0
File Size Uploaded Provenance Actions
mcp_to_skill-2.0.0.tar.gz 6.2 kB Without provenance Details for mcp_to_skill-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-to-skill 2.0.0
File Interpreter ABI Platform Actions
mcp_to_skill-2.0.0-py3-none-any.whl Python 3 none any Details for mcp_to_skill-2.0.0-py3-none-any.whl

Total release size: 13.2 kB

Release files / mcp_to_skill-2.0.0.tar.gz

Download URL mcp_to_skill-2.0.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f3bb448f7cb22239e62f17a6652a1b3d7b8bac6e86191962b6b244d4cae4969f
BLAKE2b-256 checksum
How to use checksums
97170cc7415bc290b023de926fa128f76b1f846c37687923bbe990e4cadb1e16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / mcp_to_skill-2.0.0-py3-none-any.whl

Download URL mcp_to_skill-2.0.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48f429b209b14dbad9ee9448e68156d4dd6d3a2ae22acbef962db758e54accaa
BLAKE2b-256 checksum
How to use checksums
208daef1ae3d34efd9f08dae5837570c2aa3f720f0206a84b4d49e5c6b7ba608
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for mcp-to-skill 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page