{"id":50457603,"url":"https://github.com/toabctl/mcpmux","last_synced_at":"2026-06-01T03:06:55.732Z","repository":{"id":361563509,"uuid":"1254174630","full_name":"toabctl/mcpmux","owner":"toabctl","description":"MCP multiplexer: one MCP endpoint proxying several backend MCP servers, holding their credentials","archived":false,"fork":false,"pushed_at":"2026-05-31T07:38:06.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T09:17:09.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toabctl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-30T08:24:51.000Z","updated_at":"2026-05-31T07:38:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/toabctl/mcpmux","commit_stats":null,"previous_names":["toabctl/mcpmux"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/toabctl/mcpmux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toabctl%2Fmcpmux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toabctl%2Fmcpmux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toabctl%2Fmcpmux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toabctl%2Fmcpmux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toabctl","download_url":"https://codeload.github.com/toabctl/mcpmux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toabctl%2Fmcpmux/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33757791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-01T03:06:51.640Z","updated_at":"2026-06-01T03:06:55.726Z","avatar_url":"https://github.com/toabctl.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mcpmux\n\nA minimal **Model Context Protocol (MCP) multiplexer**. It connects to several\nupstream MCP servers (\"backends\"), merges their tools under namespaced\n`\u003cbackend\u003e__\u003ctool\u003e` names, and re-exposes them through a **single MCP endpoint**\n(stdio or streamable HTTP).\n\nThe client (e.g. Claude Code) authenticates **once to mcpmux**; mcpmux holds each\nbackend's credentials and forwards calls to the right backend.\n\n```\n                       ┌──────────────── mcpmux ────────────────┐\n   MCP client  ──────► │  MCP server  ─►  router  ─►  client(s)  │ ─► backend A (command, env secrets)\n   (one endpoint)      │                                         │ ─► backend B (http, bearer token)\n                       └─────────────────────────────────────────┘ ─► backend C (http, custom header)\n```\n\n## Install\n\n```sh\ngo install github.com/toabctl/mcpmux@latest   # installs `mcpmux`\n# or build from a checkout:\nmake build                                     # produces ./mcpmux\n```\n\n## Configure\n\nCopy `mcpmux.example.yaml` to a config file and edit. `${ENV_VAR}` references are\nexpanded from the environment at load time, so secrets stay out of the file.\n\n`mcpmux` looks for its config in this order (first match wins); override with\n`--config/-c`:\n\n1. `./mcpmux.yaml`\n2. `$XDG_CONFIG_HOME/mcpmux/config.yaml` (Linux: `~/.config/mcpmux/config.yaml`)\n3. `$XDG_CONFIG_HOME/mcpmux.yaml`\n\n- `listen.transport`: `stdio` or `http`.\n- `listen.address` / `listen.path`: bind address and URL path for `http`\n  (clients connect to `http://\u003caddress\u003e\u003cpath\u003e`, e.g. `http://127.0.0.1:8080/mcp`).\n- `backends[]`: each has a unique `name` (used as the tool prefix) and a\n  `transport`:\n  - `command` — launched as a subprocess; pass secrets via `env`.\n  - `http` — a streamable-HTTP endpoint; authenticate with `auth.type` of:\n    - `none` — no credentials.\n    - `bearer` — static `token` sent as `Authorization: Bearer \u003ctoken\u003e`.\n    - `header` — a custom `header` name + `value`.\n    - `command` — run a credential helper (`command: [...]`) whose stdout is\n      the bearer token. The token is cached and re-run only when it nears\n      expiry (a JWT `exp` claim is honored; `ttl` caps caching for opaque\n      tokens) or when the backend returns 401/403. Ideal for CLIs that already\n      hold a login, e.g. `chainctl auth token --audience \u003cresource\u003e` — no\n      browser, ever.\n    - `oauth` — interactive authorization-code + PKCE flow with dynamic client\n      registration (RFC 7591). A browser opens **once when the daemon starts**;\n      the SDK handles discovery, PKCE, token exchange and in-memory refresh.\n      Options: `scopes`, `client_name`, `open_browser` (default true; false\n      just logs the URL for headless use), `callback_port` (0 = ephemeral).\n\n## Run\n\n```sh\nmcpmux serve -c mcpmux.yaml      # run the proxy\nmcpmux list  -c mcpmux.yaml      # debug: print the aggregated tool catalog\n```\n\nLogs go to **stderr**, leaving stdout clean for the stdio MCP transport.\n\n## Run as a daemon (systemd user service)\n\nRunning mcpmux as a long-lived user service is the intended setup: you\nauthenticate backends **once when the daemon starts**, and every Claude Code\nsession reuses the daemon's live tokens instead of re-authenticating per\nsession.\n\n```sh\nmake install                                   # binary -\u003e ~/.local/bin, units -\u003e ~/.config/systemd/user\nsystemctl --user daemon-reload\n```\n\nmcpmux ships a **`.service`** and a **`.socket`** (socket activation). systemd\nowns the listening socket, so it survives service restarts — clients never get\n\"connection refused\" while mcpmux restarts or re-authenticates. Two modes:\n\n**A) Always-on + socket** (recommended when you have interactive OAuth backends\nlike Linear — it authenticates once at startup and stays up):\n\n```sh\nsystemctl --user enable --now mcpmux.socket mcpmux.service\n```\n\n**B) On-demand** (only if *all* backends are non-interactive — the service\nstarts on the first connection):\n\n```sh\nsystemctl --user enable --now mcpmux.socket\n```\n\n```sh\njournalctl --user -u mcpmux -f                 # watch logs / OAuth URLs\n```\n\nWhen socket-activated, the **socket's `ListenStream` address is authoritative**\nand `listen.address` in the config is ignored (the passed socket is used);\n`listen.path` still applies. mcpmux signals readiness via `sd_notify`\n(`Type=notify`), and the unit allows 5 minutes for an interactive browser\nauthorization at startup.\n\nFor `oauth` backends to auto-open a browser from the service, make the graphical\nsession visible to systemd once after login:\n\n```sh\nsystemctl --user import-environment DISPLAY WAYLAND_DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS\n```\n\nOtherwise set `open_browser: false` on those backends and click the URL printed\nin the journal.\n\n\u003e Note: mode B (on-demand) is a poor fit for interactive OAuth backends — the\n\u003e first connection would block while the browser flow completes and likely time\n\u003e out. Use mode A when any backend uses `auth.type: oauth`.\n\n## Use from Claude Code\n\nStart mcpmux, then register the single endpoint with Claude Code:\n\n```sh\nmcpmux serve                                                      # uses ~/.config/mcpmux/config.yaml\nclaude mcp add --transport http mcpmux http://127.0.0.1:8080/mcp\n```\n\nTools appear namespaced, e.g. `github__create_issue`. Remove the individual\nservers you configured into mcpmux (`claude mcp remove \u003cname\u003e`) so their tools\ndon't show up twice.\n\nFor `listen.transport: stdio`, let Claude Code launch it instead:\n\n```sh\nclaude mcp add mcpmux -- /path/to/mcpmux serve -c /path/to/mcpmux.yaml\n```\n\n## Scope \u0026 limitations\n\n- **Backend auth supported:** env vars for stdio (`command` transport) backends;\n  for `http` backends `none`/`bearer`/`header`, the `command` credential helper\n  (dynamic bearer token from an external CLI, auto-refreshed), and interactive\n  `oauth` (authorization-code + PKCE + dynamic client registration; tokens held\n  in memory for the daemon's lifetime).\n- **Not yet:** persisting OAuth tokens across restarts (each daemon start\n  re-authenticates `oauth` backends), and authenticating the *client→mcpmux* hop\n  (run it on localhost or behind your own reverse proxy / auth gateway).\n- Tool-name collisions are avoided by the `\u003cbackend\u003e__` prefix. Resources and\n  prompts are not yet aggregated — tools only.\n\n## Development\n\n```sh\npre-commit install \u0026\u0026 pre-commit install --hook-type commit-msg\n```\n\nHooks run gofmt/golangci-lint, `go vet`, `govulncheck`, `go mod tidy`, and\nConventional Commits checks; `go test` runs on push. Commit messages must follow\n[Conventional Commits](https://www.conventionalcommits.org).\n\n## License\n\n[Apache-2.0](LICENSE) © Thomas Bechtold\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoabctl%2Fmcpmux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoabctl%2Fmcpmux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoabctl%2Fmcpmux/lists"}