Skip to content

Commit 1d89ed0

Browse files
feat: add OLLAMA_URL environment variable support (#24)
- Modify CLI to check OLLAMA_URL environment variable as default - Update docker-compose.yml to remove hardcoded --ollama-url command - Update README.md to document new environment variable - Maintains backward compatibility with existing --ollama-url CLI parameter - Fixes Docker deployment issue where OLLAMA_URL was ignored
1 parent db8de92 commit 1d89ed0

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ CORS_ORIGINS="http://localhost:3000,http://localhost:8080,https://app.example.co
189189
```
190190

191191
**Environment Variables:**
192+
- `OLLAMA_URL`: URL of the Ollama server (default: `http://localhost:11434`)
193+
- Can be overridden with `--ollama-url` CLI parameter
194+
- Useful for Docker deployments and configuration management
192195
- `CORS_ORIGINS`: Comma-separated list of allowed origins (default: `*`)
193196
- `*` allows all origins (shows warning in logs)
194197
- Specific origins like `http://localhost:3000,https://myapp.com` for production

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ services:
1111
volumes:
1212
- ./mcp-config.json:/root/mcp-config.json
1313
restart: unless-stopped
14-
command: uv run ollama-mcp-bridge --ollama-url=http://host.docker.internal:11434

src/ollama_mcp_bridge/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Simple CLI entry point for MCP Proxy"""
22
import asyncio
3+
import os
34
import typer
45
import uvicorn
56
from loguru import logger
@@ -12,7 +13,7 @@ def cli_app(
1213
config: str = typer.Option("mcp-config.json", "--config", help="Path to MCP config JSON file"),
1314
host: str = typer.Option("0.0.0.0", "--host", help="Host to bind to"),
1415
port: int = typer.Option(8000, "--port", help="Port to bind to"),
15-
ollama_url: str = typer.Option("http://localhost:11434", "--ollama-url", help="Ollama server URL"),
16+
ollama_url: str = typer.Option(os.getenv("OLLAMA_URL", "http://localhost:11434"), "--ollama-url", help="Ollama server URL"),
1617
reload: bool = typer.Option(False, "--reload", help="Enable auto-reload"),
1718
version: bool = typer.Option(False, "--version", help="Show version information, check for updates and exit"),
1819
):

0 commit comments

Comments
 (0)