Skip to content

Commit 9b0ea39

Browse files
committed
v1.8.0: mcp wrapper passthrough + MCP scope docs
- wrapper.sh: add `mcp` to passthrough commands so `claudebox mcp list`, `claudebox mcp add ...`, etc. work end-to-end (previously only -v/--version/doctor/auth were passed through) - tests/test_wrapper.sh: add `mcp list` passthrough case to the table - README: new "MCP servers" subsection under Customization documenting the three scopes (project `.mcp.json`, user/local `~/.claude.json` under top-level mcpServers), file format, `claude mcp add --scope project|user|local` CLI examples, and how cron/Telegram modes reach external systems via MCP - README: utility-commands list now mentions `claudebox mcp <args>`
1 parent 5fa6664 commit 9b0ea39

3 files changed

Lines changed: 49 additions & 1 deletion

File tree

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Beyond just running Claude Code in Docker, claudebox adds skill injection (auto-
3838
- [Custom Scripts](#custom-scripts-claudebin)
3939
- [Init Hooks](#init-hooks-claudeinitd)
4040
- [Always-Active Skills](#always-active-skills-claudealways-skills)
41+
- [MCP Servers](#mcp-servers)
4142
- [Gotchas](#gotchas)
4243
- [License](#license)
4344

@@ -248,6 +249,7 @@ claudebox --version # show the Claude Code CLI version
248249
claudebox -v # same thing
249250
claudebox doctor # run health checks
250251
claudebox auth # manage authentication
252+
claudebox mcp <args...> # manage MCP servers (e.g. `claudebox mcp list`, `claudebox mcp add ...`)
251253
claudebox setup-token # interactive OAuth token setup
252254
claudebox stop # stop the running interactive container for this workspace
253255
claudebox clear-session # delete session history for this workspace
@@ -931,6 +933,51 @@ EOF
931933

932934
Multiple skills stack — every `SKILL.md` found is injected. Any user-supplied `appendSystemPrompt` (via API request body, `--append-system-prompt` CLI flag, `X-Claude-Append-System-Prompt` header, etc.) is appended after the always-skills content, so per-request instructions take precedence.
933935

936+
### MCP servers
937+
938+
Claude Code reads MCP server definitions from a few standard locations. Inside claudebox, all of these work because `~/.claude` is mounted from the host and the workspace is mounted from the host cwd:
939+
940+
| Scope | Path | Description |
941+
| --------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------ |
942+
| Project | `<workspace>/.mcp.json` | Per-repo, intended to be checked into git so the team shares the same servers |
943+
| User | `~/.claude.json` (under the `mcpServers` key) | Global, available across every project on the host |
944+
| Local | `~/.claude.json` (per-project section) | Default scope of `claude mcp add`, only affects the current project, not shared |
945+
946+
**File format** (same for `.mcp.json` and the `mcpServers` block inside `~/.claude.json`):
947+
948+
```json
949+
{
950+
"mcpServers": {
951+
"my-server": {
952+
"command": "npx",
953+
"args": ["-y", "@some/mcp-server"],
954+
"env": { "API_KEY": "..." }
955+
},
956+
"remote-http": {
957+
"type": "http",
958+
"url": "https://example.com/mcp/"
959+
}
960+
}
961+
}
962+
```
963+
964+
**Add via CLI inside the container:**
965+
966+
```bash
967+
# project scope — writes to ./.mcp.json in the workspace (commit-friendly)
968+
claude mcp add --scope project my-server -- npx -y @some/mcp-server
969+
970+
# user scope — writes to ~/.claude.json, available in every project
971+
claude mcp add --scope user my-server -- npx -y @some/mcp-server
972+
973+
# local scope (default) — per-project entry inside ~/.claude.json
974+
claude mcp add my-server -- npx -y @some/mcp-server
975+
```
976+
977+
**Inspect what's loaded:** run `/mcp` inside an interactive session.
978+
979+
This is how cron and Telegram modes reach external systems — drop your server config in `.mcp.json` (project) or `~/.claude.json` (global) and reference it from the instruction.
980+
934981
## Gotchas
935982

936983
- **`--dangerously-skip-permissions`** is always enabled. Claude has full, unrestricted access to the container. That's the entire point.

tests/test_wrapper.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ _wrapper_run() {
3333
PASSTHROUGH_CASES=(
3434
"--version|[0-9]"
3535
"-v|[0-9]"
36+
"mcp list|MCP servers"
3637
)
3738

3839
test_wrapper_passthrough() {

wrapper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fi
123123

124124
# passthrough commands — run in throwaway container, bypass entrypoint
125125
case "${1:-}" in
126-
-v|--version|doctor|auth)
126+
-v|--version|doctor|auth|mcp)
127127
docker run --rm --entrypoint claude "${DOCKER_ARGS[@]}" $CLAUDE_IMAGE "$@"
128128
exit 0
129129
;;

0 commit comments

Comments
 (0)