-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
82 lines (66 loc) · 2.88 KB
/
Dockerfile
File metadata and controls
82 lines (66 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Dockerfile for Wolfram MCP Server
# https://github.com/WolframResearch/AgentTools
#
# This image provides a containerized MCP server that enables LLMs to access
# Wolfram Language computation capabilities via the Model Context Protocol.
#
# Usage:
# docker run -i --rm \
# -e WOLFRAMSCRIPT_ENTITLEMENTID=your-entitlement-id \
# -e MCP_SERVER_NAME=Wolfram \
# ghcr.io/wolframresearch/mcpserver:latest
#
# For node-locked licensing (free but requires persistent storage):
# docker run -i --rm \
# -v ./Licensing:/home/wolframengine/.WolframEngine/Licensing \
# -e MCP_SERVER_NAME=Wolfram \
# ghcr.io/wolframresearch/mcpserver:latest
FROM wolframresearch/wolframengine:14.3
LABEL org.opencontainers.image.title="Wolfram MCP Server"
LABEL org.opencontainers.image.description="Model Context Protocol server for Wolfram Language"
LABEL org.opencontainers.image.source="https://github.com/WolframResearch/AgentTools"
LABEL org.opencontainers.image.licenses="MIT"
# Set working directory
WORKDIR /opt/AgentTools
# Copy and run prebuild script to install dependencies
# This must happen before setting -pacletreadonly
# Uses BuildKit secret mount to avoid storing the entitlement ID in any layer
COPY Scripts/DockerPrebuild.wls Scripts/
RUN --mount=type=secret,id=WOLFRAMSCRIPT_ENTITLEMENTID,env=WOLFRAMSCRIPT_ENTITLEMENTID \
wolframscript -f Scripts/DockerPrebuild.wls
# Copy paclet files (order matters for layer caching)
# Copy metadata first (changes less frequently)
COPY PacletInfo.wl .
# Copy kernel implementation
COPY --chown=wolframengine:wolframengine Kernel/ Kernel/
# Copy startup scripts
COPY Scripts/Common.wl Scripts/
COPY Scripts/StartMCPServer.wls Scripts/
COPY Scripts/BuildMX.wls Scripts/
# Copy assets needed at runtime
COPY Assets/ Assets/
COPY AGENTS.md .
# Create empty Documentation directory (required by PacletExtensionFiles during MX build)
RUN mkdir -p Documentation/English
# Build MX file for faster startup
RUN --mount=type=secret,id=WOLFRAMSCRIPT_ENTITLEMENTID,env=WOLFRAMSCRIPT_ENTITLEMENTID \
wolframscript -f Scripts/BuildMX.wls
# Environment variables
# MCP_SERVER_NAME: Which server configuration to use
# - "Wolfram" (default): General-purpose computation + Wolfram|Alpha
# - "WolframLanguage": Development & learning focused
# - "WolframAlpha": Natural language queries only
# - "WolframPacletDevelopment": Full development toolset
ENV MCP_SERVER_NAME="Wolfram"
# Wolfram system configuration
ENV WOLFRAM_SYSTEM_ID="Linux-x86-64"
# Disable automatic paclet updates
ENV WOLFRAMINIT="-pacletreadonly"
# Create empty workspace directory for user operations
USER root
RUN mkdir /workspace && chmod 777 /workspace
USER wolframengine
# Set working directory to /workspace for runtime
WORKDIR /workspace
# Entry point - MCP servers communicate via stdin/stdout
ENTRYPOINT ["/bin/bash", "-c", "exec wolframscript -script /opt/AgentTools/Scripts/StartMCPServer.wls"]