Mcp Gateway Two Meta Tools logo

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.

Overview

PublisherAnthonyAlcaraz
Repositoryagentic-graph-rag-skills
Skill namemcp-gateway-two-meta-tools
Stars
29
Forks
9
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by AnthonyAlcaraz on GitHub. Read the source before you install it.

Installation

Install the Mcp Gateway Two Meta Tools AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/tool-orchestration/mcp-gateway-two-meta-tools
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Mcp Gateway Two Meta Tools in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Mcp Gateway Two Meta Tools on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Mcp Gateway Two Meta Tools is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Mcp Gateway Two Meta Tools AI skill do?

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.

Why use Mcp Gateway Two Meta Tools on TypingMind?

Because you install it once and use it with any model. Mcp Gateway Two Meta Tools is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Mcp Gateway Two Meta Tools in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/tool-orchestration/mcp-gateway-two-meta-tools. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Mcp Gateway Two Meta Tools?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Mcp Gateway Two Meta Tools?

As many as you like. As long as a model supports skills, you can use Mcp Gateway Two Meta Tools with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Mcp Gateway Two Meta Tools AI skill free?

Yes. It is published on GitHub by AnthonyAlcaraz under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇