Ollama MCP Server Cursor IDE Setup (2026): Local Models, mcp.json and stdio Tools
Ollama MCP server setup for Cursor IDE: install Ollama, add ollama-mcp-server to ~/.cursor/mcp.json or .cursor/mcp.json, configure OLLAMA_HOST, use pull/list/run/chat_completion tools, and keep prompts on your machine.
How do you connect Ollama to Cursor with MCP? Install Ollama so a local (or network) daemon is listening, then add a stdio MCP server entry that runs npx -y ollama-mcp-server from ~/.cursor/mcp.json or a project .cursor/mcp.json. Point OLLAMA_HOST at http://127.0.0.1:11434 unless your Ollama API lives elsewhere. Restart Cursor, confirm the server shows under Settings > Tools & MCPs, pull a model with the pull tool, and call run or chat_completion from Agent chat.
Everything below was checked on November 5, 2026 against Ollama's public site at ollama.com, Cursor's MCP documentation at cursor.com/docs/mcp, and the maintained npm package ollama-mcp-server (GitHub: hyzhak/ollama-mcp-server, a reboot of the earlier NightTrek/Ollama-mcp project). Package maintainers change tool arguments; when a detail is likely to move, this guide points you back to the README instead of inventing a frozen schema.
What Ollama MCP Gives You That Local Chat Alone Does Not
Ollama itself is a way to download and run open models on your own hardware. You can already chat with those models from the Ollama app or CLI without MCP. The MCP server is a bridge: it exposes Ollama's HTTP API as tools an IDE agent can call on your behalf. Instead of you switching to a terminal to ollama pull, ollama list, or craft a one-off prompt, Cursor's agent can pull a model, list what is installed, run a prompt, or open a multi-turn chat through the Model Context Protocol.
That is a different job from the other local servers on this site. The Filesystem MCP server lets an agent read and write files under a root you choose. Docker MCP talks to containers. Cursor's own agent already has an LLM in the cloud (or wherever your Cursor account is configured); Ollama MCP does not replace that. It gives the agent a second, local model runtime it can invoke as a tool — useful when you want a private completion, a second opinion from a model that never leaves the machine, or scripted model management inside a coding session.
Two limits are worth knowing before you start. First, the stdio MCP path returns a completed response; the maintained server's README states that streaming is not supported in stdio mode. Plan for waits on large prompts. Second, this guide does not claim the npm package is an official Ollama product. It is a community-maintained bridge that wraps Ollama's documented local API. Review the package and GitHub release notes before you upgrade.
Prerequisites
1. Ollama installed and running. Download from ollama.com for macOS, Windows, or Linux. After install, the daemon typically listens on port 11434. Confirm with ollama list in a terminal; if the command fails, start the Ollama app or service first.
2. Node.js with npx. The Cursor config below uses npx -y ollama-mcp-server so you do not have to clone the repo. A global Node install is enough.
3. Cursor with MCP enabled. Cursor reads MCP servers from JSON config files and from Settings > Tools & MCPs. Our Cursor MCP setup guide covers the file locations if you have never added a server before.
4. Disk and RAM for models. Model weights live on your machine. Pull only what you need; a failed pull is almost always disk space, not MCP.
You do not need an Ollama cloud account for local models. Ollama's site also describes cloud models and sign-in flows; this article focuses on the local daemon plus MCP, and does not invent cloud billing or feature claims beyond what you can verify on ollama.com yourself.
Where the Config Lives in Cursor
Cursor merges two MCP config locations:
| Location | Path | Scope |
|---|---|---|
| Global | ~/.cursor/mcp.json | Every project on your machine |
| Project | .cursor/mcp.json in the repo root | That repository (good for teams via git) |
If the same server name appears in both, the project file wins. Cursor's docs also describe remote servers with a url field and OAuth; Ollama MCP as packaged on npm is a local stdio server (command + args), not a hosted HTTPS endpoint. Never commit a project file that embeds secrets you would not share — for Ollama the usual secret is none, because the default host is localhost. If you point OLLAMA_HOST at a networked machine, treat that network like any other internal API.
Add the Ollama MCP Server to mcp.json
Create or edit ~/.cursor/mcp.json (global) or .cursor/mcp.json (project) and add:
{
"mcpServers": {
"ollama": {
"command": "npx",
"args": ["-y", "ollama-mcp-server"],
"env": {
"OLLAMA_HOST": "http://127.0.0.1:11434"
}
}
}
}
Notes that match the maintained README and Cursor's stdio docs:
command / args: npx downloads and runs the published ollama-mcp-server package. The -y flag accepts the npx install prompt so Cursor can start the process non-interactively.OLLAMA_HOST: Base URL of the Ollama HTTP API. Default in the package is http://127.0.0.1:11434. Change this if Ollama listens on another interface, port, or a machine on your LAN.// comments. The README examples sometimes show inline comments for humans; strip them before saving if your editor is strict.Save the file, then reload Cursor or toggle the server off and on under Settings > Tools & MCPs. The server should appear as connected once npx has fetched the package and the process stays alive.
If you prefer a pinned local build instead of npx, clone hyzhak/ollama-mcp-server, run npm install and npm run build, and point command at node with args aimed at the built dist entry. That path is for contributors; most Cursor users should stay on npx.
What the Tools Do
The maintained server's documentation lists tools that map onto Ollama's API. Names and arguments can change between package versions — re-check the README after upgrades — but the published set as of this writing includes:
| Tool | Job |
|---|---|
pull | Download a model from an Ollama-compatible registry to the local instance |
push | Upload a local model to a registry |
list | List models currently available on the instance |
show | Show details for one model (parameters, template, license as exposed by Ollama) |
run | Run a model with a prompt; optional image input for vision-capable models; response returns after completion in stdio mode |
chat_completion | OpenAI-compatible multi-turn chat with system/user/assistant roles; optional think for models that expose reasoning |
create | Build a custom model from a Modelfile |
copy | Duplicate a model under a new name |
remove | Delete a model from the local instance |
Typical first session after config:
1. Ask the agent to list installed models.
2. If the list is empty, ask it to pull a small model you already trust from Ollama's library (pick the exact tag from ollama.com/library — do not invent tags).
3. Ask it to run a short prompt against that model, or to open a chat_completion with a system message that matches your task.
Vision examples in the README pass an image path into run or an images array on a chat message. Only models that actually support vision will use those fields; others ignore or error. Keep image paths inside directories you intend the agent to read.
Ollama MCP Versus Typing in the Ollama App
| Need | Use the Ollama app / CLI | Use Ollama MCP inside Cursor |
|---|---|---|
| Casual chat with a local model | Yes | Optional |
| Agent pulls/lists models while coding | Awkward | Yes |
| Private second-opinion completion mid-task | Possible manually | Tool call from Agent |
| Replace Cursor's primary model | No — wrong tool | No — still a side runtime |
| Stream tokens into the IDE chat UI | App may stream | Stdio MCP returns after completion |
Keep expectations honest. Cursor's agent still plans with its configured model. Ollama MCP is a tool belt for local inference and model housekeeping, not a silent swap of the IDE's brain.
Security and Privacy — Local Models, Real Boundaries
Running models locally is the privacy pitch: prompts and completions can stay on the machine that hosts Ollama. MCP does not magically expand or shrink that boundary. What actually happens:
OLLAMA_HOST=http://127.0.0.1:11434 keeps API traffic on localhost. Pointing OLLAMA_HOST at another host sends prompts to that host. Only do that on networks you trust.${env:NAME}) over hard-coding tokens. Ollama's local default usually needs none.If you also use Claude Desktop MCP, the same ollama stdio block can live in Claude's config file; keep the two clients' configs in sync manually so you do not assume a model pulled in one UI exists for the other without checking list.
Troubleshooting
Server shows error / red in Tools & MCPs. Run npx -y ollama-mcp-server in a terminal. If Node cannot download the package, fix npm registry or network access first. If the process starts then exits, Ollama is often not reachable — start Ollama and retry curl http://127.0.0.1:11434 (or your custom host).
pull or run fails with connection errors. Confirm OLLAMA_HOST matches the listening address. On some setups IPv6 vs 127.0.0.1 vs localhost matters; the README examples prefer http://127.0.0.1:11434.
Agent never calls Ollama tools. Toggle the server on, start a new Agent chat, and name the tool in your request ("use the ollama list tool"). Crowded MCP setups bury tools; disable servers you are not using. See the Cursor IDE MCP agent mode guide for how Agent picks tools.
Hung calls on long prompts. Stdio mode waits for full completion. Lower max tokens in the tool arguments if the package exposes them, use a smaller model, or run the heavy job in the Ollama app instead.
Wrong model / missing model. Call list, then pull with the exact library tag. Do not assume a model name from an old blog post still exists.
npx prompts blocking Cursor. Ensure -y is in args. Corporate proxies sometimes break npx; in that case build from source and invoke node on the dist file.
Permission / Auto-review blocks. That is Cursor protecting you, not an Ollama bug. Approve only tools you understand.
Project Versus Global: A Practical Pattern
Use the global file for a personal Ollama bridge you want everywhere. Use a project file when a repository documents "this repo expects local model X for offline codegen demos" and teammates should get the same MCP entry from git. Project files should still avoid machine-specific absolute paths; npx keeps the command portable. If a teammate has Ollama on another port, they override OLLAMA_HOST locally without rewriting the shared args.
How This Fits With the Rest of Your MCP Stack
A sane local stack for many developers is Cursor's built-in agent plus:
Remote SaaS MCP servers (Notion, browser clouds, scrapers) are a separate trust decision. Ollama MCP's value is that the default trust boundary is your laptop. Do not weaken that by pointing OLLAMA_HOST at a random public IP.
Next Steps
1. Confirm ollama list works in a terminal.
2. Paste the mcpServers.ollama block into ~/.cursor/mcp.json.
3. Reload Cursor and verify the server under Tools & MCPs.
4. In Agent chat, ask to list models, pull one small model from ollama.com/library, and run a one-line prompt.
5. When you are ready to automate more of the editor side, revisit the Cursor MCP setup guide and the Filesystem MCP setup.
Need help wiring local MCP servers into a team Cursor setup? Talk to us about stdio configs, approval policies, and keeping model weights and prompts inside your network — without turning every laptop into an unreviewed tool free-for-all.