# Directory Federation

> Architecting MCP routers as zero-execution metadata directories to offload tool execution onto the client.

- Skill: `jcorpac/directory-federation` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jcorpac/directory-federation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jcorpac/directory-federation/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: jcorpac (https://skillmd.com/u/jcorpac)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/jcorpac/directory-federation

---


# directory-federation

## Purpose
Traditional MCP "routers" act as a middleman that receives a tool execution request, proxies it to the subordinate server, and proxies the result back. This creates execution bottlenecks, limits streaming potential, and drastically increases attack surface. 

Federating the router into a pure **Directory** shifts the execution back to the client.

## Usage

Instead of wrapping subordinate tools inside your router, expose a *single* meta-tool that returns connection strings to the agents.

```python
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Directory Service")

@mcp.tool()
def search_available_tools_and_servers(query: str) -> list[dict]:
    """Allows the agent to query for tools and get their direct connection details."""
    # Database logic returning SSE URLs or Stdio command definitions 
    return [
        {
            "tool_name": "search_wikipedia",
            "server_transport": "stdio",
            "command": "docker run -i --rm mcp/wikipedia-mcp"
        }
    ]
```

When an agent needs a tool, it first queries the directory, gets the connection string, instantiates a direct MCP client to the target server, and runs the tool natively. It is a highly robust and scalable architecture.

## Resources
- MCP Specification (Transports)

