Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions pkgs/mcpx/docs/compendium.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,34 @@
"role": "not-compendium",
"lines": 5,
"note": "a five-line scratch list, not a chapter"
},
{
"path": "docs/overview.md",
"chapter": null,
"role": "not-compendium",
"lines": 109,
"note": "level-1 site page (#1878): content for the docs site, rendered by the generator chosen in #1939 \u2014 not a compendium (level-3) chapter"
},
{
"path": "docs/install.md",
"chapter": null,
"role": "not-compendium",
"lines": 68,
"note": "level-1 site page (#1878): content for the docs site, rendered by the generator chosen in #1939 \u2014 not a compendium (level-3) chapter"
},
{
"path": "docs/quick-start.md",
"chapter": null,
"role": "not-compendium",
"lines": 57,
"note": "level-1 site page (#1878): content for the docs site, rendered by the generator chosen in #1939 \u2014 not a compendium (level-3) chapter"
},
{
"path": "docs/now-what.md",
"chapter": null,
"role": "not-compendium",
"lines": 30,
"note": "level-1 site page (#1878): content for the docs site, rendered by the generator chosen in #1939 \u2014 not a compendium (level-3) chapter"
}
]
}
5 changes: 5 additions & 0 deletions pkgs/mcpx/docs/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ The runtime stage adds `ca-certificates`, copies in `bun` and `mcpx`, drops
to an unprivileged user, and sets `ENTRYPOINT ["mcpx"]`. It has no git; §3
says why that is not a loss.

The build context is the module directory, because the Containerfile copies
`go.mod` and builds `./cmd/mcpx` — both relative to `pkgs/mcpx`, not to the
repository root:

```
cd pkgs/mcpx
docker build -f Containerfile -t mcpx .
docker run --rm mcpx --version
docker run --rm -v "$PWD/.mcpx.json:/work/.mcpx.json:ro" mcpx ls
Expand Down
68 changes: 68 additions & 0 deletions pkgs/mcpx/docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Install

> **Prerequisites, before the table:** a JavaScript runtime — deno
> (recommended; it is the only runtime where typechecking works), bun,
> or node 22.6 or later — unless you install with nix or the container,
> which bring their own. `git` is recommended (without it, the `repo`
> and `worktree` scopes degrade to the working directory). macOS or
> Linux; on Windows, use WSL. When you are done: `mcpx doctor`.

---

## Channels

The status column is the honest part of this page. Today, **nix, a
locally built container, and the plugin copy are the only channels that
exist**; everything else is designed but not built (that work is
#1881), and this page will not pretend otherwise.

| Channel | Command | Status |
| --- | --- | --- |
| nix | `nix run github:developing-today/code#mcpx -- ls` to try it; `nix profile install github:developing-today/code#mcpx` to keep it | **Available** — the flake builds `pkgs/mcpx/package.nix` and exposes it as an app; the wrapper puts `git`, `deno`, `bun` and `node` on `PATH`, so a nix install is complete with no other prerequisites |
| container | from the repository root: `docker build -f pkgs/mcpx/Containerfile -t mcpx pkgs/mcpx` (or podman), then run the image — see [container](./container.md) | **Partly** — the Containerfile builds a working image locally (bun as its runtime; deliberately no `git`, see [container](./container.md)); no image is published anywhere yet |
| just the plugin | copy `pkgs/mcpx/plugin/opencode/` into `~/.config/opencode/plugin/` (the plugin README's "Install") | **Available** as a manual copy — and it is not an install of mcpx: the plugin needs **no mcpx binary on its machine**, because it finds a daemon over the unix socket or an `endpoint`; it still needs a daemon running somewhere, and as copied it exposes no tools and injects no guidance until you set `tools: true` / `MCPX_PLUGIN_TOOLS=1` (and `instructions: true` for the prompt) |
| bash installer | per-user: `curl -fsSL <short> \| sh`; system-wide: `curl -fsSL <short> \| sh -s -- --system` (fallback: `curl -fsSL <short> \| sudo sh`) | Not yet — there are no releases for it to download |
| agent prompt | a prompt you paste to your agent, with the `llms.txt` URL | Not yet |
| pwsh (install.ps1) | `irm <short>/install.ps1 \| iex` | **Blocked** — mcpx does not build for Windows today; WSL is the Windows answer |
| rpm / deb | `dnf install ./mcpx-<version>.rpm` | Not yet |
| flatpak | — | Not recommended (decided in the release design, #1881) |
| pkg | — | Not yet — and still an open question: macOS `.pkg`, FreeBSD `pkg`, or Homebrew |
| docker (published) | `docker run … ghcr.io/<owner>/mcpx` | Not yet — local builds only, see the container row |

Nix caveats, stated plainly: the flake is a large monorepo flake, so
installing one package from it fetches and evaluates a lot (the cost
from a cold machine is unmeasured — an open question on #1878), and
`x86_64-darwin` is excluded; aarch64-darwin, x86_64-linux and
aarch64-linux are the supported systems.

The system-wide forms above are deliberate. Never
`sudo $(curl <short> | sh)`: that runs the installer unprivileged and
then executes the installer's *stdout* as root. The `--system` form
lets the script escalate only the copy into `/usr/local/bin`.

## Install as

Installing is only half the choice; the other half is how the daemon
lives on the machine. Every row except the service is shipped today.

| Mode | What to do | Status |
| --- | --- | --- |
| Just run the binary | Nothing. Any command that needs the daemon starts one (`daemon.autostart`, default true), and an auto-started daemon exits after 4 hours idle (`autostart.idleExit`) | Shipped |
| Per-user | Binary in `~/.local/bin`; config at `~/.config/mcpx/config.json` | Config shipped; the binary location arrives with the installer (#1881) |
| Per-host | Binary in `/usr/local/bin` (the installer's `--system`); config at `/etc/mcpx/config.json`, the last stop on the config search path | Config shipped but was undocumented until this page; binary location awaits #1881 |
| Local host (a daemon other machines reach) | `mcpx daemon --address <ip> --port <n>` on that host; clients set `daemon.endpoint` / `MCPX_DAEMON_ENDPOINT` — a client with an endpoint set never autostarts a local daemon. Remember: the API is unauthenticated, the network is the access control | Shipped |
| Persistent daemon | `mcpx daemon` (foreground) or `mcpx daemon --detached`; a deliberately started daemon's `daemon.idleExit` defaults to `0` — it never idle-exits | Shipped |
| System service | A launchd plist or systemd unit running `mcpx daemon`, with `daemon.autostart` false on clients so no stray second daemon starts | **Proposed**, not shipped — until then, the on-demand daemon above is the supported path |
| Fallback: no daemon | Set `daemon.inline` true: servers run inside each command process. Slower, nothing pooled, nothing shared | Shipped, last resort |

## Verify

```sh
mcpx doctor
```

`doctor` checks the runtime, git, the configuration chain, whether
every configured server's command is actually installed, and the
daemon — and each failed check says what to do about it.

Then: [the quick start](./quick-start.md).
30 changes: 30 additions & 0 deletions pkgs/mcpx/docs/now-what.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Now what

> You installed mcpx and ran the loop. Each link below is a question,
> and every one of them is answered one level down — the level-2 pages
> mapped in [the level-2 page map](./level-2-page-map.md).

---

- **Where does config go?** One `mcpServers` object, a search path
that runs from the working directory up to `/etc/mcpx/config.json`,
and settings that can come from a file, the environment or a flag:
[configuration](./configuration.md), and the map's
`configuration` page (common, server and client config, env vars).
- **How do I call mcpx from my harness, over MCP, over HTTP?** The CLI
is one surface of four — the daemon also speaks MCP (`/mcp`,
`mcpx serve`) and plain HTTP (`/v1/*`, OpenAPI at
`/v1/openapi.json`): [interfaces](./interfaces.md),
[cli](./cli.md), and the map's `mcp` and `http-api` pages.
- **How do scripts actually work?** The script contract, named
scripts, runtimes and what a script may touch:
[scripts](./scripts.md), [exec](./exec.md), [runtimes](./runtimes.md).
- **How does the opencode plugin work?** It finds the daemon so your
harness does not have to ship a binary:
[plugins](./plugins.md) and [the opencode plugin](./opencode-plugin.md).
- **Something is wrong.** `mcpx doctor` first (it says what to do
about each failure), `mcpx status` for the daemon and its servers,
and the skeptical questions, answered: [FAQ](./faq.md).
- **Everything, in depth.** The long version of all of it — the
narrative the overview was distilled from, and the book it feeds:
[the story](./story.md) and [the compendium](./compendium.md).
109 changes: 109 additions & 0 deletions pkgs/mcpx/docs/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Overview

> mcpx puts every MCP server you have behind one command, so an agent
> calls tools from the shell — and their schemas stay out of its context
> until it asks for them.

---

## Why install it

### 1. Code mode: tools become shareable, reusable scripts

Instead of one-off tool calls inside a chat, the agent writes a
TypeScript script that calls tools as ordinary async functions. The
script is a file: it can be saved, reviewed, shared and re-run.

```sh
mcpx run shot-flow <url> <outDir>
```

That is `.mcpx/scripts/shot-flow.ts` — screenshot a page, click a link,
wait for the load, screenshot again (the full walk is in
[the story](./story.md)). Written once by an agent that had never heard
of mcpx; reusable by anyone, forever, as `mcpx run shot-flow`.

More: [scripts](./scripts.md) and the level-2 map's script page
([level-2 page map](./level-2-page-map.md)).

### 2. Reclaim context: smarter, cheaper

Tool schemas are the tax. With seven namespaces and 43 tools installed,
discovery costs almost nothing:

```
$ mcpx ls
Seven namespaces, 43 tools, 171 tokens
```

The agent loads signatures only for the one namespace it is about to
use (`mcpx types <namespace>`), so the whole screenshot task above ran
in about 4,600 tokens total — schemas for 27 browser tools included
only when needed, never by default.

More: [the story](./story.md) for the token evidence.

### 3. Tame MCP: one config, every surface, everything corralled

- **One config.** mcpx reads the same `mcpServers` object every other
MCP host reads. There is no second configuration to keep in sync.
- **Share it with your tailnet.** Run the daemon on one machine and let
the others talk to it:

```sh
mcpx daemon --address <tailnet-ip> --port 8899
MCPX_DAEMON_ENDPOINT=http://<host>:8899 mcpx ls
```

Plainly: **the daemon's API is unauthenticated — whatever can route
to the port can run tools as you.** The network is the access
control; that is why the example is a tailnet address, not the open
internet.
- **Corral scripts, APIs and binaries.** Named scripts live in
`.mcpx/scripts/`; an OpenAPI service becomes tools with
`mcpx api tools --spec <url>` (served over MCP today); a plain
command-line program becomes tools through an adapter
(`mcpx adapter check` says whether each one is installed), and
adapters are served by the daemon like any other server.

More: [configuration](./configuration.md).

## What it looks like

```mermaid
flowchart TB
subgraph clients["You and your agents"]
CLI["CLI — mcpx ls | search | types | run | exec"]
PLUGIN["opencode plugin — no mcpx binary needed"]
MCP["MCP host — /mcp on the daemon, or mcpx serve"]
HTTP["HTTP client — /v1/* (OpenAPI at /v1/openapi.json)"]
end
subgraph daemon["mcpx daemon — one per config, autostarts, idle-exits"]
POOL["pooled MCP server processes (stdio) and remote servers (HTTP)"]
EXTRA["OpenAPI specs and CLI adapters, as tools"]
RUNNER["script runner: deno | bun | node subprocess"]
end
CLI --> daemon
PLUGIN --> daemon
MCP --> daemon
HTTP --> daemon
daemon --> POOL
daemon --> EXTRA
daemon --> RUNNER
RUNNER -. "calls back into the daemon" .-> daemon
```

What is running on your machine, in one breath: clients (the CLI, the
plugin, an MCP host, plain HTTP) talk over a unix socket or a URL to
**one daemon per config**. The daemon owns the pooled MCP server
processes, serves OpenAPI specs and CLI adapters as tools, and runs
your scripts on a real runtime (deno, bun or node) whose tool calls
come back into the daemon. Nothing else is installed and nothing runs
until a command needs it: the daemon autostarts on demand and an
auto-started one exits after 4 hours idle.

## Next

- [Install mcpx](./install.md)
- [Quick start](./quick-start.md) — the loop in under one screen
- [Now what](./now-what.md) — where to go after the quick start
64 changes: 64 additions & 0 deletions pkgs/mcpx/docs/quick-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Quick start

> The whole loop, in under one screen: check the machine, add one
> server, look, search, read the types, call a tool.

---

```sh
mcpx doctor # runtime, config, daemon: what is missing and how to fix it
mcpx servers add fs -- npx -y @modelcontextprotocol/server-filesystem /tmp
mcpx ls # namespaces, tool counts, state
mcpx search directory # find a tool by name or description
mcpx types fs # TypeScript signatures for this one namespace
mcpx exec 'emit(await fs.list_directory({ path: "/tmp" }))'
```

That is the loop from [`AGENTS.md`](../AGENTS.md), and it is the whole
product in miniature:

1. **`ls` before anything.** Discovery is a separate, cheap step from
use — run it whenever; it starts nothing.
2. **`search`, then `types` for one namespace only.** Signatures are
loaded on demand, never all of them: loading everything is the
failure mode mcpx exists to prevent. `mcpx types fs.list_directory`
loads a single tool, cheaper still. Tool names come from the server —
if `list_directory` is not what `types` shows, `types` is right.
3. **`exec` (or `run`) does the work.** Inside a snippet, every
namespace is a bare identifier and results arrive unwrapped. A
named, saved version of the same idea is a script:
`mcpx run <name>` runs `.mcpx/scripts/<name>.ts`.

Every command above is real: verified against
`internal/cli/manual.go` (`Commands()`, the list behind `mcpx help`)
and the dispatch table in `internal/cli/dispatch.go` at the commit
this page was written. The server example is the one
`mcpx servers --help` itself uses; it needs `npx` (node). With only
deno or bun, find a first server that needs nothing extra instead:
`mcpx registry search <words>`, then `mcpx registry add <name> --write`.

Do not start with `mcpx init`: it writes a starter config whose servers
are placeholders, so the first `ls` after it shows an error row. Add a
real server first, as above.

## Make it an agent tool

The quick start above is a person at a shell. The step that makes mcpx
an *agent* tool is one of:

- give your agent [`AGENTS.md`](../AGENTS.md) — the loop, the script
contract and the secrets rules, in the file agents already read; or
- install the opencode plugin — see [install](./install.md#channels),
"just the plugin" — and turn on what you want it to do: the plugin
ships with `tools` and `instructions` **off**, so a bare copy gives
your agent neither callable tools nor prompt guidance. For tools, name
the plugin in config with options
(`["./.opencode/plugin/mcpx-session.ts", { "tools": true }]`, or set
`MCPX_PLUGIN_TOOLS=1`); for the usage paragraphs, `instructions:
true` or `MCPX_PLUGIN_INSTRUCTIONS=1`. See
[plugins](./plugins.md#opencode-v1-plugin) for the full option list.

## Next

[Now what](./now-what.md) — config, surfaces, the plugin, and what to
do when something is wrong.
Loading