Ollama MCP Server
Provides tools for interacting with locally running Ollama models, including listing available models, chatting with conversation history, generating responses from prompts, pulling new models from the registry, and deleting models from local installation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Ollama MCP Serverchat with llama2 about quantum computing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ollama MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with Ollama models. This server enables AI assistants to list, chat with, generate responses from, and manage Ollama models through a standardized protocol.
๐ Features
Model Management: List, pull, and delete Ollama models
Chat Interface: Multi-turn conversations with models
Text Generation: Single-prompt text generation
Dual Transport: Stdio (local) and HTTP (remote) support
Railway Ready: Pre-configured for Railway deployment
Type Safe: Full TypeScript implementation with strict typing
Related MCP server: Ollama MCP Server
๐ Prerequisites
Node.js 18+
Ollama installed and running locally
For Railway deployment: Railway CLI
๐ ๏ธ Installation
Local Development
Clone and install dependencies:
git clone <repository-url> cd ollama-mcp npm installBuild the project:
npm run buildStart the server:
npm start
Using with Cursor
Add this to your Cursor MCP configuration (~/.cursor/mcp/config.json):
{
"mcpServers": {
"ollama": {
"command": "node",
"args": ["/path/to/ollama-mcp/dist/main.js"],
"env": {
"OLLAMA_API_KEY": "<your-key-from-ollama.com/settings/keys>"
}
}
}
}Quick setup:
curl -sSL https://raw.githubusercontent.com/your-repo/ollama-mcp/main/config/mcp.config.json -o ~/.cursor/mcp/config.json๐๏ธ Architecture
The project is structured for maximum readability and maintainability:
src/
โโโ main.ts # Main entry point
โโโ config/ # Configuration management
โโโ server/ # Core MCP server
โโโ tools/ # MCP tool implementations
โโโ transports/ # Communication transports
โโโ ollama-client.ts # Ollama API client
docs/ # Comprehensive documentation
config/ # Configuration files
scripts/ # Deployment scriptsSee ARCHITECTURE.md for detailed architecture documentation.
๐ง Configuration
Environment Variables
Variable | Description | Default |
| Transport type ( |
|
| Ollama API base URL |
|
| API key for Ollama Cloud ( | None |
| Ollama Cloud API base URL (used when routing |
|
| HTTP server host (HTTP mode) |
|
| HTTP server port (HTTP mode) |
|
| CORS allowed origins (HTTP mode) | None |
Cloud models
Ollama cloud models (names ending in -cloud, e.g. gpt-oss:120b-cloud) can be used in two ways:
Local Ollama โ Keep
OLLAMA_BASE_URLathttp://localhost:11434and runollama signinso the daemon authenticates cloud requests.API key โ Set
OLLAMA_API_KEY(from ollama.com/settings/keys). Cloud chat/generate requests are sent toollama.comwith a Bearer token automatically.
For cloud-only deployments (e.g. Railway without ollama signin), set OLLAMA_BASE_URL=https://ollama.com and OLLAMA_API_KEY as a secret.
Transport Modes
Stdio Transport (Default)
Perfect for local development and direct integration:
npm startHTTP Transport
Ideal for remote deployment and web-based clients:
MCP_TRANSPORT=http npm start๐ Deployment
Railway Deployment
Install Railway CLI:
npm install -g @railway/cli railway loginDeploy:
railway upAdd models (optional):
railway shell # Follow instructions in docs/RAILWAY_MODELS_SETUP.md
The Railway deployment automatically uses HTTP transport and exposes:
MCP Endpoint:
https://your-app.railway.app/mcpHealth Check:
https://your-app.railway.app/healthz
Docker Deployment
# Build the image
npm run docker:build
# Run locally
npm run docker:run
# Deploy to Railway
railway up๐ Available Tools
The server provides 5 MCP tools for Ollama interaction:
ollama_list_models- List available modelsollama_chat- Multi-turn conversationsollama_generate- Single-prompt generationollama_pull_model- Download modelsollama_delete_model- Remove models
See API.md for detailed API documentation.
๐งช Testing
Local Testing
# Test stdio transport
npm start
# Test HTTP transport
MCP_TRANSPORT=http npm start
# Test health check (HTTP mode)
curl http://localhost:8080/healthzModel Testing
# List available models
ollama list
# Test a model
ollama run llama2 "Hello, how are you?"๐ Documentation
Architecture - Detailed system architecture
API Reference - Complete API documentation
Railway Setup - Model deployment guide
๐ค Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
๐ License
MIT License - see LICENSE for details.
๐ Troubleshooting
Common Issues
"Cannot find module" errors:
npm install
npm run buildOllama connection issues:
# Check if Ollama is running
ollama list
# Check Ollama service
ollama serveRailway deployment issues:
# Check Railway logs
railway logs
# Verify environment variables
railway variablesGetting Help
Check the documentation
Review troubleshooting guide
Open an issue on GitHub
Built with โค๏ธ for the AI community
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables seamless integration between Ollama's local LLM models and MCP-compatible applications, supporting model management and chat interactions.Last updated13977168AGPL 3.0
- AlicenseBqualityDmaintenanceEnables complete local Ollama management including listing models, chatting with local LLMs, starting/stopping the server, and getting intelligent model recommendations for specific tasks through natural language commands.Last updated93MIT
- Alicense-qualityDmaintenanceExposes local Ollama instances as tools for Claude Code, allowing users to offload code generation, text drafting, and embedding tasks to local GPUs. It supports multi-turn conversations and model management through the Model Context Protocol.Last updatedMIT
- AlicenseAqualityCmaintenanceLets Claude query and manage a local Ollama server โ list models, inspect them, run generate/chat completions, pull or delete models.Last updated8MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yoโฆ
Operate your Linux servers from your LLM. Every action runs through an auditable allowlist.
Run AI customer support from your terminal: conversations, knowledge base, and chat widget.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/etnlbck/ollama-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server