Home / MCP / Ollama MCP Server
Bridges Ollama’s local LLM capabilities with MCP for model management, execution, and chat completions.
Configuration
View docs{
"mcpServers": {
"ollama": {
"command": "node",
"args": [
"/path/to/ollama-server/build/index.js"
],
"env": {
"OLLAMA_HOST": "http://127.0.0.1:11434"
}
}
}
}You run an MCP server that bridges Ollama’s local LLM capabilities with the Model Context Protocol, giving you a clean, OpenAI-compatible chat interface and full control over local models. This guide shows you how to install, configure, and use the Ollama MCP Server to manage models, execute prompts, and handle chat completions entirely on your machine or within your MCP-powered applications.
Set up the Ollama MCP Server as a local stdio service and interact with it through your MCP client. From your client, you can pull models from registries, run models with customized prompts, and perform chat completions that resemble OpenAI’s chat API. You also have the ability to create custom models from Modelfiles, copy or remove models, and control server behavior such as timeouts and response temperatures.
Typical usage patterns include pulling a model, running a model with a specific prompt, and performing a chat completion with a multi-turn message history. You can also configure the Ollama host endpoint if you are using a non-default Ollama API URL. All actions are exposed through MCP tooling that you invoke from your MCP client, enabling seamless integration with your existing MCP workflows.
Prerequisites: ensure Ollama is installed on your system. You also need Node.js and npm or pnpm to build and run the MCP server.
Install dependencies and build the server with the following commands.
pnpm install
pnpm run buildAdd the Ollama MCP Server to your MCP configuration so your client can start and communicate with the local Ollama service.
For Claude Desktop on MacOS, the configuration path is typically:
- MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
- Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"ollama": {
"command": "node",
"args": ["/path/to/ollama-server/build/index.js"],
"env": {
"OLLAMA_HOST": "http://127.0.0.1:11434" // Optional: customize Ollama API endpoint
}
}
}
}Environment variable tips: you can configure a custom Ollama API endpoint using the OLLAMA_HOST variable. The server also supports timeout and temperature parameters to control model execution and response behavior.
Key tools to use through MCP include pulling, running, chat completions, creating custom models from Modelfiles, and managing model lifecycles like copying or removing models.
Fetch and register a model from a registry into Ollama so it becomes available to MCP workflows.
Push a local Ollama model to a registry for sharing or backup.
List all models currently available in Ollama that MCP can interact with.
Create a custom model in Ollama from a Modelfile path and add it to your MCP-enabled catalog.
Copy an existing model within Ollama to create a new variant.
Remove a model from Ollama when it is no longer needed.
Execute a model with a given prompt and parameters to obtain a generated response.
Provide a chat-like interaction using system, user, and assistant messages compatible with OpenAI-style APIs.