Overview
Interact with locally-running Ollama models for private AI inference and code generation.
Setup
Run with npx:
npx -y @modelcontextprotocol/server-ollamaConfiguration
OLLAMA_HOST environment variable (default: http://localhost:11434)Documentation
Ollama MCP (Enhanced)
Overview
Ollama MCP provides access to locally-running Ollama models for private AI inference.
Features
- Local model inference
- Multiple model support
- Streaming responses
- Model management
- GPU acceleration
Installation
npx -y @modelcontextprotocol/server-ollama
Configuration
Set up Ollama host:
export OLLAMA_HOST=http://localhost:11434
Pull models with: ollama pull llama3
Available Models
| Model | Description |
|---|---|
llama3 | Meta Llama 3 |
mistral | Mistral 7B |
gemma | Google Gemma |
codellama | Code generation |
phi3 | Microsoft Phi 3 |
Available Operations
| Operation | Description |
|---|---|
| Chat | Send chat messages |
| Generate | Text generation |
| Embed | Generate embeddings |
| List Models | Get available models |
| Pull Model | Download model |
Usage Examples
Chat
{
"action": "chat",
"model": "llama3",
"messages": [
{ "role": "user", "content": "Explain quantum computing" }
],
"stream": true
}
Generate
{
"action": "generate",
"model": "llama3",
"prompt": "Write a Python function to calculate factorial"
}
Embed
{
"action": "embed",
"model": "llama3",
"input": ["Hello world", "AI is amazing"]
}
Pros
- ✅ Fully local and private
- ✅ No API costs
- ✅ GPU acceleration
- ✅ Model variety
Cons
- ❌ Requires local Ollama
- ❌ Hardware requirements
- ❌ Model download time
