Skip to content

Commit de5c475

Browse files
committed
Add Docker usage documentation
Users need to know how to run the CLI via Docker, including config mounting, env vars, and the limitations around stdio servers and OAuth. Added Docker as an install option in the README and getting-started guide, plus a dedicated howto page covering aliases, env-file, piping, version pinning, and what doesn't work in containers. Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
1 parent 220a6c4 commit de5c475

4 files changed

Lines changed: 159 additions & 0 deletions

File tree

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Output is always JSON. Pipe it, `jq` it, script it.
2828
# Homebrew (macOS and Linux)
2929
brew install avelino/mcp/mcp
3030

31+
# Docker
32+
docker pull ghcr.io/avelino/mcp
33+
alias mcp='docker run --rm -v ~/.config/mcp:/root/.config/mcp ghcr.io/avelino/mcp'
34+
3135
# Pre-built binary from GitHub Releases
3236
# Download the latest from https://github.com/avelino/mcp/releases
3337

@@ -130,6 +134,36 @@ If you don't pass JSON arguments on the command line, `mcp` reads from stdin:
130134
echo '{"query": "is:unresolved"}' | mcp sentry search_issues
131135
```
132136

137+
## Docker
138+
139+
The CLI is available as a multi-arch Docker image (amd64/arm64):
140+
141+
```bash
142+
# Run directly
143+
docker run --rm -v ~/.config/mcp:/root/.config/mcp ghcr.io/avelino/mcp --list
144+
145+
# Call a tool
146+
docker run --rm -v ~/.config/mcp:/root/.config/mcp ghcr.io/avelino/mcp sentry search_issues '{"query": "is:unresolved"}'
147+
148+
# Pass environment variables for servers that need them
149+
docker run --rm \
150+
-v ~/.config/mcp:/root/.config/mcp \
151+
-e GITHUB_TOKEN \
152+
ghcr.io/avelino/mcp github search_repositories '{"query": "mcp"}'
153+
154+
# Use an alias for convenience
155+
alias mcp='docker run --rm -v ~/.config/mcp:/root/.config/mcp ghcr.io/avelino/mcp'
156+
mcp sentry --list
157+
```
158+
159+
Available tags:
160+
161+
| Tag | Description |
162+
|---|---|
163+
| `latest` | Latest stable release |
164+
| `x.y.z` | Pinned version |
165+
| `beta` | Latest build from main branch |
166+
133167
## Environment variables
134168

135169
| Variable | Description |

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
## How-to
1919

20+
* [Docker](howto/docker.md)
2021
* [Supported services](howto/services.md)
2122
* [Troubleshooting](howto/troubleshooting.md)
2223

docs/getting-started.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,24 @@ chmod +x mcp-*
1919
sudo mv mcp-* /usr/local/bin/mcp
2020
```
2121

22+
**Docker:**
23+
24+
```bash
25+
docker pull ghcr.io/avelino/mcp
26+
```
27+
28+
To use it like a native command, create an alias:
29+
30+
```bash
31+
alias mcp='docker run --rm -v ~/.config/mcp:/root/.config/mcp ghcr.io/avelino/mcp'
32+
```
33+
34+
Add the alias to your shell profile (`~/.bashrc`, `~/.zshrc`, or `~/.config/fish/config.fish`) to make it permanent. If your servers need environment variables (API tokens, etc.), pass them with `-e`:
35+
36+
```bash
37+
alias mcp='docker run --rm -v ~/.config/mcp:/root/.config/mcp -e GITHUB_TOKEN ghcr.io/avelino/mcp'
38+
```
39+
2240
**From source (requires Rust):**
2341

2442
```bash

docs/howto/docker.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Running with Docker
2+
3+
The `mcp` CLI is available as a multi-arch Docker image (amd64/arm64) on GitHub Container Registry.
4+
5+
## Pull the image
6+
7+
```bash
8+
docker pull ghcr.io/avelino/mcp
9+
```
10+
11+
## Available tags
12+
13+
| Tag | Description |
14+
|---|---|
15+
| `latest` | Latest stable release |
16+
| `x.y.z` | Pinned version (e.g. `0.1.0`) |
17+
| `beta` | Latest build from main branch |
18+
19+
## Basic usage
20+
21+
The CLI runs as the container entrypoint. Pass arguments directly:
22+
23+
```bash
24+
docker run --rm ghcr.io/avelino/mcp --help
25+
docker run --rm ghcr.io/avelino/mcp search github
26+
```
27+
28+
## Using your config
29+
30+
Mount your local config directory so the container can access your server definitions:
31+
32+
```bash
33+
docker run --rm \
34+
-v ~/.config/mcp:/root/.config/mcp \
35+
ghcr.io/avelino/mcp --list
36+
```
37+
38+
## Passing environment variables
39+
40+
Servers that need API tokens or other secrets require environment variables. Pass them with `-e`:
41+
42+
```bash
43+
docker run --rm \
44+
-v ~/.config/mcp:/root/.config/mcp \
45+
-e GITHUB_TOKEN \
46+
-e SLACK_TOKEN \
47+
ghcr.io/avelino/mcp github list_repositories '{"query": "mcp"}'
48+
```
49+
50+
You can also use an env file:
51+
52+
```bash
53+
# .env
54+
GITHUB_TOKEN=ghp_xxxx
55+
SLACK_TOKEN=xoxb-xxxx
56+
```
57+
58+
```bash
59+
docker run --rm \
60+
-v ~/.config/mcp:/root/.config/mcp \
61+
--env-file .env \
62+
ghcr.io/avelino/mcp sentry search_issues '{"query": "is:unresolved"}'
63+
```
64+
65+
## Shell alias
66+
67+
For day-to-day use, create an alias so `mcp` works like a native command:
68+
69+
```bash
70+
# bash / zsh — add to ~/.bashrc or ~/.zshrc
71+
alias mcp='docker run --rm -v ~/.config/mcp:/root/.config/mcp --env-file ~/.config/mcp/.env ghcr.io/avelino/mcp'
72+
73+
# fish — add to ~/.config/fish/config.fish
74+
alias mcp 'docker run --rm -v ~/.config/mcp:/root/.config/mcp --env-file ~/.config/mcp/.env ghcr.io/avelino/mcp'
75+
```
76+
77+
Then use it normally:
78+
79+
```bash
80+
mcp --list
81+
mcp sentry search_issues '{"query": "is:unresolved"}'
82+
mcp search filesystem
83+
```
84+
85+
## Piping JSON
86+
87+
Pipe input via stdin with `-i` (Docker's interactive flag):
88+
89+
```bash
90+
echo '{"query": "is:unresolved"}' | docker run --rm -i \
91+
-v ~/.config/mcp:/root/.config/mcp \
92+
ghcr.io/avelino/mcp sentry search_issues
93+
```
94+
95+
## Pinning a version
96+
97+
For CI/CD or reproducible environments, pin to a specific version:
98+
99+
```bash
100+
docker run --rm ghcr.io/avelino/mcp:0.1.0 --help
101+
```
102+
103+
## Limitations
104+
105+
- **Stdio servers only work if the runtime is available inside the container.** The default image includes only the `mcp` binary and `ca-certificates`. Servers that require `npx`, `python`, or other runtimes won't work unless you build a custom image. HTTP servers (configured with `url`) work out of the box.
106+
- **OAuth browser flow doesn't work in Docker.** For HTTP servers that need OAuth, run `mcp add <server>` on your host first to complete authentication, then mount the config directory (which includes `auth.json`).

0 commit comments

Comments
 (0)