Quick Start
The commands below start a server for clients on the same machine. The server answers athttp://localhost:3010/mcp and is not reachable from other hosts.
- Docker
- Podman
-p 127.0.0.1:3010:3010publishes the port on the host’s loopback address only.-p 3010:3010publishes it on every host interface, which makes an unauthenticated server that holds IBM i credentials reachable from the network.MCP_ALLOW_UNAUTHENTICATED_HTTP=trueaccepts running without authentication. Without this variable or anMCP_AUTH_MODEsetting, a container that holds IBM i credentials exits at startup. Network Exposure and Authentication describes both settings.
Network Exposure and Authentication
The server holds the IBM i credentials it is started with. Any client that can send it a request can run SQL with those credentials. Two checks limit which clients can do so.Host header validation
Every request must address the server aslocalhost, 127.0.0.1, or a name listed in MCP_ALLOWED_HOSTS. A request that uses any other name receives 403 Forbidden: Host not allowed. The check applies to every route, including /healthz.
The check blocks DNS rebinding: a web page changes the DNS record for its own hostname to 127.0.0.1 after loading, then sends requests from the browser to the server on the visitor’s machine. Those requests carry the page’s hostname in the Host header and are rejected.
MCP_ALLOWED_HOSTS accepts a comma-separated list. The 403 response body does not include the rejected name; the container log does.
Startup check for unauthenticated servers
The image setsMCP_HTTP_HOST=0.0.0.0, which published ports require. A server bound this way, holding IBM i credentials, with no authentication configured, is usable by anyone who can reach the port. The server refuses this configuration and exits with:
DB2i_* variables or a tools YAML, since YAML sources: entries carry their own connection details. Set one of the following:
Built-in IBM i Sign-On
WithMCP_AUTH_MODE=oauth and no OAUTH_ISSUER_URL, users sign on with their IBM i user profile and the container holds no service account password. Read Built-in IBM i Sign-On first; this section covers what is specific to a container.
A container binds 0.0.0.0, and in this mode the server does not listen for passwords in clear on a network interface. Give it its own TLS listener by mounting a certificate and key:
- No
DB2i_USER,DB2i_PASSorDB2i_IGNORE_UNAUTHORIZED.DB2i_PASSstops startup in this mode.DB2i_IGNORE_UNAUTHORIZED=truestops it together withDB2i_SERVER_CERT_FILE; without a certificate file it turns verification of the Mapepire certificate off, so users’ passwords go to a server whose identity is not checked. - The mounted files must be readable by the container’s user (
appuser, not root). --no-healthcheck. The image’s built-in health check requestshttp://127.0.0.1:3010/healthz, which a TLS listener does not answer, so the container would be reported unhealthy. Checkhttps://mcp.example.com:3010/healthzfrom outside instead.- One container. Sign-ons are held in the memory of one process. Do not run replicas, and expect every user to sign on again after the container restarts.
- Client addresses. Depending on how the container runtime publishes the port, the server may see the address of the runtime’s bridge gateway instead of each client’s own address (common on Docker Desktop). All users then share one address for
OAUTH_SIGNON_ALLOWED_CIDRS, the code address binding and the per-address rate limit, and that address is a private one, which the defaultOAUTH_SIGNON_ALLOWED_CIDRSadmits. The server cannot detect this at startup. On Linux,--network hostavoids it.
OAUTH_ADMIN_SOCKET is already in the environment:
https, and list the proxy’s address in MCP_TRUSTED_PROXIES.
Available Images
Images are published to GitHub Container Registry on each release. Multi-architecture tags select the image for the host’s architecture; single-architecture tags pin one platform.Using an Environment File
Store the configuration in a.env file:
- Docker
- Podman
Mounting Custom SQL Tools
To use your own YAML tool configurations, mount them into the container:- Docker
- Podman
The
:ro flag mounts the directory as read-only inside the container, which is a security best practice./app and the server entry point is packages/server/dist/index.js. Start the server with node packages/server/dist/index.js, as the image’s default command does. Do not use npx ibmi-mcp-server inside the container: the server’s package is @ibm/ibmi-mcp-server, and when the unscoped name does not resolve locally, npx tries to download a package by that name from the registry.
A mounted tools directory counts as IBM i credentials for the startup check, because YAML sources: entries carry connection details. The .env file must set MCP_AUTH_MODE or MCP_ALLOW_UNAUTHENTICATED_HTTP=true.
Docker Compose
For a more complete setup, use Docker Compose to run the MCP server alongside supporting services.Standalone Server
Create adocker-compose.yml:
.env file is the one from Using an Environment File. The image contains no curl, so the healthcheck uses Node’s built-in fetch. It addresses the server as 127.0.0.1 and passes the Host check. The image ships the same check as a built-in HEALTHCHECK (see Health Checks), so the healthcheck: block is optional; keep it to change the timing. Other services in the same Compose file reach the server as http://ibmi-mcp-server:3010/mcp; that name must be listed in MCP_ALLOWED_HOSTS.
Start the service:
- Docker
- Podman
With MCP Context Forge Gateway
The repository includes a full-stack Docker Compose configuration with MCP Context Forge — a gateway that provides tool federation, authentication, rate limiting, and an admin UI..env:
- Set
DB2i_HOST,DB2i_USER, andDB2i_PASS. - Set
MCP_ALLOWED_HOSTS=ibmi-mcp-server. The gateway addresses the server by container name. - Set
MCP_AUTH_MODE, or setMCP_ALLOW_UNAUTHENTICATED_HTTP=true. The stack mounts the repository’stools/directory, which counts as IBM i credentials for the startup check. - Remove the
MCP_HTTP_HOST=127.0.0.1line. Compose passes.envto the container, and that value makes the server unreachable through the published port.
The MCP Context Forge Gateway image must be built locally before starting the stack. See the MCP Context Forge docs for build instructions.
Container Management
Viewing Logs
- Docker
- Podman
Stopping and Removing
- Docker
- Podman
Health Checks
The server exposes a health endpoint at/healthz:
403. Set a Host: localhost header on such probes; the repository’s OpenShift deployment manifest does this.
The image has a built-in HEALTHCHECK: every 30 seconds it requests http://127.0.0.1:$MCP_HTTP_PORT/healthz (port 3010 by default) with a 5-second timeout, a 15-second start period and 3 retries. docker ps shows the result as healthy or unhealthy. A container run with MCP_TRANSPORT_TYPE=stdio has no HTTP endpoint and reports unhealthy unless it is started with --no-healthcheck. Kubernetes and OpenShift ignore the image’s HEALTHCHECK; use probes there.
Logs
Logs go to the container’s output (docker logs). The server also writes rotating log files to /home/appuser/.ibmi-mcp-server/logs unless LOGS_DIR points elsewhere. With a read-only root file system (--read-only) that directory cannot be created: the server prints one warning and logs to stderr only. Mount a volume or tmpfs at LOGS_DIR to keep log files.
Building from Source
The image is built frompackages/server/Dockerfile with the repository root as the build context. The root is required because the npm workspaces layout keeps a single package-lock.json there.
ibmi-mcp-server:local for ghcr.io/ibm/ibmi-mcp-server:latest in any command on this page.
The Dockerfile has three stages:
- builder — installs all workspace dependencies and runs
npm run build -w @ibm/ibmi-mcp-server - prod-deps — installs the server’s production dependencies only; the CLI workspace is excluded
- runner — copies
node_modulesfromprod-depsand the compiledpackages/server/distfrombuilder, then startsnode packages/server/dist/index.js
.dockerignore keeps node_modules/, dist/, .git/, .github/, .claude/, agents/, and .env files out of the build context.
The image is built on
node:22-bookworm-slim and runs as a non-root user (appuser) that owns its home directory, /home/appuser. Port 3010 is exposed by default.Troubleshooting
Container won't start
Container won't start
Check the container logs for error details:Common causes:
- The log contains
Refusing to start. See the next entry. - Missing or incorrect
DB2i_*environment variables - Mapepire not running on the IBM i system
- Network connectivity issues to IBM i host
Container exits with 'Refusing to start: unauthenticated HTTP transport'
Container exits with 'Refusing to start: unauthenticated HTTP transport'
The server holds IBM i credentials, has no authentication configured, and is bound to
0.0.0.0. It refuses this combination. Set MCP_AUTH_MODE=oauth, or set MCP_ALLOW_UNAUTHENTICATED_HTTP=true and publish the port with -p 127.0.0.1:3010:3010. See Network Exposure and Authentication.Container exits with 'MCP_AUTH_MODE=jwt is no longer supported'
Container exits with 'MCP_AUTH_MODE=jwt is no longer supported'
The
jwt mode was removed. Use MCP_AUTH_MODE=oauth with MCP_RESOURCE_URL and OAUTH_ISSUER_URL. See OAuth Authentication.Requests return 403 Forbidden
Requests return 403 Forbidden
Forbidden: Host not allowed. means the client addresses the server by a name that is not localhost and is not listed in MCP_ALLOWED_HOSTS. The container log records the rejected name. Add it to MCP_ALLOWED_HOSTS and restart the container.Forbidden: Origin not allowed. means the request came from a browser page whose origin is not listed in MCP_ALLOWED_ORIGINS. Add the origin, for example MCP_ALLOWED_ORIGINS=http://localhost:3000. The sign-in page of the built-in IBM i sign-on needs no entry: the origin of MCP_RESOURCE_URL is always accepted. If its form is refused with this message, MCP_RESOURCE_URL is not the URL users open in their browser.Cannot connect to IBM i from container
Cannot connect to IBM i from container
Verify the container can reach your IBM i system (the image has no If using Docker Desktop on macOS/Windows, ensure the IBM i host is reachable from within the VM.
nc; use Node):Port conflicts
Port conflicts
If port 3010 is already in use on the host, map to a different host port. (If the port is taken inside the container, the server exits with
Port 3010 on 0.0.0.0 is already in use; it does not move to another port.)Permission denied on mounted volumes
Permission denied on mounted volumes
The container runs as a non-root user. Ensure mounted files are readable:On SELinux-enabled systems (RHEL/Fedora), add the
:z flag: