MCP Server for Ollama: Use MCP Tools with Local Models
MCP server for Ollama: Ollama is not an MCP client, so use ollmcp, Claude Code, Codex, Goose or Open WebUI to give local models MCP tools. Steps and limits.
Can Ollama Use MCP Servers?
Not by itself. Ollama serves models and supports tool calling, but it is not an MCP client: it never launches or connects to MCP servers. To use an MCP server with Ollama, run an MCP client that talks to Ollama as its model backend, such as ollmcp in the terminal, Claude Code or Codex through ollama launch, Goose, or Open WebUI, and pick a local model that supports tools.
This guide compares those options, walks through a working setup, and lists the limits that bite when you swap a frontier model for a local one. If you still need servers to try, start with the MCP server directory.
How the Pieces Fit
An MCP setup has three parts, and Ollama only fills one:
- The model, which decides when to call a tool. This is Ollama.
- The MCP client (also called the host), which starts or connects to MCP servers, gives the model their tool list, executes the calls, and feeds results back. Ollama doesn't do this.
- The MCP servers, which provide the actual tools, for example a browser, a filesystem or GitHub.
So the question "which MCP server for Ollama?" is really "which client lets my Ollama model use MCP servers?" Any MCP server from the directory works once you have that client. For the background, see how MCP works and our MCP client guide.
Your Options at a Glance
| Client | Interface | How it uses Ollama | MCP transports | Best for |
|---|---|---|---|---|
| ollmcp | Terminal UI | Native Ollama API | stdio, SSE, Streamable HTTP | Quick local testing, tool picking |
| Claude Code | Terminal agent | ollama launch claude (Anthropic-compatible API) | stdio, HTTP, SSE | Coding with MCP tools |
| Codex CLI | Terminal agent | ollama launch codex or codex --oss | stdio, Streamable HTTP | Coding with MCP tools |
| Goose | Desktop and CLI | Built-in Ollama provider | stdio, Streamable HTTP | General agent with extensions |
| Open WebUI | Web chat | Ollama backend | Streamable HTTP (stdio via mcpo) | A ChatGPT-style UI for a team |
| oterm | Terminal chat | Native Ollama API | stdio, Streamable HTTP | Lightweight terminal chat |
All of these were actively maintained as of October 2026. One that often appears in older tutorials, mcphost, is now archived on GitHub, so it's left out.
Step 1: Pick a Model That Supports Tools
MCP only works if the model can emit tool calls. Ollama marks those models with a tools tag; the full list is at ollama.com/search?c=tools. Models with that tag at the time of writing include:
| Model | Pull command | Notes |
|---|---|---|
| Qwen 3 | ollama pull qwen3:8b | Used in Ollama's own tool-calling examples; also 14b, 30b, 32b |
| Qwen 3.5 | ollama pull qwen3.5 | The model Ollama's Claude Code docs use |
| Gemma 4 | ollama pull gemma4 | Tools, vision and thinking |
| gpt-oss | ollama pull gpt-oss:20b | Used in Ollama's Codex examples; 120b if you have the memory |
| Llama 3.1 / 3.2 | ollama pull llama3.2:3b | Small and fast, weaker at multi-step tool use |
A practical rule: small models (1 to 4B parameters) can call one well-described tool, but they get confused when many servers expose dozens of tools. For agent-style work with several servers, 20B and up behaves noticeably better.
Raise the context length
This is the most common reason MCP "doesn't work" with Ollama. Every tool definition goes into the prompt, and Ollama's default context depends on VRAM: 4k tokens under 24 GiB, 32k between 24 and 48 GiB, 256k at 48 GiB or more. Ollama recommends at least 64,000 tokens for agents and coding tools. Set it in the Ollama app's settings slider, or when starting the server:
OLLAMA_CONTEXT_LENGTH=64000 ollama serve
Then check what was actually allocated with ollama ps (the CONTEXT column).
Step 2 (Fastest): ollmcp in the Terminal
ollmcp is an MCP client built specifically for Ollama. It supports stdio, SSE and Streamable HTTP servers, lets you toggle tools, and asks for confirmation before each tool call.
# install
uv tool install --upgrade ollmcp # or: pip install --upgrade ollmcp
# add MCP servers (saved for future sessions)
ollmcp mcp add playwright -- npx @playwright/mcp@latest
ollmcp mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem ~/Documents
# start a chat with a tool-capable model
ollmcp --model qwen3:8b
Inside the session, /tools opens the tool selector, /model switches models, and /hil toggles the human-in-the-loop confirmations. Remote servers work too:
ollmcp mcp add --transport http github https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer $YOUR_GITHUB_PAT"
That's the GitHub MCP server with a personal access token. If you already have servers in Claude Desktop, ollmcp --claude-desktop loads them from its config. A good first test is the Playwright MCP server: ask the model to open a page and summarize it, and watch the tool calls in the terminal.
Step 2 (Coding): Claude Code or Codex on Ollama
Ollama can launch the two big coding agents against local models, and both are full MCP clients.
Claude Code. ollama launch claude starts Claude Code using Ollama's Anthropic-compatible API. Add MCP servers the normal way; they're stored in Claude Code's config, not Ollama's:
claude mcp add --transport http context7 https://mcp.context7.com/mcp
ollama launch claude --model qwen3.5
To set it up manually instead, Ollama's docs use these variables:
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
export ANTHROPIC_BASE_URL=http://localhost:11434
claude --model qwen3.5
See our Claude Code MCP guide for scopes, OAuth and /mcp.
Codex CLI. ollama launch codex (or codex --oss -m gpt-oss:20b) runs Codex on Ollama. MCP servers go in ~/.codex/config.toml via codex mcp add; our Codex MCP setup covers the details. Both agents need a 64k+ context window to be usable.
Step 2 (Desktop): Goose
Goose is an open-source agent with an Ollama provider and MCP servers as "extensions":
- Connect Ollama: in Goose Desktop open Settings, then Configure Provider, find Ollama and confirm the API host is
http://localhost:11434. In the CLI, rungoose configure, choose Configure Providers, then Ollama, and enter a model name likeqwen3. - Add an MCP server: in Desktop, open Extensions in the sidebar and click Add custom extension. In the CLI,
goose configure, then Add Extension, then Command-line Extension (stdio) or Remote Extension (Streamable HTTP).
Extensions are saved in ~/.config/goose/config.yaml.
Step 2 (Web UI): Open WebUI
Open WebUI supports MCP natively from v0.6.31, and it already pairs with Ollama for the models. As an admin:
- Go to Settings, Admin, then Integrations.
- Under External Tool Servers, click + Add Connection.
- Set Type to MCP (Streamable HTTP), enter the server URL and pick an auth mode (None, Bearer, OAuth 2.1 and others).
- Save, then enable the tool in a chat.
Native MCP here is Streamable HTTP only. For a stdio server, wrap it with mcpo, which exposes it as an OpenAPI tool server:
uvx mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command
Two common gotchas: don't choose the OpenAPI type for an MCP URL, and the server URL must be reachable from the Open WebUI backend, not just your browser.
Other Routes
- VS Code. The Ollama extension adds your local models to the VS Code Chat model picker, and MCP servers are configured in VS Code itself; see VS Code MCP setup. Pick a tools-tagged model if you want the agent to call MCP tools.
- oterm. A terminal chat client for Ollama (
uvx oterm) with MCP tools over stdio and Streamable HTTP, configured undermcpServersin itsconfig.json. - Your own client. Ollama's Python and JavaScript libraries support tool calling, so you can connect them to the official MCP SDKs: list the server's tools, pass them to
chat()as tool definitions, run the calls through the MCP session and return the results. Our Python MCP server guide covers the SDK side.
Limitations to Expect
- Tool-call quality. Local models skip tools, invent arguments or loop more often than frontier models. Fewer tools and clear tool descriptions help more than anything else; see MCP tool discovery.
- Context pressure. A single large server can add thousands of tokens of tool schemas. Enable only the servers a task needs.
- Speed. Each tool round trip is another full generation. Partial CPU offloading (check
ollama ps) makes agent loops slow. - Local doesn't mean offline. The model runs locally, but remote MCP servers (GitHub, Notion) still send your data to those services.
- Same security rules. A local stdio server runs with your permissions whatever the model. Keep confirmations on, and read MCP security best practices.
Troubleshooting
| Symptom | Fix |
|---|---|
| Model answers but never calls a tool | The model lacks the tools tag, or the context is too small to hold the tool list. Switch models or raise OLLAMA_CONTEXT_LENGTH. |
| Tool selector is disabled (oterm) | The selected model doesn't support tools. Pull a tools-tagged model. |
| Agent forgets earlier steps | Context too small. Check the CONTEXT column in ollama ps. |
| Client can't reach Ollama | Make sure ollama serve (or the app) is running on http://localhost:11434. |
| MCP server fails to start | Run its command by hand (for example npx @playwright/mcp@latest) and fix errors; test it in the MCP Inspector. |
| Open WebUI loads forever after adding a tool | You used the OpenAPI type or pasted mcpServers JSON. Delete the connection and re-add it as MCP (Streamable HTTP). |
Next Steps
- Find servers to plug into your local setup in the MCP server directory; Filesystem, Playwright and Memory are good first picks because they run fully locally.
- New to the protocol? Read what is MCP and MCP vs RAG.
- Want to expose your own tools to a local model? Start with building an MCP server.
Frequently asked questions
Does Ollama support MCP?
- Ollama supports tool calling but is not an MCP client, so it cannot connect to MCP servers by itself. You need an MCP client that uses Ollama as its model backend, such as ollmcp, Claude Code, Codex, Goose or Open WebUI.
Which Ollama models work with MCP?
- Any model with the 'tools' tag on ollama.com, such as qwen3, qwen3.5, gemma4, gpt-oss and llama3.1 or llama3.2. Larger models (around 20B parameters and up) handle multiple MCP servers and multi-step tool use much more reliably.
Why does my Ollama model not call MCP tools?
- Usually the model does not support tools or the context window is too small to hold the tool definitions. Pick a tools-tagged model and raise the context length to at least 64k tokens with OLLAMA_CONTEXT_LENGTH or the app's settings slider.
Can I use Claude Code with Ollama and MCP servers?
- Yes. Run 'ollama launch claude' to start Claude Code on a local or cloud Ollama model, and add MCP servers with 'claude mcp add' as usual. The MCP servers are stored in Claude Code's own config.