Ollama MCP Server
by Ri5h18
README.md
# Ollama Cloud MCP Server
An MCP server with a ChatGPT-style web interface for choosing and chatting with Ollama Cloud models. The backend talks directly to `https://ollama.com/api`; it does not require a local Ollama daemon or local model downloads.
## What is included
- `server/mcp_server.py` - MCP stdio server with 12 tools, three prompts, and an `ollama://models` resource.
- `server/web_tools.py` - keyless public web search and readable webpage extraction.
- `server/api.py` - HTTP bridge used by the browser, including NDJSON chat streaming.
- `frontend/` - responsive React/Vite ChatGPT-style interface.
- `setup.ps1`, `run-backend.ps1`, `run-frontend.ps1` - PowerShell launchers.
## Quick start
Create or update the ignored project `.env` with your Ollama API key:
```dotenv
OLLAMA_API_KEY=your_ollama_api_key
OLLAMA_BASE_URL=https://ollama.com
OLLAMA_DEFAULT_MODEL=gpt-oss:120b-cloud
OLLAMA_REQUEST_TIMEOUT=300
```
The existing `.env` in this checkout already contains a configured key; do not commit or print it. Install dependencies once:
```powershell
cd 'C:\Users\admin\Desktop\New folder\MCP_SERVER'
.\setup.ps1
```
Start the backend and frontend in separate PowerShell terminals:
```powershell
# terminal 1
cd 'C:\Users\admin\Desktop\New folder\MCP_SERVER'
.\run-backend.ps1
# terminal 2
cd 'C:\Users\admin\Desktop\New folder\MCP_SERVER'
.\run-frontend.ps1
```
Open http://127.0.0.1:5173. The model selector is populated from the authenticated Ollama Cloud API, so available hosted models can be chosen without changing code.
The direct Cloud API uses the base model name when sending requests. For example, the UI alias `gpt-oss:120b-cloud` is sent to Ollama Cloud as `gpt-oss:120b`.
## MCP client configuration
For an MCP client that supports stdio servers, use:
```json
{
"mcpServers": {
"ollama-cloud": {
"command": "C:\\Users\\admin\\Desktop\\New folder\\MCP_SERVER\\.venv\\Scripts\\python.exe",
"args": ["-m", "server.mcp_server"],
"cwd": "C:\\Users\\admin\\Desktop\\New folder\\MCP_SERVER"
}
}
}
```
Available MCP tools are `list_ollama_models`, `chat_with_ollama`, `generate_with_ollama`, `embed_text`, `inspect_ollama_model`, `web_search`, `scrape_url`, `calculate`, `convert`, `current_time`, `text_stats`, and `pretty_print_json`.
Available user-invoked MCP prompts are `research_topic`, `solve_math_problem`, and `summarize_webpage`. The server also exposes the read-only `ollama://models` resource with JSON metadata.
`web_search` uses DuckDuckGo's HTML endpoint and `scrape_url` fetches public HTML pages. Both require internet access; local/private network addresses are blocked by the scraper.
The general-purpose tools are local and deterministic: `calculate` supports safe arithmetic, `convert` supports length/mass/volume/temperature, `current_time` supports IANA timezones, `text_stats` counts text structure, and `pretty_print_json` validates and formats JSON.
The browser chat binds the 10 safe helper tools from `server/tool_registry.py` to Ollama Cloud's tool-calling API. When a compatible model requests a calculation, web search, scrape, conversion, or other helper, the backend executes it and sends the result back to the model before returning the final answer. The two model-to-model helpers (`chat_with_ollama` and `generate_with_ollama`) remain MCP-only to prevent recursive calls.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues