Skip to content

Commit f7985d3

Browse files
authored
Merge pull request #163 from WolframResearch/feature/docker-docs-update
Docs: Overhaul Docker usage guide
2 parents 27f0c1f + 393a573 commit f7985d3

3 files changed

Lines changed: 80 additions & 68 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#
1313
# For node-locked licensing (free but requires persistent storage):
1414
# docker run -i --rm \
15-
# -v ./Licensing:/root/.WolframEngine/Licensing \
15+
# -v ./Licensing:/home/wolframengine/.WolframEngine/Licensing \
1616
# -e MCP_SERVER_NAME=Wolfram \
1717
# ghcr.io/wolframresearch/mcpserver:latest
1818

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ A Wolfram Language toolkit for integrating with AI agents and LLMs — providing
3131
- **MCP Apps** for interactive UI resources in supported clients (e.g., embedded notebook viewers, Wolfram\|Alpha result displays)
3232
- **Agent Skills** for distributing Wolfram tools as portable skills to AI coding agents (Claude Code, Cursor, Gemini CLI, VS Code, and [more](https://agentskills.io/))
3333
- **Paclet extensions** allowing third-party paclets to contribute MCP tools, prompts, and servers via the `"AgentTools"` extension
34+
- **Docker image** for running the MCP server in a container without a local Wolfram Engine installation
3435

3536
## Requirements
3637

@@ -52,6 +53,14 @@ PacletInstall["Wolfram/AgentTools"]
5253
Needs["Wolfram`AgentTools`"]
5354
```
5455

56+
### Docker Image
57+
58+
A prebuilt Docker image is available as an alternative to a local Wolfram Engine installation. See [Docker documentation](docs/docker.md) for setup and MCP client configuration examples.
59+
60+
```bash
61+
docker pull ghcr.io/wolframresearch/mcpserver:latest
62+
```
63+
5564
## Quick Start
5665

5766
Install a Wolfram MCP server for Claude Desktop:

docs/docker.md

Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,74 @@
22

33
This guide explains how to run the Wolfram MCP Server using Docker containers.
44

5-
## Quick Start
5+
## Initial Setup
66

7-
Pull and run the image:
7+
Pull the image to your local machine:
88

99
```bash
10-
docker run -i --rm \
11-
-e WOLFRAMSCRIPT_ENTITLEMENTID=your-entitlement-id \
12-
ghcr.io/wolframresearch/mcpserver:latest
10+
docker pull ghcr.io/wolframresearch/mcpserver:latest
1311
```
1412

15-
## Prerequisites
16-
17-
### Wolfram Engine License
13+
**Note:** On Windows, you'll need to ensure that [Docker Desktop](https://www.docker.com/products/docker-desktop/) is running before using `docker` commands.
1814

19-
The MCP server requires a valid Wolfram Engine license. You have two options:
15+
### Configure Licensing
2016

21-
#### Option 1: Entitlement ID (Recommended for Containers)
17+
#### Option 1: Entitlement ID
2218

2319
Use a Wolfram Service Credits entitlement ID. This is ideal for ephemeral containers since no persistent storage is needed.
2420

25-
1. Obtain an entitlement ID from [Wolfram Service Credits](https://www.wolfram.com/service-credits/)
26-
2. Pass it via environment variable:
27-
```bash
28-
-e WOLFRAMSCRIPT_ENTITLEMENTID=O-XXXX-XXXXXXXXXXXXX
21+
1. Obtain an entitlement ID by evaluating the following in Wolfram Language (adjust the settings as desired):
22+
```wl
23+
entitlement = CreateLicenseEntitlement @ <|
24+
(* Number of kernels to allow simultaneously: *)
25+
"StandardKernelLimit" -> 4,
26+
(* Time limit for a kernel activated using this entitlement: *)
27+
"LicenseExpiration" -> Quantity[ 30, "Minutes" ],
28+
(* Time for which the entitlement is valid: *)
29+
"EntitlementExpiration" -> Quantity[ 1, "Months" ]
30+
|>
31+
```
32+
33+
2. Copy the entitlement ID to the clipboard:
34+
```wl
35+
CopyToClipboard[entitlement["EntitlementID"]]
36+
```
37+
38+
3. Pass it via environment variable in your MCP client configuration (see below for examples):
39+
```json
40+
"-e", "WOLFRAMSCRIPT_ENTITLEMENTID=<entitlement-id>"
2941
```
3042

31-
**Note:** Service credits are consumed while the kernel is running.
43+
**Note:** Service credits are consumed while the kernel is running, so this method is best for short-lived containers.
3244

3345
#### Option 2: Node-Locked License (Free)
3446

35-
Use a free [Wolfram Engine Developer License](https://www.wolfram.com/developer-license/). This requires persistent storage for the license file.
47+
Use an existing license associated with your Wolfram ID or get a free [Wolfram Engine Developer License](https://www.wolfram.com/developer-license/). This requires persistent storage for the license file.
48+
49+
1. If needed, get a free license at https://www.wolfram.com/developer-license/
3650

37-
1. Get a free license at https://www.wolfram.com/developer-license/
3851
2. Activate once interactively:
3952
```bash
40-
docker run -it --entrypoint wolframscript \
41-
-v ./Licensing:/root/.WolframEngine/Licensing \
53+
docker run -it --rm --entrypoint wolframscript \
54+
-v ./Licensing:/home/wolframengine/.WolframEngine/Licensing \
4255
ghcr.io/wolframresearch/mcpserver:latest
4356
```
57+
4458
3. Enter your Wolfram ID credentials when prompted
45-
4. For subsequent runs, mount the same licensing directory:
59+
60+
4. Verify the license is activated (it should not prompt for credentials):
4661
```bash
47-
docker run -i --rm \
48-
-v ./Licensing:/root/.WolframEngine/Licensing \
62+
docker run -it --rm --entrypoint wolframscript \
63+
-v ./Licensing:/home/wolframengine/.WolframEngine/Licensing \
4964
ghcr.io/wolframresearch/mcpserver:latest
5065
```
5166

52-
**Note:** The license expires periodically and will auto-renew automatically when the Wolfram kernel starts and the container has internet connectivity. Ensure that the `./Licensing` directory is kept persistent and mounted on every run so that the renewed license is preserved across container restarts.
67+
5. Ensure the volume is mounted in your MCP client configuration (see below for examples):
68+
```json
69+
"-v", "/path/to/Licensing:/home/wolframengine/.WolframEngine/Licensing"
70+
```
71+
72+
**Note:** In MCP client configurations, use an absolute host path rather than `./Licensing`, since many clients launch `docker` with a working directory that is not the project directory. Change `/path/to/Licensing` to wherever you want to store the license information. Ensure that the licensing directory is kept persistent and mounted on every run so that the renewed license is preserved across container restarts.
5373

5474
## Server Configurations
5575

@@ -72,7 +92,7 @@ docker run -i --rm \
7292

7393
## Mounting a Workspace Directory
7494

75-
The container starts in an empty `/workspace` directory. You can mount a host directory here to give the MCP server access to your files:
95+
The container starts in an empty `/workspace` directory. You can mount a host directory here to give the MCP server access to your project files:
7696

7797
```bash
7898
docker run -i --rm \
@@ -85,31 +105,25 @@ This allows the server to read and write files in your project directory. For ex
85105

86106
```bash
87107
docker run -i --rm \
88-
-v $(pwd):/workspace \
108+
-v .:/workspace \
89109
-e WOLFRAMSCRIPT_ENTITLEMENTID=your-id \
90110
ghcr.io/wolframresearch/mcpserver:latest
91111
```
92112

93-
On Windows (PowerShell):
94-
```powershell
95-
docker run -i --rm `
96-
-v ${PWD}:/workspace `
97-
-e WOLFRAMSCRIPT_ENTITLEMENTID=your-id `
98-
ghcr.io/wolframresearch/mcpserver:latest
99-
```
113+
Mounting a directory is necessary if you want to use tools that need to read or write files, e.g., `ReadNotebook`, `WriteNotebook`, `TestReport`, `CodeInspector`, etc.
100114

101115
**Security Note:** The container will have full read/write access to the mounted directory. Only mount directories you trust the MCP server to access.
102116

103-
## MCP Client Configuration
117+
## Example MCP Client Configurations
104118

105119
### Claude Desktop
106120

107-
Add to `~/.config/claude/claude_desktop_config.json` (Linux) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
121+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
108122

109123
```json
110124
{
111125
"mcpServers": {
112-
"wolfram": {
126+
"Wolfram": {
113127
"command": "docker",
114128
"args": [
115129
"run", "-i", "--rm",
@@ -129,33 +143,13 @@ Add to your project's `.mcp.json` or global `~/.claude.json`:
129143
```json
130144
{
131145
"mcpServers": {
132-
"wolfram": {
133-
"command": "docker",
134-
"args": [
135-
"run", "-i", "--rm",
136-
"-e", "WOLFRAMSCRIPT_ENTITLEMENTID=your-entitlement-id",
137-
"-e", "MCP_SERVER_NAME=WolframLanguage",
138-
"ghcr.io/wolframresearch/mcpserver:latest"
139-
]
140-
}
141-
}
142-
}
143-
```
144-
145-
### With Workspace Mount
146-
147-
To give the MCP server access to your project files, mount a directory to `/workspace`:
148-
149-
```json
150-
{
151-
"mcpServers": {
152-
"wolfram": {
146+
"Wolfram": {
153147
"command": "docker",
154148
"args": [
155149
"run", "-i", "--rm",
156150
"-v", "/path/to/your/project:/workspace",
157151
"-e", "WOLFRAMSCRIPT_ENTITLEMENTID=your-entitlement-id",
158-
"-e", "MCP_SERVER_NAME=Wolfram",
152+
"-e", "MCP_SERVER_NAME=WolframLanguage",
159153
"ghcr.io/wolframresearch/mcpserver:latest"
160154
]
161155
}
@@ -170,11 +164,11 @@ For clients using node-locked licensing, include the licensing volume mount:
170164
```json
171165
{
172166
"mcpServers": {
173-
"wolfram": {
167+
"Wolfram": {
174168
"command": "docker",
175169
"args": [
176170
"run", "-i", "--rm",
177-
"-v", "/path/to/Licensing:/root/.WolframEngine/Licensing",
171+
"-v", "/path/to/Licensing:/home/wolframengine/.WolframEngine/Licensing",
178172
"-e", "MCP_SERVER_NAME=Wolfram",
179173
"ghcr.io/wolframresearch/mcpserver:latest"
180174
]
@@ -188,11 +182,11 @@ You can combine multiple volume mounts (licensing + workspace):
188182
```json
189183
{
190184
"mcpServers": {
191-
"wolfram": {
185+
"Wolfram": {
192186
"command": "docker",
193187
"args": [
194188
"run", "-i", "--rm",
195-
"-v", "/path/to/Licensing:/root/.WolframEngine/Licensing",
189+
"-v", "/path/to/Licensing:/home/wolframengine/.WolframEngine/Licensing",
196190
"-v", "/path/to/your/project:/workspace",
197191
"-e", "MCP_SERVER_NAME=Wolfram",
198192
"ghcr.io/wolframresearch/mcpserver:latest"
@@ -244,15 +238,22 @@ This allows you to test changes without rebuilding the image.
244238

245239
## Troubleshooting
246240

247-
### "Kernel initialization failed"
241+
### MCP server fails to start on Windows
242+
243+
On Windows, you'll need to ensure that [Docker Desktop](https://www.docker.com/products/docker-desktop/) is running before starting the MCP server.
248244

249-
This usually indicates a licensing issue. Verify:
245+
### "Your Wolfram Engine installation is not activated"
246+
247+
This usually indicates a licensing issue. Verify that:
250248
- Your entitlement ID is valid and has available credits
251249
- Or your node-locked license directory is mounted correctly
252250

253-
### Slow startup
251+
### MCP server startup times out
254252

255-
The first kernel startup takes several seconds. This is normal for Wolfram Engine. Pre-building MX files can improve this.
253+
Pulling the Docker image the first time can take a while. Before running the MCP server, try pulling the image manually to ensure it is ready for fast startup:
254+
```bash
255+
docker pull ghcr.io/wolframresearch/mcpserver:latest
256+
```
256257

257258
### Container exits immediately
258259

@@ -272,8 +273,10 @@ docker run -i --rm \
272273
| Tag | Description |
273274
|-----|-------------|
274275
| `latest` | Most recent release |
275-
| `x.y.z` | Specific version (e.g., `1.6.25`) |
276-
| `sha-xxxxx` | Specific commit |
276+
| `x.y.z` | Specific version (e.g., `2.0.13`) |
277+
| `xxxxxxx` | Specific commit (e.g., `27f0c1f`) |
278+
279+
All available tags can be found [here](https://github.com/WolframResearch/AgentTools/pkgs/container/mcpserver/versions).
277280

278281
## Architecture
279282

0 commit comments

Comments
 (0)