Skip to content
/

mcp-to-skill-converter

mcp-to-skill-converter · GBSOSS/-mcp-to-skill-converter · ★ 0

Primitive shape
No installable primitives
00

Summary

mcp-to-skill-converter — Summary

A single-file Python script (mcp_to_skill.py) that converts any MCP server configuration into a Claude Code skill package implementing the "progressive disclosure" pattern. The core claim: traditional MCP server loading puts all tool definitions into context at startup (20 tools ≈ 30k tokens always loaded), while a generated skill loads only ~100 tokens of metadata at startup, ~5k tokens when the skill fires, and 0 tokens for tool execution.

The converter introspects the MCP server to get its tool list, generates a SKILL.md with instructions for Claude, an executor.py that handles MCP protocol communication at runtime, and supporting config files. The generated skill directs Claude to identify the appropriate tool, generate a JSON call specification, and invoke the executor script — effectively converting the MCP tool-call paradigm into a subprocess invocation paradigm.

This is a single-developer proof-of-concept (GBSOSS on GitHub) with 3 files and no version history beyond the initial commit. It's explicitly inspired by the "playwright-skill" progressive disclosure pattern. Compared to seeds: closest to ccmemory (MCP-anchored toolserver) but inverts the relationship — rather than building an MCP server that replaces skills, it builds skills that wrap MCP servers. The mcp2skill framework (fenwei-dev, also in this batch) is a more polished Go implementation of the same concept.

01

Overview

mcp-to-skill-converter — Overview

Origin

Created by GBSOSS (GitHub), exact date unknown (repo has minimal commit history). A direct response to the MCP context window problem, explicitly citing playwright-skill as the inspiration for the "progressive disclosure" pattern.

Philosophy

"MCP servers are great but load all tool definitions into context at startup. With 20+ tools, that's 30-50k tokens gone before Claude does any work."

The solution philosophy: wrap MCP servers in skills that load lazily. The key architectural insight is the three-tier disclosure model:

  • Startup: ~100 tokens (just metadata — skill name and description)
  • When used: ~5k tokens (full instructions and tool list loaded into context)
  • Executing: 0 tokens (executor.py runs the MCP call externally, output only)

Token Savings Example (from README)

Before (MCP):
  20 tools = 30k tokens always loaded
  Context available: 170k / 200k = 85%

After (Skills):
  20 skills = 2k tokens metadata
  When 1 skill active: 7k tokens
  Context available: 193k / 200k = 96.5%

GitHub MCP Server Example

Metric MCP Skill Savings
Idle 8,000 tokens 100 tokens 98.75%
Active 8,000 tokens 5,000 tokens 37.5%

Scope

3 files: README.md, mcp_to_skill.py (generator), example-github-mcp.json (example config). Single author, proof-of-concept quality. The MCP introspection in the current code is marked as a "mock response for demonstration" — the actual MCP server connection is not fully implemented.

02

Architecture

mcp-to-skill-converter — Architecture

Distribution

standalone-repo — a single Python script with no packaging.

Install

# 1. Create MCP config file (example-github-mcp.json)
# 2. Run converter
python mcp_to_skill.py \
  --mcp-config github-mcp.json \
  --output-dir ./skills/github
# 3. Install generated skill dependency
cd skills/github && pip install mcp
# 4. Copy to Claude Code skills directory
cp -r . ~/.claude/skills/github

Generated Skill Structure

skills/<name>/
├── SKILL.md        # Claude instructions (generated)
├── executor.py     # MCP communication handler (generated)
├── mcp-config.json # MCP server connection config (copied)
└── package.json    # Python dependency declaration (generated)

Conversion Pipeline

Input: MCP server config JSON (command + args + env)
  ↓
MCPSkillGenerator._get_mcp_tools()   # introspect MCP server
  ↓ (currently returns mock data — NOT fully implemented)
MCPSkillGenerator._generate_skill_md()   # generate SKILL.md
MCPSkillGenerator._generate_executor()   # generate executor.py
MCPSkillGenerator._generate_config()     # copy mcp-config.json
MCPSkillGenerator._generate_package_json()
Output: Skill directory

Runtime Execution (generated executor.py)

Claude Code loads SKILL.md (~5k tokens)
  → Claude identifies tool + generates JSON call spec
  → Claude runs: python executor.py --call '{"tool": "...", "arguments": {...}}'
    → executor.py connects to MCP server via stdio
    → sends tools/call request
    → reads response
    → prints to stdout
  → Claude reads stdout output

Dependencies

  • Python with asyncio
  • mcp Python package (for generated executor.py)

Target AI Tools

  • Claude Code (skill discovery)
  • Any agent that supports skills in the same format

Limitations

The _get_mcp_tools() method is a stub returning mock data. A production use requires replacing this with actual MCP tools/list protocol exchange. The mcp2skill tool in this batch (fenwei-dev) is a working Go implementation of the same concept.

03

Components

mcp-to-skill-converter — Components

Scripts (1)

Name Purpose
mcp_to_skill.py Main converter — reads MCP config, generates skill package

Classes (in mcp_to_skill.py)

Class Purpose
MCPSkillGenerator Orchestrates skill generation from MCP config
MCPExecutor (generated) Generated class in executor.py — handles MCP protocol communication

Generated Output (per MCP server)

File Purpose
SKILL.md Claude instructions with tool list and usage patterns
executor.py Python script that starts MCP server, calls tools, returns results
mcp-config.json Copy of the input MCP server config
package.json Declares pip install mcp dependency

Commands (0)

No CLI commands shipped. Single invocation: python mcp_to_skill.py --mcp-config <file> --output-dir <dir>

CLI Arguments

Argument Required Description
--mcp-config Yes Path to MCP server configuration JSON
--output-dir Yes Output directory for generated skill

Skills (0 native, N generated)

The converter itself ships no skills. It generates skills from MCP configs.

Hooks (0)

None.

MCP Servers (0 bundled)

None bundled. The converter reads third-party MCP configs.

Templates (1)

The mcp_to_skill.py script contains embedded template strings for:

  • SKILL.md content template (with tool list, context savings table, usage pattern)
  • executor.py content template
  • package.json content template

Example Input Config

{
  "name": "github",
  "command": "npx",
  "args": ["-y", "@modelcontextprotocol/server-github"],
  "env": {"GITHUB_TOKEN": "your-token-here"}
}
05

Prompts

mcp-to-skill-converter — Prompts

Generated SKILL.md Template (verbatim from source)

Technique: Auto-generated skill instruction with tool enumeration and explicit call pattern. The generated SKILL.md teaches Claude exactly how to invoke the MCP executor.

Key section (verbatim from the generated template in mcp_to_skill.py):

## Usage Pattern

When the user's request matches this skill's capabilities:

**Step 1: Identify the right tool** from the list above

**Step 2: Generate a tool call** in this JSON format:

```json
{
  "tool": "tool_name",
  "arguments": {
    "param1": "value1",
    "param2": "value2"
  }
}

Step 3: Execute via bash:

cd $SKILL_DIR
python executor.py --call 'YOUR_JSON_HERE'

IMPORTANT: Replace $SKILL_DIR with the actual discovered path of this skill directory.


## Generated Tool Discovery Section

```markdown
## Getting Tool Details

If you need detailed information about a specific tool's parameters:

```bash
cd $SKILL_DIR
python executor.py --describe tool_name

This loads ONLY that tool's schema, not all tools.


## Prompting Technique Classification

- **Explicit procedure prescription**: Step 1/Step 2/Step 3 enumeration removes ambiguity
- **Variable substitution directive**: `$SKILL_DIR` replacement instruction prevents Claude from hardcoding paths
- **Progressive disclosure by design**: Skill loads only metadata at startup; full instructions load on demand
- **Tool enumeration without schema**: Tool names/descriptions listed, but full parameter schemas withheld until `--describe` is called — conserves tokens

## Context Savings Table in Prompt (generated)

The SKILL.md includes a per-MCP-server token comparison table auto-generated based on tool count:

```markdown
| Scenario | MCP (preload) | Skill (dynamic) |
|----------|---------------|-----------------|
| Idle | {tool_count * 500} tokens | 100 tokens |
| Active | {tool_count * 500} tokens | 5k tokens |
| Executing | {tool_count * 500} tokens | 0 tokens |
09

Uniqueness

mcp-to-skill-converter — Uniqueness

differs_from_seeds

None of the 11 seeds address MCP-to-skill conversion. ccmemory (Archetype 3 seed) is the conceptual inverse — it builds an MCP server that replaces Claude Code's native memory skills. This converter inverts that: it wraps any MCP server in a skill abstraction to get progressive disclosure. taskmaster-ai is the closest in architecture (single MCP server with many tools exposed as named primitives), but taskmaster-ai ships its own MCP server while this tool converts third-party servers.

Positioning

Proof-of-concept that has a more complete Go successor in the same batch (mcp2skill by fenwei-dev). The Python version is simpler, more readable, and more hackable; the Go version has a proper CLI with OAuth support and update detection.

Distinctive Opinion

The README makes a strong claim: "90% context savings" by converting from MCP to skills. The token math is plausible but depends heavily on the MCP server being converted. Servers with many large schemas save more; servers with few simple tools save less.

Critical Limitation

The _get_mcp_tools() method is stubbed with mock data:

# In a real implementation, this would:
# 1. Start the MCP server process
# 2. Send tools/list request
# 3. Parse the response

# Mock response for demonstration
return [{"name": "example_tool", ...}]

This means the converter does not actually introspect real MCP servers as of the analyzed commit. The generated executor.py does implement real MCP protocol calls, but the SKILL.md generation uses mock tool data.

Observable Failure Modes

  1. Mock introspection: SKILL.md generated from fake tool data, not real server
  2. No connection pooling: Each tool call spawns a fresh MCP server process — expensive for servers with slow startup
  3. No streaming: Blocking executor incompatible with long-running tools
  4. Python dependency: executor.py requires pip install mcp — not always available in skill context
  5. Path hardcoding risk: $SKILL_DIR substitution must be done by Claude — if Claude gets the path wrong, all executor calls fail

Relationship to mcp2skill

Both this converter and mcp2skill (fenwei-dev) implement the same MCP-to-skill conversion concept. mcp2skill is the production-quality Go binary with proper OAuth, update detection, and actual MCP introspection. This Python script is the proof-of-concept prototype.

04

Workflow

mcp-to-skill-converter — Workflow

Conversion Workflow

1. Create MCP config JSON for target server
2. python mcp_to_skill.py --mcp-config <file> --output-dir <dir>
3. cd <output-dir> && pip install mcp
4. cp -r <output-dir> ~/.claude/skills/<name>
5. Claude Code auto-discovers skill on next session

Generated Skill Runtime Workflow

Session Start:
  → Claude Code scans ~/.claude/skills/
  → Loads SKILL.md frontmatter (~100 tokens)

User request matches skill:
  → Full SKILL.md loaded into context (~5k tokens)
  → Claude reads available tool list
  → Claude identifies appropriate tool
  → Claude generates JSON call spec:
      {"tool": "tool_name", "arguments": {"param": "value"}}
  → Claude runs: python executor.py --call '<JSON>'
    → executor.py spawns MCP server process
    → sends MCP tools/call request
    → receives response
    → prints to stdout
  → Claude reads stdout, presents to user

Approval Gates

None. Fully automated once skill is installed.

Phase/Artifact Table

Phase Artifact
Conversion SKILL.md, executor.py, mcp-config.json, package.json
Runtime (on use) stdout from executor.py MCP call

When to Use This Converter

Recommended when:

  • You have 10+ MCP tools
  • Context space is tight
  • Most tools won't be used in each conversation
  • Tools are independent

Stick with direct MCP when:

  • You have 1-5 tools
  • Need complex OAuth flows
  • Need persistent connections
  • Cross-platform compatibility is critical
06

Memory Context

mcp-to-skill-converter — Memory & Context

Context Model

The converter's core value is a specific context model:

Load Point Tokens What's Loaded
Session start ~100 Skill frontmatter (name, description)
Skill activation ~5,000 Full SKILL.md (tool list + usage instructions)
Tool execution 0 executor.py runs externally; only stdout enters context

State

The generated executor.py is stateless. Each invocation creates a new MCP session:

executor = MCPExecutor(config)
# connect → call tool → disconnect
await executor.connect()
result = await executor.call_tool(tool_name, arguments)
await executor.close()

No session reuse. No persistent MCP connection.

Memory Type

None. Neither the converter nor the generated skill maintains any state beyond the MCP call's response.

Cross-Session Handoff

None. Each tool call is independent.

Context Compaction

Not directly addressed. The progressive disclosure pattern is a passive form of context management — by loading tool definitions lazily, the skill avoids polluting the main context with unused tool schemas.

07

Orchestration

mcp-to-skill-converter — Orchestration

Multi-Agent Pattern

None. Single Claude agent using a generated skill to call a subprocess.

Execution Mode

one-shot per tool call. Each python executor.py --call is a discrete subprocess.

Isolation

The MCP executor runs as a separate Python process. The MCP server itself runs as yet another subprocess spawned by executor.py (via StdioServerParameters). Three processes: Claude Code → executor.py → MCP server process.

Multi-Model

Not applicable.

Conversion Lossiness

The MCP-to-skill conversion introduces specific lossy tradeoffs:

MCP Capability In Generated Skill Lossiness
Tool list Enumerated in SKILL.md Low — all tools listed
Tool schemas Available via --describe only Medium — not preloaded
OAuth flows Must be in mcp-config.json env High — not abstracted
Persistent connections New connection per call High — stateless
Streaming responses Not implemented High — blocking only
Multi-step tool chains Not implemented High — one call per executor invocation

Key Architectural Concern

The executor.py uses asyncio.run(main()) which blocks until the tool call completes. There is no streaming, no cancellation, and no timeout beyond Python's default. Long-running MCP tools will block Claude Code for the full duration.

08

Ui Cli Surface

mcp-to-skill-converter — UI & CLI Surface

Dedicated CLI Binary

No. The converter is invoked as python mcp_to_skill.py.

Attribute Value
Name mcp_to_skill.py (script, not binary)
Language Python
Is thin wrapper No
Arguments --mcp-config, --output-dir

Local UI / Dashboard

None.

Observability

Prints generation progress to stdout:

Generating skill for MCP server: github
Introspecting MCP server: npx
✓ Generated: ./skills/github/SKILL.md
✓ Generated: ./skills/github/executor.py
✓ Generated: ./skills/github/mcp-config.json
✓ Generated: ./skills/github/package.json
✓ Skill generated at: ./skills/github
✓ Tools available: 1

Generated Executor CLI

The generated executor.py has its own CLI surface:

  • --call '<JSON>' — execute a tool call
  • --describe <tool_name> — get tool schema
  • --list — list all available tools

IDE Integration

Claude Code skill auto-discovery (copy to ~/.claude/skills/).

Cross-Tool Portability

Medium — generates skills compatible with any agent that supports skill discovery (Claude Code, potentially others). The executor.py is Python-based and platform-independent.

Related frameworks

same archetype · same primary tool · same memory type

BMAD-METHOD ★ 48k

Provides a full agile delivery lifecycle with named expert-persona AI collaborators that elicit the human's best thinking rather…

Agent OS ★ 4.6k

Extracts implicit codebase conventions into token-efficient markdown standards files and injects them selectively into AI agent…

Claude Conductor ★ 367

Gives Claude Code a persistent, cross-linked, auto-analyzed documentation system so it retains codebase context across sessions.

Spec-Driver (Greenfield Spec-Driven Development) ★ 25

Prevents spec rot in AI-assisted development by making implementation changes flow back into evergreen, authoritative specs via…

Anthropic Knowledge Work Plugins ★ 16k

Role-specialized plugin bundles with live MCP connectors that turn Claude into a domain expert for enterprise knowledge workers.

Codex Integration for Claude Code (skill-codex) ★ 1.3k

Single Claude Code skill that handles Codex CLI invocation correctly (stdin blocking, thinking token suppression, session resume)…