Logo: Mcp Gateway Two Meta Tools

Mcp Gateway Two Meta Tools

Communautéit
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.

Iwwersiicht

EditeurAnthonyAlcaraz
Repositoryagentic-graph-rag-skills
Skill-Nummmcp-gateway-two-meta-tools
Stären
29
Forks
9
Matgeliwwert Dateien
2
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    AnthonyAlcaraz huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Mcp Gateway Two Meta Tools an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/tool-orchestration/mcp-gateway-two-meta-tools
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Mcp Gateway Two Meta Tools an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Mcp Gateway Two Meta Tools automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Mcp Gateway Two Meta Tools net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Mcp Gateway Two Meta Tools op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Mcp Gateway Two Meta Tools besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Mcp Gateway Two Meta Tools an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/tool-orchestration/mcp-gateway-two-meta-tools an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Mcp Gateway Two Meta Tools benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Mcp Gateway Two Meta Tools benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Mcp Gateway Two Meta Tools domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Mcp Gateway Two Meta Tools gratis?

Jo. AnthonyAlcaraz huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇