Skip to content

Ollama remote api not working and provider diagnostic shows incorrect API base URL when custom api_base is configured #147

Description

@ricardoamaro

Bug Description

The mcp-cli provider diagnostic ollama command shows the default http://localhost:11434 API base URL even when a custom api_base is configured in ~/.chuk_llm/providers.yaml.

Steps to Reproduce

Verified the configuration is saved:

cat ~/.chuk_llm/providers.yaml

Shows:

ollama:
  api_base: http://192.168.0.22:11434
  default_model: mistral
  1. Run diagnostic:
uvx mcp-cli provider diagnostic ollama

Expected Behavior

The diagnostic should display:

│ ollama   │ ✅ Ready │ 7 models │ 📡       │ API: http://192.168.0.22:11434 | Discovery: ✅ │

Actual Behavior

The diagnostic shows:

│ ollama   │ ✅ Ready │ 7 models │ 📡       │ API: http://localhost:11434 | Discovery: ✅ │

Prompt Diagnostics

$ curl http://192.168.0.22:11434
Ollama is running  

$ uvx mcp-cli cmd --provider ollama --model mistral --prompt "hello"
✓ MCP CLI ready
Available commands: chat, cmd, models, ping, prompts, provider, providers, resources, servers, tools
Use --help to see all options
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/projects/hostdir' ]
[07/13/25 02:19:00] INFO     Processing request of type PingRequest                                                                                            server.py:558
INFO     Processing request of type ListToolsRequest                                                                                       server.py:558
[07/13/25 02:19:00] INFO     Processing request of type PingRequest                                                                                            server.py:558
INFO     Processing request of type ListToolsRequest                                                                                       server.py:558
ERROR    Error in Ollama completion: Failed to connect to Ollama. Please check that Ollama is downloaded, running and accessible. https://ollama.com/download
Error: Failed to connect to Ollama. Please check that Ollama is downloaded, running and accessible. https://ollama.com/download
$ uv pip install mcp-cli --system
Using Python 3.13.4 environment 
Resolved 53 packages in 20ms
Installed 2 packages in 15ms
 + chuk-mcp==0.5
 + mcp-cli==0.2.4

Possible Root Cause

The provider info appears to contain the library's default values rather than the user's customized configuration from ~/.chuk_llm/providers.yaml, as per the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions