Logo di Mcp Gateway Two Meta Tools

Mcp Gateway Two Meta Tools

Community
AnthonyAlcaraz
mcp-gateway-two-meta-tools

Build a gateway that exposes any-size tool registry through just two meta-tools: search(query) and execute(tool_name, **params). Tool descriptions stay outside the prompt entirely — the agent's prompt cost is constant regardless of registry size. Use when you need per-tenant tool segmentation, per-agent access policies, or are scaling to hundreds-of-tools where even top-k injection (rag-mcp- tool-selection) bloats prompts. NOT for cases under 30 tools where RAG-MCP top-K injection is simpler. NOT a security layer on its own — bring an IAM/RBAC source-of-truth for the access_filter.

Panoramica

Pubblicato daAnthonyAlcaraz
Repositoryagentic-graph-rag-skills
Nome della skillmcp-gateway-two-meta-tools
Stelle
29
Fork
9
File inclusi
2
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 2

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da AnthonyAlcaraz su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Mcp Gateway Two Meta Tools in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/tool-orchestration/mcp-gateway-two-meta-tools
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/tool-orchestration/mcp-gateway-two-meta-tools .claude/skills/mcp-gateway-two-meta-tools
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Mcp Gateway Two Meta Tools in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Mcp Gateway Two Meta Tools non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Mcp Gateway Two Meta Tools non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

MCP Gateway — Two-Meta-Tool Architecture

Overview

Writer's production enterprise MCP gateway pattern. RAG-MCP retrieves top-K tools and injects descriptions into the prompt. The Gateway pattern keeps descriptions entirely outside the prompt — the agent sees exactly two tools regardless of how many the gateway manages.

Agent ─── search(query)   ───▶ [tool_name_1, tool_name_2, ...]
       └── execute(name)  ───▶ {tool, params, result}

The book cites Writer running this at "hundreds of connectors and thousands of possible tool calls" without prompt bloat. Phil Fersht's research (HFS / Cognizant) found 73% of organizations deploying agentic AI run multi-agent systems averaging 12 agents per system, with governance frameworks failing once the count exceeds five. The gateway is the enforcement point where tool access policies scale with agent proliferation.

When to Use

  • Tool registry exceeds ~30 tools and even RAG-MCP top-K injection bloats
  • Multi-tenant agents where each customer should see only their tools
  • Per-agent access policies (CS agent sees CRM, finance agent sees reports)
  • Compliance domains where the prompt must not name unauthorized tools
  • Migrating from individual MCP servers to one gateway endpoint

When NOT to Use

  • Tool registry has fewer than 30 tools — use rag-mcp-tool-selection instead
  • One-off scripts with hardcoded tool flow
  • As the only security layer — gateway is enforcement, IAM/RBAC is source-of-truth
  • For multi-tool workflow planning — see Baidu COLT (Ch6) for tool-graph retrieval

Process

StepInputActionOutputVerification
1Tool registry JSONGateway.from_registry_file(path)Gateway instancelen(gateway.registry) > 0
2(Optional) Role-based access policyGateway(registry=..., access_filter=fn) or example_access_filter_devopsGateway scoped to one rolelen(gateway._visible()) < len(gateway.registry) for restricted roles
3Backend bindings (boto3 / HTTP / MCP forward)gateway.register_executor("tool_name", fn) per toolWired gatewayEach execute call returns real backend results, not dry-run
4User querygateway.search(query, top_k=5)List of {name, score} — descriptions NOT includedResult is JSON-serializable; no tool descriptions leaked
5Selected tool name + parametersgateway.execute(tool_name, **params){tool, params, result}Access filter raises PermissionError for out-of-scope tools
6Constant-prompt budget checkgateway.agent_prompt(query)Prompt stringlen(prompt) does NOT scale with registry size

Rationalizations

Agent rationalizationDocumented rebuttal
"RAG-MCP top-K injection is good enough."True at 30-100 tools. Falls over at thousands per the chapter's Writer / HFS anchors. Gateway is the next architectural step, not a competing option.
"The agent needs to see descriptions to decide."The agent calls search first, gets ranked names, then can inspect one via a discovery tool if needed. Net cost is two round-trips for ambiguous cases vs one bloated prompt always.
"Access policies should live in the agent's system prompt."System-prompt rules degrade under adversarial input (the chapter cites IBM AI Engineer talk + Microsoft Core AI Platform research). Gateway-enforced policies are mechanical, not prompted.
"Per-tenant separation isn't worth the complexity."At scale every multi-tenant SaaS hits this — see Writer's anchor. Defer at small scale, but design the gateway so the access_filter seam exists from day one.

Red Flags

  • Gateway.search returns full tool descriptions — leakage breaks the constant-prompt invariant
  • execute succeeds for tools that access_filter should have rejected — IAM/gateway-policy mismatch
  • Agent prompt grows with registry size — gateway is being bypassed somewhere
  • One tool wins every search call — index has degenerate semantic-hooks; fix the registry, not the retriever

Non-Negotiable Verification

  1. Constant-prompt invariant. len(gateway.agent_prompt(q)) must be identical for a 30-tool registry and a 300-tool registry. If it grows, the gateway is leaking descriptions.
  2. Access enforcement. With access_filter=example_access_filter_devops, calling gateway.execute("secrets_manager_get_secret_value", ...) MUST raise PermissionError — secrets are not in the devops topic set.
  3. Search returns names not descriptions. Inspect gateway.search(q) output — every element is {name, score}, no description key present.
  4. CLI --help exits 0. Multi-harness invariant: the skill must be runnable from any CLI harness.

Security Posture

  • Prompt injection. Tool descriptions never enter the prompt — major reduction in injection surface vs RAG-MCP. The search call still uses the description-text for retrieval, so a malicious description biases retrieval but never reaches the LLM verbatim.
  • Data exfiltration. execute calls user-registered executors with **params. Validate params at the executor boundary (this skill does not — it's a substrate primitive).
  • Privilege escalation. Access filter is the enforcement seam. Wire it to your IAM/RBAC source-of-truth. Do not trust the agent to enforce its own permissions.

Composition

  • Pairs with rag-mcp-tool-selection (sibling Ch6 skill) — gateway uses the same retriever internally (lib.score_tool swap point) but exposes a different API shape to the agent.
  • Pairs with AAuth identity primitives (Posta canonical) for per-agent access tokens flowing through access_filter.
  • Inputs can be outputs of enhance_tool_representation (Toolshed pattern, Ch6) — richer per-tool descriptions improve search retrieval without affecting agent prompt cost.

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly), Chapter 6 — Tool Orchestration. Specific references:

  • Writer's production enterprise MCP gateway (three-layer architecture: OpenAPI/Postman ingestion + Palmyra X5 description refinement + two-meta-tool surface)
  • Phil Fersht's HFS / Cognizant research on multi-agent governance failure above 5 agents
  • Microsoft Core AI Platform research on prompt bloat at MCP scale

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Mcp Gateway Two Meta Tools?

Build a gateway that exposes any-size tool registry through just two meta-tools: search(query) and execute(tool_name, **params). Tool descriptions stay outside the prompt entirely — the agent's prompt cost is constant regardless of registry size. Use when you need per-tenant tool segmentation, per-agent access policies, or are scaling to hundreds-of-tools where even top-k injection (rag-mcp- tool-selection) bloats prompts. NOT for cases under 30 tools where RAG-MCP top-K injection is simpler. NOT a security layer on its own — bring an IAM/RBAC source-of-truth for the access_filter.

Perché usare Mcp Gateway Two Meta Tools su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Mcp Gateway Two Meta Tools è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Mcp Gateway Two Meta Tools in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/tool-orchestration/mcp-gateway-two-meta-tools. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Mcp Gateway Two Meta Tools?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Mcp Gateway Two Meta Tools?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Mcp Gateway Two Meta Tools: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Mcp Gateway Two Meta Tools è gratuita?

Sì. È pubblicata su GitHub da AnthonyAlcaraz con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇