ollama-mcp-server
Provides a tool to delegate prompts to Ollama models, sending text generation requests to the Ollama API with an optional system prompt and configurable model.
Click on "Deploy 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-serveruse qwen3.5:4b to summarize this 2000-line log file"
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
An MCP (Model Context Protocol) server that lets Claude Code delegate sub-tasks to a local Ollama model instead of doing the work itself. The goal: keep heavy, mechanical, or bulk work off your Claude usage quota (5h / weekly limits) by routing it to a free local (or Ollama cloud) model, so Claude's own tokens are spent only on the work that actually needs Claude-level reasoning.
What it does today
Single file: src/index.ts.
Exposes one MCP tool,
run_ollama_task, which:Takes
prompt, an optionalsystem_prompt, andmodel(defaultqwen2.5-coder:latest).POSTs to
http://localhost:11434/api/generate(non-streaming) and returns the full response text to Claude.
Runs via
npm start→tsx src/index.ts, communicating over stdio (the standard way Claude Code talks to local MCP servers).
That's it — no build step, no config file, no model listing, no cloud routing logic yet. It's a minimal working bridge, not a finished tool.
Related MCP server: Ollama MCP Server
Current state / things worth fixing
These are observations, not changes I've made (you asked for no code edits):
Default model doesn't exist on this machine. The code defaults to
qwen2.5-coder:latest, butollama listhere only showsqwen3.5:4b. Any call that doesn't explicitly passmodelwill fail. Either pullqwen2.5-coder, or change the default to a model you actually have.No Ollama host config. The endpoint is hardcoded to
http://localhost:11434. There's noOLLAMA_HOSTenv var support, so this can't point at a remote box or a different port without editing code."Cloud" is mentioned but not implemented. The tool description says "local or cloud Ollama models," but the code only ever calls localhost. Ollama's cloud models (via
ollama signin+ cloud-tagged models like*-cloud) aren't wired up — there's no way to pick or fall back to them.No timeout. The axios call has no timeout, so a stuck/huge generation can hang indefinitely with no way for Claude to recover.
Uses
/api/generate, not/api/chat. That means no multi-turn context and no structured message roles — every call is a single stateless prompt. Fine for one-shot delegation, less fine for anything needing back-and-forth.No model discovery. Claude has no way to ask "what models are available locally right now" — it just has to guess or be told. A
list_ollama_modelstool (wrappingollama list//api/tags) would let Claude pick a sensible model instead of relying on a hardcoded default.No
tsconfig.json. Works today becausetsxdoesn't strictly need one, but there's nostrictmode, no target/module config pinned down — easy to drift.package.jsonhas boilerplate defaults — emptyauthor, ISC license, atestscript that just errors out, nobuild/binentry for distributing this as an installable MCP server.
What "best output" would need
For this to actually move the needle on your Claude quota, two things matter more than the code:
A. Claude needs to know when to delegate. The server just exposes a
tool — nothing tells Claude to prefer it. That instruction lives in
CLAUDE.md in this repo (and ideally in your global
~/.claude/CLAUDE.md if you want it to apply everywhere). Without that
guidance, Claude will keep doing heavy work inline and this MCP server will
sit unused.
B. The model needs to fit the task. A single hardcoded default
(qwen2.5-coder, and even that's missing here) means every delegated task —
whether it's "summarize this 2000-line log" or "write boilerplate CRUD code"
— goes to the same model. Worth having a couple of pulled models for
different jobs (a coder model, a general-purpose one) and letting Claude pass
model explicitly based on the task, once it knows what's available (see
point 6 above).
Concretely, the highest-leverage next steps, in order:
Fix the default model mismatch (pull
qwen2.5-coderor change the default).Add a
list_ollama_modelstool so Claude can check what's actually available before delegating.Add
OLLAMA_HOSTenv support so this isn't locked to localhost.Add a timeout + streaming option so large tasks don't hang silently.
Write the delegation policy into CLAUDE.md (done — see that file) so Claude actually uses this instead of burning its own tokens.
Setup
npm install
ollama serve # if not already running
npm start # starts the MCP server over stdioRegister it with Claude Code as a local MCP server (e.g. in your Claude Code
MCP config) pointing at npm start (or tsx src/index.ts) in this directory.
This server cannot be deployed
Maintenance
Related MCP Connectors
Agent personas for Claude. 16 tools, 13 personas, 3 workflows. Zero extra API cost. Free.
Live SEO workflow tools for Claude Code, Codex, and AI agents.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Claude to delegate coding tasks to local Ollama models, reducing API token usage by up to 98.75% while leveraging local compute resources. Supports code generation, review, refactoring, and file analysis with Claude providing oversight and quality assurance.330 npm24AGPL 3.0
- AlicenseNot gradedqualityDmaintenanceExposes 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.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude Code to delegate mechanical tasks (summaries, boilerplate, reformatting) to local models running in LM Studio.1MIT
- AlicenseAqualityCmaintenanceEnables Claude Code to offload routine code generation and text processing tasks to a local Ollama LLM, saving Cloud API tokens and costs with automatic model selection and security features.1177 npm4Apache 2.0