MCP und CLI integrieren
Bindet Agent-Fähigkeiten über typisierte Werkzeuge, Ressourcen und kontrollierte Unterprozesse an.
mcp-cli-integration
Entdecke, wie der Skill hilftWann ist der Skill hilfreich?
Nutze diesen Skill für neue MCP-Server oder Kommandozeilenintegrationen.
Wobei hilft er dir?
- Trennt Werkzeugaktionen, adressierbare Daten und wiederverwendbare Prompts.
- Schützt Protokollausgaben und begrenzt Laufzeit, Datenmenge und Arbeitsbereich.
- Regelt Serveridentität, lokale Erreichbarkeit und Prozessbeendigung.
Das könntest du fragen
Integriere einen lokalen MCP-Server mit sauberem JSON-RPC, begrenzten Antworten und zuverlässigem Abbruch hängender Aufrufe. Brich ein absichtlich hängendes Werkzeug ab und starte den Client neu. Es bleiben keine verwaisten Prozesse; Diagnosetext beschädigt den Protokollstrom nicht.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
MCP & CLI Integration
Standardize external tool, resource, and subprocess integrations so the agent runtime interacts with third-party capabilities through clean lifecycle management, strict transport framing, and bounded security permissions.
Model Context Protocol (MCP) Architecture
MCP separates capabilities into three distinct primitives—use each for its intended purpose:
| Primitive | Direction & Purpose | Design Rules |
|---|---|---|
Tools (tools/list, tools/call) |
Model-controlled actions with typed JSON Schema inputs (inputSchema) and optional outputSchema |
Annotate with readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Return operational failures inside the result with isError: true (and structuredContent when outputSchema is defined) rather than JSON-RPC protocol errors. |
Resources (resources/list, resources/read, resources/subscribe) |
Application/context-addressed read-only data identified by URI (file://, db://, git://) |
Use resources for large files, schemas, or live logs so tools can return lightweight resource links (resource_link) instead of bloating tool outputs. |
Prompts (prompts/list, prompts/get) |
User- or workflow-invoked reusable templates with typed arguments | Keep prompt templates parameterized and versioned cleanly. |
Transport & Protocol Discipline
stdioTransport (Local Subprocess Servers):- Stdout purity: The MCP server must write only newline-delimited JSON-RPC 2.0 messages to
stdout. Anyconsole.log, library banner, or debug print onstdoutcorrupts the JSON-RPC stream immediately—route all diagnostic logging strictly tostderr. - Subprocess lifecycle: Spawn with explicit working directory (
cwd), minimal allowlisted environment variables (never dump the entire hostprocess.envif it contains unrelated secrets), and clean shutdown (stdin.end()$\rightarrow$SIGTERM$\rightarrow$ timeout $\rightarrow$SIGKILLon the process group).
- Stdout purity: The MCP server must write only newline-delimited JSON-RPC 2.0 messages to
- Streamable HTTP Transport (Remote / Shared Servers):
- Send JSON-RPC requests via
POSTto the MCP endpoint withMCP-Protocol-Version(andMcp-Session-Idwhen stateful sessions are active). - Handle both
application/jsonsingle responses andtext/event-stream(SSE) streaming responses, supporting resumption viaLast-Event-IDwhen supported by the server. - Validate
Originheaders and bind local HTTP servers exclusively to127.0.0.1(never0.0.0.0without authentication) to prevent DNS-rebinding and cross-origin local execution attacks.
- Send JSON-RPC requests via
Defensive Client & Subprocess Guardrails
- Treat third-party MCP servers as untrusted:
- Pin or verify
tools/listschemas to prevent tool poisoning and rug-pull attacks (where a server silently mutates a tool's description mid-session to inject hidden instructions or exfiltrate files). - Namespace tool names by server (
<server>__<tool>) so one server cannot shadow built-in or high-trust tools.
- Pin or verify
- Per-call timeouts and payload caps: Enforce a hard timeout (
AbortSignal.timeout(ms)) and maximum byte limit on everytools/callandresources/readrequest so a hung MCP server or runaway CLI command cannot stall the entire agent worker. - Headless CLI Agent Integration: When invoking external agent CLIs (Claude Code, Codex, Gemini CLI), run non-interactively (
stdinclosed or structured protocol), stream structured JSONL events, capture exit codes andstderrring buffers, and enforce workspace path sandboxing.
Enthaltene Dateien 1
SKILL.md
Über dieses Skill-Paket
mcp-cli-integration
mcp-cli-integration: Entwickelt KI-Agentenfunktionen mit klaren Werkzeugverträgen, kontrollierten Berechtigungen, dauerhaftem Zustand und nachvollziehbarem Modellverhalten.
Weniger anzeigen
mcp-cli-integration
mcp-cli-integration: Entwickelt KI-Agentenfunktionen mit klaren Werkzeugverträgen, kontrollierten Berechtigungen, dauerhaftem Zustand und nachvollziehbarem Modellverhalten.
Enthält den vollständigen Skill und seine Begleitdateien (1 Dateien). Der genaue, ursprünglich verfasste Anwendungsbereich bleibt unten erhalten.
Ursprüngliche Skill-Beschreibung (Quellsprache)
Use when building or integrating Model Context Protocol (MCP) servers and clients, or orchestrating headless CLI agents and subprocesses via stdio or Streamable HTTP.
Installiere den Skill, prüfe seine Quelle und Vertrauenseinstellungen und aktiviere ihn für das passende Projekt oder den Agenten.
Voraussetzungen
- Orqestria auf deinem Computer installiert.
