126 lines
5.1 KiB
Markdown
126 lines
5.1 KiB
Markdown
# Mozilla AI mcpd + devbox
|
|
|
|
Use Mozilla AI's **Go daemon** to manage the Go `devbox mcp` server. This
|
|
example was exercised with **mcpd v0.7.0** and **devbox v2.2.0** on Linux.
|
|
It discovered all five inspection tools and called status and authenticated
|
|
snapshot history through mcpd's HTTP API.
|
|
|
|
## How the pieces fit
|
|
|
|
- `devbox mcp` implements the sync tools and speaks MCP over stdio.
|
|
- [mcpd](https://github.com/mozilla-ai/mcpd) starts and manages the server and
|
|
exposes its tools through REST endpoints.
|
|
- Mozilla's [Go plugin SDK](https://github.com/mozilla-ai/mcpd-plugins-sdk-go)
|
|
extends mcpd with middleware: authentication, observability, rate limiting,
|
|
and request/response processing.
|
|
- The community [PHP plugin SDK](https://github.com/shoemoney/mcpd-plugins-sdk-php)
|
|
serves that same middleware role. `status.php` here is a plain HTTP consumer;
|
|
it does not require a plugin SDK.
|
|
|
|
The plugin SDK and the MCP tool server are separate integration points. No new
|
|
Go dependency is required in devbox for mcpd to manage it.
|
|
|
|
## 1. Install the prerequisites
|
|
|
|
Install mcpd from [Mozilla's releases](https://github.com/mozilla-ai/mcpd/releases)
|
|
and Docker. Download a **Linux** devbox binary matching Docker's architecture
|
|
from the [devbox release](https://github.com/shoemoney/devbox/releases/tag/v2.2.0),
|
|
check its SHA256SUMS entry, and make it executable. A macOS/Windows binary
|
|
cannot run inside the Linux Alpine container.
|
|
|
|
mcpd v0.7.0 supports `uvx`, `npx`, and Docker runtimes; it has no general native
|
|
binary launcher. This example uses its Docker runtime, which starts the released
|
|
static Go binary in Alpine. No Node.js or Python server runtime is involved.
|
|
|
|
## 2. Select the devbox configuration
|
|
|
|
Copy `runtime.example.toml` to an untracked local runtime file and replace:
|
|
|
|
- `binary`: absolute path to the Linux devbox binary.
|
|
- `config`: absolute path to the **devbox config directory itself**, such as
|
|
`/home/alice/.config/devbox`, containing the existing enrollment.
|
|
- `certificates`: the Linux host's CA certificate directory, usually
|
|
`/etc/ssl/certs`.
|
|
|
|
For a fresh configuration, create the config directory first. Enroll using the
|
|
normal CLI before expecting authenticated tools to work. The config directory
|
|
and binary are mounted read-only. No tokens belong in `mcpd.toml` or the example
|
|
runtime file. Keep the actual enrollment directory private.
|
|
|
|
mcpd's Docker runtime uses host networking in v0.7.0. On Linux this gives the
|
|
client the host's network routes, including its regular Tailscale connection.
|
|
The hub can continue using embedded Tailscale. This is a Linux host example;
|
|
Docker Desktop networking, certificate paths, and filesystem mounts need their
|
|
own configuration on macOS and Windows.
|
|
|
|
## 3. Start mcpd
|
|
|
|
Run from this directory, substituting your local runtime file:
|
|
|
|
```bash
|
|
mcpd daemon \
|
|
--config-file ./mcpd.toml \
|
|
--runtime-file /absolute/path/to/runtime.local.toml \
|
|
--addr 127.0.0.1:8090 \
|
|
--timeout-mcp-request 150s
|
|
```
|
|
|
|
The daemon request timeout is longer than devbox's default two-minute command
|
|
timeout. The tool allowlist is explicit: status, doctor, conflicts, history, and
|
|
memberships. Only inspection tools are enabled.
|
|
|
|
## 4. Call devbox through the daemon
|
|
|
|
```bash
|
|
curl -fsS http://127.0.0.1:8090/api/v1/servers/devbox/tools
|
|
|
|
curl -fsS -X POST \
|
|
http://127.0.0.1:8090/api/v1/servers/devbox/tools/devbox_status \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{}'
|
|
|
|
curl -fsS -X POST \
|
|
http://127.0.0.1:8090/api/v1/servers/devbox/tools/devbox_history \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"share":"projects","limit":5}'
|
|
```
|
|
|
|
mcpd v0.7.0 returns devbox's JSON text result as a JSON string. Decode the HTTP
|
|
JSON, then decode that string to get devbox's result envelope. `status.php`
|
|
handles this and also accepts an already-decoded envelope:
|
|
|
|
```bash
|
|
MCPD_URL=http://127.0.0.1:8090 php status.php
|
|
```
|
|
|
|
**These are REST endpoints.** They are not Streamable HTTP MCP endpoints. For
|
|
an MCP-only agent, use Mozilla's
|
|
[mcpd-proxy](https://github.com/mozilla-ai/mcpd-client#manual-integration) adapter,
|
|
or connect the agent directly to `devbox mcp` as in the
|
|
[built-in MCP guide](../../docs/MCP.md). The proxy configuration is documented
|
|
upstream; the REST path above is the integration exercised here.
|
|
|
|
## Workspace paths and tool visibility
|
|
|
|
If the enrolled configuration contains mounts, add matching workspace volumes
|
|
to both files before using conflict/doctor tools. Each workspace must appear
|
|
inside the container at the **same absolute path** used by `daemon.toml`.
|
|
For example, if the real mount lives at `/home/alice/Projects`:
|
|
|
|
```toml
|
|
# Add to mcpd.toml
|
|
[servers.volumes.workspace]
|
|
path = "/home/alice/Projects:ro"
|
|
required = true
|
|
```
|
|
|
|
```toml
|
|
# Add under [servers.devbox.volumes] in the local runtime file
|
|
workspace = "/home/alice/Projects"
|
|
```
|
|
|
|
Without workspace mounts, status/history/membership queries can still use the
|
|
config and hub, but filesystem diagnostics cannot inspect the actual files.
|
|
This example does not enable mutation tools. Enabling them also requires writable
|
|
mounts, appropriate container ownership, and an updated mcpd tool allowlist.
|
|
Use the [native MCP guide](../../docs/MCP.md) for the tool permission model.
|