Title: mcpx: anything as an MCP server -- scripts, bare binaries, recipes, plugins, as first-class namespaces · Issue #1875 · developing-today/code · GitHub
Open Graph Title: mcpx: anything as an MCP server -- scripts, bare binaries, recipes, plugins, as first-class namespaces · Issue #1875 · developing-today/code
X Title: mcpx: anything as an MCP server -- scripts, bare binaries, recipes, plugins, as first-class namespaces · Issue #1875 · developing-today/code
Description: Relocated from dezren39/darwin-nix#83 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix...
Open Graph Description: Relocated from dezren39/darwin-nix#83 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue reference...
X Description: Relocated from dezren39/darwin-nix#83 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue refer...
Opengraph URL: https://github.com/developing-today/code/issues/1875
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx: anything as an MCP server -- scripts, bare binaries, recipes, plugins, as first-class namespaces","articleBody":"Relocated from dezren39/nix#83 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).\n\nParent: #173\n\n## Summary\n\n\"Turn anything into an MCP server\" is already most of what mcpx does — it is the premise of `paths.adapters` and `paths.apis` — but the coverage is uneven and the results are second-class. A command-line program can become tools; a shell script, a Python script or a bare binary cannot, except by writing an adapter declaration by hand. And what adapters and OpenAPI produce are loose MCP tools, not namespaces: they are absent from `mcpx ls`, from the generated TypeScript, and from scripts.\n\nThis issue asks for two things. One: extend \"anything becomes a server\" to scripts of any language, to bare binaries with no declaration, and to plugins. Two: make everything produced that way a **first-class namespace**, registerable from configuration *and* live, so a declaration, a plugin and an upstream MCP server are indistinguishable once loaded.\n\n## Original notes\n\n> - support adding bash/js/ts/py scripts as mcp\n> - support embedding/config/dynamic-add \"mcp\" for any plugin above\n> - support embedding/config/dynamic-add any binary as mcp\n> - binary mcp\n\n## Current state (what mcpx does today, with file refs)\n\n**Command-line programs → tools: shipped.** `internal/adapter/adapter.go` takes a declaration — `name`, `command`, `args`, `env`, `dir`, `timeout`, and a list of `tools`, each a fixed-arg subcommand with typed `params` (string/number/integer/boolean/array, flag or positional, `repeat`, `default`, `enum`, plus `stdin` for a parameter written to stdin and `json` to parse the output). Declarations are loaded from `paths.adapters` (`internal/settings/registry.go:292`, `internal/cli/adapter.go:22`). `mcpx adapter check` reports whether the binaries exist, and `mcpx doctor` includes the same check (`internal/cli/doctor.go:230-244`). Two deliberate details are recorded in `docs/story.md:1626-1630`: a boolean parameter becomes the flag's *presence*, and a non-zero exit is a *result*, not an error.\n\n**OpenAPI → tools: shipped.** `paths.apis` and `mcpx api --spec \u003cpath-or-url>` (`internal/cli/openapi_tools.go`).\n\n**Saved scripts already carry a tool schema.** A recipe is a script on the scripts search path that declares its holes in a header comment: `// @param repo:string which repository`, with types `string`/`number`/`boolean`/`json`, defaults, and optional markers (`internal/recipes/recipes.go`). That is a JSON Schema in all but spelling. Recipes are reachable as `GET /v1/recipes`, `GET /v1/recipes/{name}`, `POST /v1/recipes/{name}` and `POST /v1/recipes/{name}/run` (`internal/api/ops_consumer.go:42-95`), and through `mcpx prompt` / `POST /v1/intent` matching. **They are not individual MCP tools.** An agent cannot see `close_stale_issues(repo, days)` in `tools/list`; it can only see the recipe machinery.\n\n**Live add exists, for servers only.** `POST /v1/servers` writes the entry to a config file and reloads, so the server is callable immediately and still there after a restart; `DELETE /v1/servers/{name}` removes it (`internal/api/ops_settings.go:82,111`). There is no equivalent for an adapter, an API spec or a recipe-as-tool.\n\n**The second-class problem, precisely.** Adapter tools and OpenAPI operations are attached as `mcpserver.Extra` when the MCP server is constructed (`internal/cli/serve.go:328-346` at 05c78b2; `WithExtras` at `:346`). That gets them into `tools/list` over `/mcp` and `mcpx serve --transport stdio`, and nowhere else: not into the pool, not into `mcpx ls` or `mcpx catalog`, not into the codegen, and therefore not callable as `gitx.log()` from a script. `docs/story.md:1619-1620` says an adapted program \"is callable from a script\" — and so does the adapter package's own doc comment (\"appearing in `mcpx ls`, callable from a script\", `internal/adapter/adapter.go:8-10`); against the code as it stands neither is true, and this issue should fix the code rather than the sentence. The narrower defect (fix or retract the claim, and guard that `tools/list` and the generated client agree) is #102, in flight; this issue is the design it belongs to. Extras are also computed once at MCP-server construction, so there is no live add/remove path for them at all.\n\n**No Python or shell runtime anywhere.** `internal/runner/runner.go:73` resolves `deno`, `bun`, `node` only. Python 3.14.7 and uv 0.9.28 are installed on this machine but mcpx has no notion of them.\n\n## Approaches\n\n### Approach A — least recommended: a generic \"run this command as a tool\" escape hatch\n\n`{ \"name\": \"sh\", \"command\": \"bash\", \"tools\": [{ \"name\": \"run\", \"params\": [{\"name\": \"script\"}] }] }` — one tool that takes a string and runs it. Or its more honest spelling, a `shell` server type.\n\nTwo lines of config and it covers every bullet in the notes, which is why it is tempting. It is wrong for a reason the adapter package already wrote down (`internal/adapter/adapter.go:12-14`): \"This is deliberately not a general shell escape. A tool here is a named subcommand with declared parameters, so a model cannot invent a command line, and what is reachable is exactly what somebody wrote down.\" A generic runner discards every property that makes the adapter useful: no schema, so no typed client and nothing for an agent to reason about; no `mcpx doctor` check, because there is nothing to check; no namespace, no descriptions, no `mcpx catalog` entry with any information in it. The agent ends up writing shell, badly, with mcpx as a very slow `bash -c`.\n\nNote also that mcpx already has a *better* general escape hatch: `mcpx exec` runs TypeScript with typed clients for everything, preflight diagnostics, artifacts and content-addressed workdirs. A shell escape is a worse version of a feature that shipped.\n\n### Approach B — middle: extend the adapter declaration to cover scripts and bare binaries\n\nKeep the declaration model and widen what it can point at:\n\n- **Scripts.** An adapter whose `command` is a script file works today if the file is executable. What is missing is a `runtime` field, so `{ \"command\": \"./tools/report.py\", \"runtime\": \"python\" }` resolves `uv run` / `python3` / `bun` / `deno` / `bash` without the author hard-coding an interpreter path. This is a small, self-contained addition and the natural home for the notes' `bash/js/ts/py` list. It must be its own resolver, not `script.runtime` (`internal/settings/registry.go:176`), which is about the JS runtime that executes mcpx-generated scripts and means something different.\n- **Bare binaries with no declaration.** For a program that already emits a machine-readable interface there is no reason to write one by hand. Three real sources, in descending order of how often they exist: a program that ships an OpenAPI or JSON Schema document (feed it to the existing `paths.apis` path); a program with a `--help` that a *generation* step — run once, by a human, possibly with a model — turns into a declaration file the user then edits and commits; and the degenerate case, one tool per binary taking an argv array, which is Approach A wearing a hat and should be opt-in and loud.\n\n The important design point: generation produces a **file the user keeps**, not a runtime inference. A declaration inferred fresh on every daemon start makes a tool surface that changes when someone upgrades a CLI, and an agent's context changing because `jq` got a new flag is a bug that will take a day to find.\n- **Scripts-as-tools from recipes.** A recipe already declares typed parameters; publishing each one as an MCP tool is mostly plumbing (`internal/recipes/recipes.go` → a JSON Schema → an `Extra` or a namespace). This is the highest value-per-line item in the whole issue: the schemas exist, the runner exists, the search path exists.\n\nAll correct and all incremental. B's limit is that it leaves everything in the `Extra` path, so all of it stays absent from `mcpx ls`, the codegen and scripts, and none of it can be added live.\n\n### Approach C — recommended: one internal notion of a *tool source*, with declaration, plugin and upstream server as three implementations\n\nAdopt the interface `docs/proposals.md:427-429` already proposes — \"something that can list tools with JSON Schemas and call one\" — and make **every** producer implement it: an MCP server (today's default), a CLI adapter declaration, an OpenAPI document, a recipe, a plugin (sibling issue), and a script or binary through B's widened declaration. Then do the part that makes it matter: register them through the *same* path as servers, not as `Extra`s.\n\nWhat that buys, in one list:\n\n| property | today, for an adapter | with a tool source |\n| --- | --- | --- |\n| in `tools/list` over `/mcp` | yes | yes |\n| in `mcpx ls` / `mcpx catalog` / `mcpx search` | no | yes |\n| in the generated TypeScript, callable from a script | no | yes |\n| namespaced, with `mcpx.namespace`/description | partly | yes |\n| live add/remove | no | yes, one path |\n| pooled, idle-reaped, `sharing`/`scope` | n/a | where it applies |\n| preflight diagnostics find calls to it (`internal/diagnose`) | no | yes |\n\nAnd the three ways to add one collapse into one mechanism seen from three angles, which is what the notes' \"embedding/config/dynamic-add\" triplet is asking for:\n\n- **config** — a declaration on `paths.adapters` / `paths.apis` / `paths.plugins` / the scripts search path, or a `servers` entry. Declarative, reviewable, in git.\n- **dynamic-add** — the existing `POST /v1/servers` generalised: a body that may carry a `kind` (`server` | `adapter` | `api` | `script` | `plugin`) and the corresponding fields, writing to the right file and reloading, exactly as it does now for servers. Prefer extending that operation over minting `/v1/adapters`, `/v1/scripts`, `/v1/plugins`: it already does the hard parts — choose a scope, write the file, reload, keep other instances alive — and one table entry in `internal/api/ops*.go` means one CLI command, one MCP tool and one OpenAPI operation rather than four of each. A new endpoint is justified only if the bodies turn out to have nothing in common, which they mostly do not.\n- **embedding** — the daemon holding its own in-process tool source rather than spawning anything: recipes and `/v1` op tools are already this. Covered further in the embedding sibling issue.\n\nRecommended because it is the smallest set of concepts that covers every bullet, it retires the \"adapter tools are invisible to scripts\" gap rather than widening it, and it is the interface the project already wrote down as the right shape and deferred. Do it now precisely because plugins are about to be the fourth producer: adding a fourth `Extra` list is how this ends up with four half-integrated surfaces.\n\nShip order that keeps every step useful on its own: (1) recipes as tools, since the schemas already exist; (2) the tool-source interface with adapters and OpenAPI moved onto it, which is where the `mcpx ls`/codegen win lands; (3) `runtime` on a declaration, for bash/js/ts/py; (4) generalised live add; (5) generated declarations for bare binaries.\n\n## Open questions\n\n- Namespacing collisions: an adapter named `git`, a plugin named `git` and an upstream server named `git`. Today adapters flatten to `name_tool` and servers namespace properly. One rule, and a loud error on collision.\n **Owns #181 collision 4:** the tool-source interface defines namespaces and collision rules for every producer. #114's tool views, cross-server namespaces and script-backed tools are built on these rules and do not define their own; #80's plugins are a namespace under them.\n- Does a CLI adapter belong in the *pool*? It has no long-lived process — every call is a fresh `exec`. It needs to be a namespace without being a pooled server, which is the main piece of real design work in C.\n- Is a recipe-as-tool automatic for every recipe, or opt-in per recipe? Automatic is friendlier and can flood `tools/list` in a repo with fifty scripts. Probably a declaration marker, defaulting to on, with a budget in `mcpx catalog`.\n- For bare binaries: is `--help` parsing worth it at all, given how irregular help output is? A one-shot, model-assisted generation into a file the user edits is defensible; a runtime parser is not.\n- Should a generated declaration record the binary's version, so an upgrade produces a visible \"this declaration was written against jq 1.7\" warning rather than silent drift?\n- `mcpx adapter check` generalises to `mcpx source check` — is that worth the rename, and what does it do for a plugin (start it and `tools/list`?) versus a binary (does it exist?)?\n- `stdin`, `json`, boolean-as-presence and non-zero-exit-as-result are adapter-specific semantics. Which of them survive into the general interface, and which stay adapter-local?\n\n## Ease · Impact · Related\n\n**Ease:** M for recipes-as-tools and a declaration `runtime`; L for the tool-source interface and generalised live add; XL for all of it including generated declarations. **Impact:** high — this is the feature mcpx is *for*, and the `Extra` gap currently caps it.\n\n**Depends on / related:** #80 (a plugin is the fourth tool source, and the reason to unify now), #84 (mcpx as its own upstream, in-process sources), #102 (in flight: the documented-but-false \"callable from a script\" claim; slice 2 here delivers the capability), #114 (builds on this issue's namespace and collision rules, collision 4), #7 (placeholders/`@param` spelling is shared with recipes), #6, #76 (`/v1` operations without CLI commands — the same parity discipline applies to any new registration verb), #79 (codegen and catalog cost when the tool count grows), #105/#106 (a declaration `runtime` for Python and shebangs is the same resolution problem), #5.\n\nSecurity/auth deferred; see tracker.\n\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T22:12:39Z","url":"https://github.com/developing-today/code/issues/1875"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6b231731-0dc1-5181-f485-f11edb9de634 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4E8:39588:2DE223:3D8021:6B0616E8 |
| html-safe-nonce | e5ef79ca8808dfdc4d5735814ff16221296740aac90960f509c1529f0d835eb2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEU4OjM5NTg4OjJERTIyMzozRDgwMjE6NkIwNjE2RTgiLCJ2aXNpdG9yX2lkIjoiNDQ0NzA2MTU5NDUwOTU0NzI0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 759df9a692f3aaedb5fac77e82288c2418903ad4de16b8c2e34fc7ae71af504d |
| hovercard-subject-tag | issue:6088448200 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/1875/issue_layout |
| twitter:image | https://opengraph.githubassets.com/81ee70698b55de44d2bcd7b608e08057913de48a19ed17c1dfe09531865582c8/developing-today/code/issues/1875 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/81ee70698b55de44d2bcd7b608e08057913de48a19ed17c1dfe09531865582c8/developing-today/code/issues/1875 |
| og:image:alt | Relocated from dezren39/darwin-nix#83 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue reference... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width