mcp2cli löst ein echtes Problem: MCP (Model Context Protocol) Schemas sind hundertfach aufgeblähter als nötig. Ein einfaches GitHub API braucht normalerweise 15-25 KB pro Turn. Mit mcp2cli: 150-200 Bytes.
Das Token-Problem
Natives MCP (Standard)
Wenn du ein MCP Server hinzufügst, injiziert Claude jedes Mal:
{
"type": "resource",
"uri": "github://repositories",
"description": "GitHub Repository Management",
"mimeType": "application/json",
"contents": "[MASSIVE SCHEMA] ~18KB",
"capabilities": [
"list",
"get",
"create",
"update",
"delete"
],
"tools": [
{
"name": "github_list_repos",
"description": "...",
"inputSchema": {
"type": "object",
"properties": {...},
"required": [...]
}
},
{...more tools...}
]
}
Pro Turn: 15-25 KB für jede einzige Nachricht.
Mit 10 Tools: ~250 KB nur für Schema-Definition. Das ist teuer und langsam.
Mit mcp2cli
/github list-repos --owner=anthropics --limit=10
Claude sieht nur:
Available command: github list-repos
Parameters: --owner (string, required), --limit (number, optional, max 100)
Pro Turn: 200-400 Bytes.
Token-Ersparnis: 96-99%.
Installation
Option 1: Python Package
pip install mcp2cli
Option 2: Als Claude Code Plugin
# GitHub Variante von myeolinmalchi
claude plugin add github:myeolinmalchi/mcp2cli
# Dann sofort im Workflow verfügbar
/mcp2cli "GitHub list repos"
Option 3: Docker
docker run -p 5000:5000 knowsuchagency/mcp2cli:latest
Drei Betriebsmodi
Modus 1: MCP → CLI
Original MCP Server wird zu CLI-Interface.
Input: MCP Server mit 50+ Tools Output: CLI mit Autocomplete-Befehlen Token-Reduktion: ~97%
Beispiel:
# Starte mcp2cli mit GitHub MCP
mcp2cli serve --mcp-url http://localhost:5678/github
# Dann in Claude Code:
/github list-repos --org anthropics --sort stars
/github create-issue --title "Bug in foo" --body "Details"
Modus 2: OpenAPI → CLI
OpenAPI Specs direkt zu CLI konvertieren.
Input: OpenAPI Spec (z.B. von swagger.io) Output: CLI mit vollständiger Tool-Dokumentation
Beispiel:
mcp2cli convert openapi \
https://api.github.com/repos/anthropics/claude-code/openapi.json \
--output github-cli.json
Modus 3: GraphQL → CLI
GraphQL-Server zu CLI.
mcp2cli convert graphql \
https://api.github.com/graphql \
--auth-token $GITHUB_TOKEN
Baking Configs — Credentials speichern
Problem: Credentials bei jedem Call?
/mcp2cli --auth-token $GITHUB_TOKEN "list repos"
/mcp2cli --auth-token $GITHUB_TOKEN "create issue" # wieder?
Lösung: Baking Config
# Config erstellen
mcp2cli bake-config github \
--auth-token $GITHUB_TOKEN \
--base-url https://api.github.com \
--output ~/.mcp2cli/github-config.json
# Dann nur noch:
/github list-repos
Konfiguration speichern
~/.mcp2cli/config.json:
{
"mcp_servers": [
{
"name": "github",
"type": "mcp",
"url": "http://localhost:5678",
"auth": {
"type": "bearer",
"token": "${GITHUB_TOKEN}"
}
},
{
"name": "stripe",
"type": "openapi",
"url": "https://api.stripe.com/openapi.json",
"auth": {
"type": "api_key",
"key": "${STRIPE_API_KEY}"
}
}
]
}
Dann automatisch geladen.
OAuth 2.1 Integration
Für Services die OAuth brauchen (GitHub, Google, Stripe):
# Interaktiver Setup
mcp2cli auth setup github
# Fragt nach:
# 1. Client ID
# 2. Client Secret
# 3. Autorisiert im Browser
# 4. Speichert Token sicher
# Dann nutzen:
/github list-repos
Wie wird Token gespeichert?
Sicher in ~/.mcp2cli/credentials/:
ls -la ~/.mcp2cli/credentials/
# github-oauth.enc
# stripe-api-key.enc
# (alles verschlüsselt)
Tool-Filterung — Performance Tuning
Problem: 50+ Tools, brauchst du nur 3
Native MCP injiziert alle 50 Tools bei jeder Nachricht.
Lösung: --tools Flag
mcp2cli serve \
--mcp-url http://localhost:5678 \
--tools "list_repos,create_issue,get_user"
Nur diese 3 werden Claude zur Verfügung gestellt.
Token-Ersparnis zusätzliche 70-80% (vs. alle 50).
Dynamische Tool-Filterung
# Für GitHub: nur "read" Operations
mcp2cli serve \
--mcp-url github \
--tools-filter "operation:read"
# Nur ein bestimmtes Team
mcp2cli serve \
--mcp-url github \
--filter "scope:team-engineering"
Praktische Beispiele
Beispiel 1: GitHub Workflow Integration
# mcp2cli mit GitHub MCP starten
mcp2cli serve \
--mcp-url http://localhost:5678/github \
--tools "list_repos,get_repo,create_pr,get_issue"
# In Claude Code dann:
/github list_repos --org mycompany --type private
# → "Found 47 private repos"
/github get_repo mycompany/platform
# → Repository details...
/github create_pr \
--repo platform \
--title "Feature: Add CLI support" \
--branch feature/cli
Beispiel 2: Stripe Payment API
mcp2cli convert openapi \
https://files.readme.io/6d6f58c-openapi.json \
--name stripe \
--auth-token $STRIPE_API_KEY
# Dann in Claude Code:
/stripe create_customer \
--email [email protected] \
--name "John Doe"
/stripe create_payment_intent \
--amount 2999 \
--currency usd \
--customer {customer_id}
Beispiel 3: Multi-Service Setup
{
"services": [
{
"name": "github",
"mcp_url": "http://localhost:5678/github",
"tools": "read_*,list_*"
},
{
"name": "slack",
"openapi_url": "https://slack.com/api/openapi.json",
"tools": "chat_postMessage,conversations_list"
},
{
"name": "postgres",
"mcp_url": "postgresql://localhost:5432/mydb",
"tools": "query,execute,describe_table"
}
]
}
Token-Reduktion in der Praxis
Szenario: GitHub + Stripe Integration
Native MCP:
- GitHub MCP: 18 KB/Turn × 15 Tools
- Stripe OpenAPI: 22 KB/Turn × 30 Tools
- Pro Turn: ~40 KB nur Schemas
Mit 100 Turns in einer Session: 4 MB nur für Tool-Definitionen.
Kosten bei $0.003/1K Input-Tokens:
- Rohes MCP: ~$0.012 pro 100-Turn Session
- Mit mcp2cli (filtered): ~$0.0005 pro Session
24× günstiger.
Geschwindigkeit:
- Rohes MCP: ~800ms Processing pro Turn (wegen großer Schemas)
- Mit mcp2cli: ~50ms Processing pro Turn
16× schneller.
Token-Vergleich Tabelle
| Szenario | Rohes MCP | Mit mcp2cli | Reduktion |
|---|---|---|---|
| GitHub (15 Tools) | 18 KB | 200 B | 99% |
| Stripe (30 Tools) | 22 KB | 350 B | 98% |
| PostgreSQL (50 Queries) | 35 KB | 400 B | 99% |
| Multi-Service (3×50 Tools) | 120 KB | 900 B | 99% |
Installation & Setup Quick Start
Schritt 1: mcp2cli installieren
pip install mcp2cli
# oder als Plugin
claude plugin add github:myeolinmalchi/mcp2cli
Schritt 2: MCP Server starten
# Beispiel mit GitHub MCP
mcp2cli serve \
--mcp-url http://localhost:5678 \
--tools "list_repos,create_issue"
Schritt 3: In Claude Code nutzen
/mcp2cli "List all my repositories"
/mcp2cli "Create an issue titled 'Bug: xyz'"
Schritt 4: Credentials speichern
mcp2cli bake-config github \
--auth-token $GITHUB_TOKEN
Schritt 5: Test & Go
# Test die Verbindung
mcp2cli health-check
# Sollte zurückgeben:
# ✓ GitHub MCP: Connected
# ✓ Token: Valid
# ✓ Rate limit: 5000 remaining
mcp2cli vs Native MCP
| Aspekt | Native MCP | mcp2cli |
|---|---|---|
| Token-Größe | 15-25 KB | 200-400 B |
| Token-Reduktion | — | 96-99% |
| Geschwindigkeit | ~800ms | ~50ms |
| Setup-Komplexität | Mittel | Einfach |
| Fehlerbehandlung | Automatisch | Manuell konfiguriert |
| OAuth Support | Begrenzt | Vollständig |
| Tool-Filterung | Nein | Ja |
| Credentials-Management | Ad-hoc | Vorkonfiguriert |
| Beste Für | Simple APIs | Production, Scale |
Häufige Probleme
Problem 1: "No tools found"
Ursache: mcp2cli kann Server nicht erreichen
Lösung:
# Debugging
mcp2cli debug --mcp-url http://localhost:5678
# Oder:
curl http://localhost:5678/health
Problem 2: Token ungültig
Ursache: OAuth Token abgelaufen
Lösung:
mcp2cli auth refresh github
# Oder komplett neu
mcp2cli auth setup github
Problem 3: Tool nicht sichtbar
Ursache: Tool ist gefiltert
Lösung:
# Aktuell verfügbare Tools anzeigen
mcp2cli list-tools
# Alle Tools inklusive zukommen
mcp2cli serve \
--mcp-url http://localhost:5678 \
--show-all-tools
Performance-Best-Practices
- Filter Tools aggressiv: Nur Tools nutzen die du brauchst
- Bake Credentials: Nicht bei jedem Call neu authentifizieren
- Multi-Service Setup: Alle APIs zentral konfigurieren
- Rate Limiting:
--rate-limit 100/minsetzen - Monitoring:
mcp2cli monitorim Hintergrund
