agentleFS
Quad4-SoftwareQuad4-Software/skills/.agents/skills/gateway/SKILL.md

gateway

Skill1 starsChanged 42 days ago0BSDView on GitHub

This skill multiplexes other stdio MCP servers through gateway. Use when you want one MCP endpoint that proxies tools from many configured servers, with lazy spawning and per-server stats.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Call servers to verify children, tools for the index, and invoke {name: "<server>.<tool>", arguments: {...}} to proxy.

    line 22

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

When to use this skill

  • You want one MCP config entry instead of N server entries.
  • You need a unified tool index across several stdio servers.
  • You want daemon/socket or SSE access to a set of MCP servers.

How to use

  1. Build gateway: cd mcp/gateway && go test ./... && go build.
  2. Point GATEWAY_CONFIG at an mcp.json (default ~/.config/mcp/mcp.json) listing the child servers.
  3. Call servers to verify children, tools for the index, and invoke {name: "<server>.<tool>", arguments: {...}} to proxy.

Examples

  • "List which child servers are reachable and their tool counts."
  • "Invoke context.file_outline on internal/docs/docs.go."
  • "Show per-server call stats after a session."

gateway

gateway multiplexes stdio MCP servers behind five tools. Children spawn lazily on first use, calls are serialized per child, and a failed transport gets one respawn. Child stderr is discarded.

Configuration

  • GATEWAY_CONFIG: path to the MCP config JSON. Default ~/.config/mcp/mcp.json. Entries with only url, disabled flags, or a self-reference to gateway are skipped.
  • --socket (default $XDG_RUNTIME_DIR/gateway.sock or /tmp/gateway-$UID.sock), --attach (stdio-to-socket shim that auto-spawns the daemon), --daemon, --read-only, --http (serve HTTP only on HTTP_PORT, no stdio), --health-check (GET /healthz on HTTP_PORT, exit 0 on success), --log (append operational log to a file, default GATEWAY_LOG).
  • HTTP_PORT exposes GET /, GET /healthz, GET /sse, and POST /messages?session=<id>.

Daemon mode: socket chmod 0600, log at <socket>.log, socket removed on SIGTERM/SIGINT.

Tool inventory

toolargspurpose
serversnonechildren + reachability + tool count
toolsserver (opt)compact <server>.<tool> index
gateway_statsnoneper-server calls, errors, spawns, avg_ms, last_call, tool count
tool_schemanamefull schema for one <server>.<tool>
invokename, argumentsproxy a tools/call to a child

Notes and quirks

  • Gateway tools carry no Write flag, so --read-only does not block invoke of a child's mutating tool directly. Protection relies on children inheriting MCP_READ_ONLY via the environment. Set MCP_READ_ONLY=1 in the gateway environment before relying on it.
  • All /sse sessions share one server and one child pool process-wide. Concurrent sessions cap at 256 and each POST body at 1 MiB.
  • Response matching is by "id":N substring over up to 10000 lines with no read deadline. A hung child stalls until the server-side 30 s tool timeout fires.
  • Child tools/list is cached per child. A transport failure clears the cache, so a respawned child re-advertises its tools.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.