CLI options¶
Every option that has an environment-variable equivalent follows the same rule: the CLI flag wins over the environment variable.
Options¶
--config¶
Path to the MCP configuration file.
Default: mcp-config.json
--host¶
Host to bind the server to.
Default: 0.0.0.0
--port¶
Port to bind the server to. Checked for availability before uvicorn starts, so a collision fails fast with a readable error.
Default: 8000
--ollama-url¶
The Ollama server to proxy to. Works with local, remote and cloud Ollama.
Default: http://localhost:11434 · Env: OLLAMA_URL
--upstream-header¶
A header to attach to every request the bridge sends upstream, in curl style
("Name: Value"). Repeatable.
Env: UPSTREAM_HEADERS (a JSON object)
ollama-mcp-bridge --upstream-header "X-API-Key: your-key"
ollama-mcp-bridge \
--upstream-header "Authorization: Bearer xxx" \
--upstream-header "X-API-Key: yyy"
Let the shell expand a variable to keep secrets out of your shell history:
These target the hop before Ollama
Ollama itself doesn't consume these headers. They're for whatever sits between the bridge and Ollama — a reverse proxy, gateway or auth layer.
They're applied to health checks, /api/chat, and every transparently proxied
endpoint. On the proxy path, a forwarded client header whose lowercased name
collides with a configured one is dropped, so a header is never sent twice.
--max-tool-rounds¶
Maximum number of tool-execution rounds per chat request.
Default: unlimited · Env: MAX_TOOL_ROUNDS
When the limit is reached the bridge makes one final call to Ollama with no tools attached, so the model has to produce an answer instead of asking for another tool.
--system-prompt¶
A system prompt prepended to every /api/chat request.
Default: none · Env: SYSTEM_PROMPT
If the incoming messages array already starts with a system message, the request is
left alone.
--reload¶
Enable auto-reload. For development only.
--version¶
Print version information, check PyPI for a newer release, and exit.
Combining options¶
ollama-mcp-bridge \
--config custom.json \
--host 0.0.0.0 \
--port 8080 \
--ollama-url http://remote-ollama:11434 \
--max-tool-rounds 10
With an upstream API key: