← AI-automatizálás és költségkontroll adatlapja

Skill · 1.0.0 verzió

MCP és CLI-integráció

Típusos eszközökkel, erőforrásokkal és szabályozott alfolyamatokkal kapcsol képességeket az agentfuttatáshoz.

mcp-cli-integration

Ezt a skillt használó csapattagok

Nézd meg, miben segít

Mikor hasznos?

Akkor használd, ha MCP-szervert vagy parancssori integrációt adsz a rendszerhez.

Miben segít neked?

  • Elválasztja a műveleti eszközt, címezhető adatot és újrahasználható promptot.
  • Védi a protokollkimenetet, korlátozza az időt, méretet és munkatér-hozzáférést.
  • Kezeli a szerverazonosságot, helyi elérhetőséget és folyamatleállítást.

Például ezt kérheted

Integrálj helyi MCP-szervert tiszta JSON-RPC-kimenettel és elakadt eszközhívás megbízható megszakításával. Szándékosan elakadt eszközt szakíts meg, majd indítsd újra a klienst. Ne maradjon árva folyamat, a diagnosztika pedig ne sértse a protokollfolyamot.

Részletes dokumentáció

Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.

Részletek…Összecsukás

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

  1. stdio Transport (Local Subprocess Servers):
    • Stdout purity: The MCP server must write only newline-delimited JSON-RPC 2.0 messages to stdout. Any console.log, library banner, or debug print on stdout corrupts the JSON-RPC stream immediately—route all diagnostic logging strictly to stderr.
    • Subprocess lifecycle: Spawn with explicit working directory (cwd), minimal allowlisted environment variables (never dump the entire host process.env if it contains unrelated secrets), and clean shutdown (stdin.end() $\rightarrow$ SIGTERM $\rightarrow$ timeout $\rightarrow$ SIGKILL on the process group).
  2. Streamable HTTP Transport (Remote / Shared Servers):
    • Send JSON-RPC requests via POST to the MCP endpoint with MCP-Protocol-Version (and Mcp-Session-Id when stateful sessions are active).
    • Handle both application/json single responses and text/event-stream (SSE) streaming responses, supporting resumption via Last-Event-ID when supported by the server.
    • Validate Origin headers and bind local HTTP servers exclusively to 127.0.0.1 (never 0.0.0.0 without authentication) to prevent DNS-rebinding and cross-origin local execution attacks.

Defensive Client & Subprocess Guardrails

  • Treat third-party MCP servers as untrusted:
    • Pin or verify tools/list schemas 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.
  • Per-call timeouts and payload caps: Enforce a hard timeout (AbortSignal.timeout(ms)) and maximum byte limit on every tools/call and resources/read request 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 (stdin closed or structured protocol), stream structured JSONL events, capture exit codes and stderr ring buffers, and enforce workspace path sandboxing.

Csomagban lévő fájlok 1

  • SKILL.md