Title: mcpx: Roc as a script language, and whether mcpx should be a Roc platform · Issue #1964 · developing-today/code · GitHub
Open Graph Title: mcpx: Roc as a script language, and whether mcpx should be a Roc platform · Issue #1964 · developing-today/code
X Title: mcpx: Roc as a script language, and whether mcpx should be a Roc platform · Issue #1964 · developing-today/code
Description: Relocated from dezren39/darwin-nix#296 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/ni...
Open Graph Description: Relocated from dezren39/darwin-nix#296 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 referenc...
X Description: Relocated from dezren39/darwin-nix#296 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 refe...
Opengraph URL: https://github.com/developing-today/code/issues/1964
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx: Roc as a script language, and whether mcpx should be a Roc platform","articleBody":"Relocated from dezren39/nix#296 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: #175\n\n## Summary\n\nRoc is worth an issue for a reason that has nothing to do with \"another\ninterpreter\". Roc's defining idea is the **platform/application split**: an\napplication is pure, and a *platform* supplies every effect it is allowed to\nhave. That is the exact shape of an mcpx script — pure logic whose only effects\nare tool calls — and no other language in the runtime list models it natively.\n\nSo this issue has two halves, and they should not be confused. The cheap half is\nRoc as a script language alongside TypeScript and Python (#105): a codegen\nbackend and a runner. The interesting half is **mcpx as a Roc platform**, where\n`call`, `readResource`, `log` and `emit` are not a generated client but the\nplatform's effect API, and a script is incapable by construction of doing\nanything mcpx did not hand it.\n\nThe second half is a research bet on a pre-1.0 language. This issue recommends\nshipping the first and scoping the second honestly rather than pretending they\nare one piece of work.\n\n## Original notes\n\n> add another for roc support\n>\n> you can imagine what i might want build out your dreams\n\n## Current state\n\n**Three JavaScript runtimes, nothing else.** `runner.Detect` picks from\n`candidates := []string{\"deno\", \"bun\", \"node\"}` (`internal/runner/runner.go:73`)\nand `runner.Run` spawns one. There is no interpreter selection, no shebang\nhandling and no second codegen backend. #106 is the issue for shebangs and a\n`--shell` family; #105 is Python 1:1 with TypeScript; #175 is the tracker over\nboth.\n\n**The generated client is the whole ergonomic story.** `internal/codegen` emits\nTypeScript from the catalog, and that typed surface — `tools.\u003cnamespace>.\u003cfn>()`\n— is what makes a script worth writing instead of a pile of `mcpx call`\ninvocations. Any new language is a codegen backend first and a runner second,\nwhich is the framing #105 already uses (\"a second codegen backend and a second\nrunner, not a second product\").\n\n**Nothing in the codebase knows about Roc**, and the issue tracker has no Roc\nmention at all. This is a greenfield proposal, not a gap.\n\n**What Roc actually is, for the record.** A pure functional, ML-family,\nstatically typed language compiling through LLVM. No runtime exceptions, no\n`null`, tags and records with structural typing and full inference. Its\ndistinguishing feature is that an application declares a platform —\n`app [main] { pf: platform \"...\" }` — and the platform defines both the type of\n`main` and every effect available. The host is ordinarily written in Rust, Zig\nor C and is linked with the compiled application.\n\n**The honest status caveat:** Roc is pre-1.0, has no stable release channel, and\nmakes no compatibility promise between versions. Anything built here is\nsigning up for breakage on a cadence the project does not control. That is a\nreal cost and it should be stated in the issue rather than discovered in six\nmonths.\n\n## Approaches\n\n### Approach A — least recommended: let #106 cover it and call it done\n\nOnce `mcpx exec` runs any shebang, `#!/usr/bin/env roc` works, and Roc is\n\"supported\" in the sense that the process starts.\n\nThis is genuinely zero work and genuinely worthless for Roc specifically. The\nscript gets no typed client, so every tool call is hand-rolled JSON over the\ndaemon API — in a language whose entire selling point is that the compiler\nproves your data handling correct. Using Roc without generated types is strictly\nworse than using TypeScript with them. If this is all that ever happens, do not\nopen the issue; #106 already covers it and no Roc-shaped work is justified.\n\n### Approach B — middle, and what to actually ship: a Roc codegen backend and runner, on an existing platform\n\nTreat Roc exactly as #105 treats Python. A `roc` runtime in the resolver, and an\n`internal/codegen` backend emitting Roc type definitions and call functions from\nthe same catalog that drives TypeScript. Scripts run with `roc run` against a\ncommunity platform (`basic-cli`), and tool calls go over the daemon's HTTP API\nlike any other non-native client.\n\nRoc is an unusually *good* target for this, which is the argument for doing it\nat all:\n\n- Tool input schemas map onto Roc records with inferred structural types, and\n enum/`oneOf` schemas map onto tag unions, which is a closer fit than\n TypeScript's structural-but-unsound interfaces and much closer than Python's\n type hints.\n- Roc has no exceptions, so a tool error has to be a value — `Result` — and the\n compiler will not let a script ignore a failed call. Today a TypeScript script\n can drop a rejected promise and mcpx finds out from the exit code.\n- Schema-to-type generation is a solved shape in this codebase already; the\n backend is mostly a new emitter, not new design.\n\nB stands alone, ships against today's Roc, and does not depend on resolving any\nof the hard questions in C.\n\n### Approach C — the destination, staged behind research: mcpx as a Roc platform\n\nWrite a platform whose effects *are* mcpx. A script becomes:\n\n```roc\napp [main] { pf: platform \"https://.../mcpx-platform/main.roc\" }\n\nmain =\n issues = Mcpx.call! \"github.listIssues\" { repo: \"dezren39/nix\", state: \"open\" }\n Mcpx.emit! { count = List.len issues }\n```\n\nWhat that buys over B is not syntax, it is a property: **the capability boundary\nbecomes the type system**. A Roc application cannot open a socket, read a file or\nspawn a process unless the platform exposes it. Today mcpx's sandboxing story is\nDeno's permission flags (`internal/runner/runner.go:43` notes only Deno has a\npermission model worth the name, and bun and node run unrestricted). With a Roc\nplatform the guarantee is static and total, and it is the same guarantee for\nevery runtime Roc targets.\n\nIt also makes the generated client disappear. There is no emitted `tools.ts` to\ndrift from the catalog — the platform *is* the surface, and a catalog change is a\nplatform version bump. That retires a whole class of the drift problems #159 and\n#145 exist to police.\n\n**The blockers, stated plainly:**\n\n- **The host would have to be Go, and Roc hosts are not.** A platform host\n exposes a specific symbol set and is linked against the compiled application.\n Rust, Zig and C are the trodden paths; a Go host means cgo, a C shim and a\n build story materially harder than anything in this repository today. The\n realistic shape is a small Rust or Zig host that speaks to the mcpx daemon over\n its existing HTTP/unix-socket API — at which point the platform is a separate\n artefact with a separate toolchain in the release pipeline (#158).\n- **Pre-1.0 churn.** Platform authoring is among the parts of Roc that have moved\n most.\n- **Distribution.** Platforms are fetched by URL. That interacts with #187's\n content-addressed cache and with whatever #158 decides about release\n artefacts.\n\nSo: do B. Open C's research as a tracked question — \"can a useful mcpx platform\nbe hosted without owning a Rust toolchain in this repo?\" — and revisit when Roc\ncuts a stable release. Do not block B on it.\n\n## Open questions\n\n- Is anyone actually going to write Roc here, or is the platform model the only\n real draw? If the latter, the honest framing is a *capability-sandbox*\n research issue where Roc is one candidate and WASM is another, and this issue\n is a sub-case of that.\n- Does the Roc backend share the schema→type layer with Python (#105) and\n TypeScript, or is a third hand-rolled emitter acceptable? #111 (shared schema\n validation) is the adjacent consolidation.\n- `roc run` compiles before running. What is the cold-start cost against the\n script cache (#187), and does a compiled Roc script become a cacheable\n artefact keyed by source hash + catalog hash?\n- Roc's effects are explicit (`!`). Does the generated client expose every tool\n as an effect, or are read-only tools modelled differently? There is a real\n design here about annotating tools as pure/impure that would also benefit the\n TypeScript side.\n- Version pinning: which Roc does a declaration target, and does `mcpx doctor`\n check it? Same drift problem as a generated adapter declaration's binary\n version.\n\n## Ease · Impact · Related\n\n**Ease:** M for the codegen backend and runner (Approach B), mostly mirroring\nwhatever #105 establishes for Python; **XL and speculative** for the platform\n(Approach C), with a hard dependency on a non-Go toolchain. **Impact:** low in\nusers reached, high in what it would prove — C is the only proposal on the\ntracker that makes the sandbox a *type-system* property rather than a flag set.\n\n**Depends on / related:** #105 (Python 1:1 — establishes the second-backend\npattern this follows; do that first), #106 (shebangs — Approach A, and the floor\nbelow this issue), #175 (parent tracker: runtimes, languages, dependencies),\n#100 and #108 (runtime selection and its sharp edges), #103/#104/#187\n(dependencies, import graphs and the cache a compiled platform would use),\n#111 (shared schema validation), #158 (release artefacts, if a platform host\never ships), #84 (embedding — a C ABI would make a Roc host dramatically more\ntractable and is the single highest-leverage dependency for Approach C).\n\n## Acceptance criteria\n\n- A written decision splits the two halves: Roc as a script language (codegen backend + runner) vs mcpx as a Roc platform, with a recommendation for each.\n- If the script-language half proceeds: a Roc script can call at least one catalog tool through a generated client surface comparable to the TypeScript one, selected via the existing runner detection.\n- The platform half is scoped honestly (pre-1.0 risk, maintenance cost) with a named trigger for revisiting, rather than silently dropped.\n- Existing TypeScript/Python script behaviour is unchanged.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T22:48:04Z","url":"https://github.com/developing-today/code/issues/1964"}
| 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:9a87d4ac-bd61-3ef4-4445-a2197696537d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA8E:2BB16:83DB83:AA77FC:6B062C31 |
| html-safe-nonce | 92742f5a4cf56e02127303583ed8714a214be5af1a5bee19d3a5fd071fe8db06 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQThFOjJCQjE2OjgzREI4MzpBQTc3RkM6NkIwNjJDMzEiLCJ2aXNpdG9yX2lkIjoiOTIxMzg4ODU2MTg4MjIxMzQyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 33dffd4a8f1c02a6ae6e8c05e7c2d7d1383dbc2e5838d2f6e74445506f94f98b |
| hovercard-subject-tag | issue:6088923295 |
| 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/1964/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd2b1ff1d23aa4c29d3e1b890b60b5cdb12309e7fa8aa9bbeefe41916f7cc88f/developing-today/code/issues/1964 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd2b1ff1d23aa4c29d3e1b890b60b5cdb12309e7fa8aa9bbeefe41916f7cc88f/developing-today/code/issues/1964 |
| og:image:alt | Relocated from dezren39/darwin-nix#296 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 referenc... |
| 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 | 7f961de5dd5c5d4aca24d33f8b3ffb3fb8b2ef53d0a4f32f01f0a790e512f6d3 |
| 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 | 494ea0bb1e0feef734a83e2628697647755e8864 |
| 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