Skip to main content
The Ollama MCP server provides 3 tools for interacting with locally-running Ollama models. These tools enable text generation, multi-turn chat, and model discovery. Server name: ollama Version: 1.0.0 Script: scripts/ollama-mcp-server.mjs

Environment Variables


Available Models

Genie Helper uses multiple specialized Ollama models:

list-models

List all locally available Ollama models. Parameters: None Returns: Array of model objects with name, size, and modified_at fields. Example Response:
Usage:

generate

Generate a completion from an Ollama model (single-turn, no conversation history). Use case: One-shot text generation, classification, data extraction, or completion tasks that don’t require multi-turn context. Parameters:
  • prompt (string, required): The prompt to generate from
  • model (string, optional): Model name (default: qwen-2.5:latest)
  • system (string, optional): System prompt to prepend
  • temperature (number, optional): Sampling temperature 0-2 (default 0.7)
  • max_tokens (number, optional): Max tokens to generate
Returns: Generated text response. Example 1: Simple generation
Response:
Example 2: With system prompt
Response:
Example 3: JSON extraction
Response:

chat

Multi-turn chat with an Ollama model using a messages array. Maintains conversation context across multiple exchanges. Use case: Conversational AI, multi-step reasoning, context-dependent responses, or any task requiring chat history. Parameters:
  • messages (string, required): JSON string array of {role, content} objects
    • Valid roles: user, assistant, system
  • model (string, optional): Model name (default: qwen-2.5:latest)
  • system (string, optional): System message to prepend to conversation
  • temperature (number, optional): Sampling temperature 0-2 (default 0.7)
Returns: Assistant’s message content. Example 1: Basic conversation
Response:
Example 2: With system context
Response:
Example 3: Multi-step reasoning
Response:

Message Format

The messages parameter for the chat tool must be a JSON string containing an array of message objects:
Important: The entire array must be stringified when passing to the tool:

Temperature Guide

Genie Helper defaults:
  • Classification tasks: 0.1-0.3
  • Chat responses: 0.5-0.7
  • Content generation: 0.8-0.9

Performance Notes

Inference speed (CPU-only VPS):
  • Small models (3B): ~1-2s first token
  • Medium models (7B): ~2-5s first token
  • Large models (8B+): ~5-10s first token
Memory usage:
  • 3B models: ~2GB RAM
  • 7B models: ~4.8GB RAM
  • 8B models: ~5.5GB RAM
Recommendations:
  • Use smaller models (llama3.2:3b, phi-3.5) for quick tasks
  • Reserve larger models (qwen-2.5, dolphin3) for complex reasoning
  • Set max_tokens to limit generation time
  • Lower temperature for faster, more focused responses

Error Handling

Common errors and solutions: Model not found:
Solution: Use list-models to see available models or pull the model with ollama pull model-name:tag Connection refused:
Solution: Ensure Ollama service is running on port 11434 Out of memory:
Solution: Use a smaller quantized model or free up system memory