Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MCP_HOSTNoBind host for sse/streamable-http transports.0.0.0.0
MCP_PORTNoBind port for sse/streamable-http transports.8765
OLLAMA_MODELNoModel tag to use, as shown by ollama list on the target host.qwen3:32b
MCP_TRANSPORTNostdio (spawned locally by Claude Code), sse, or streamable-http (for remote/k8s deployment).stdio
OLLAMA_NUM_CTXNoContext window passed to Ollama's options.num_ctx.8192
OLLAMA_TIMEOUTNoRequest timeout in seconds. Defaults to 15 minutes to allow large generations/refactors on modest hardware.900
OLLAMA_BASE_URLNoWhere Ollama listens. LAN addresses and bare host:port (scheme added automatically) are supported.http://localhost:11434
OLLAMA_CONNECT_TIMEOUTNoTCP connect timeout in seconds.10
OLLAMA_MCP_ALLOWED_DIRNoBase directory that file-aware tools are confined to.server CWD
OLLAMA_MCP_DEFAULT_THINKNoDefault value for each tool's think parameter when the caller omits it.true
OLLAMA_MCP_MAX_FILE_BYTESNoPer-file size cap for server-side reads.1000000
OLLAMA_MCP_MAX_BATCH_FILESNoMax files processed per batch_refactor call.20

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
generate_codeA

Generate new code from a natural-language instruction using the local Ollama model.

Pass context_file (a server-side path) instead of pasting an existing file's contents to give the model style/API context without spending your own context window on it. Set think=False for faster, simpler generations; leave think=True for anything non-trivial.

review_codeA

Review code for correctness bugs, security issues, and simplification opportunities.

Provide exactly one of code (inline text) or file_path (a server-side path read directly by this tool, saving your context window). focus can narrow the review, e.g. "concurrency" or "input validation".

refactor_codeA

Refactor code according to an instruction, preserving external behavior.

Provide exactly one of code or file_path. Returns the full refactored code plus a summary of changes; this tool does not write files itself -- use batch_refactor if you want changes applied to disk.

fix_codeA

Diagnose and fix a bug in code, given an optional error message or symptom.

Provide exactly one of code or file_path. Include error_message (a stack trace, test failure, or description of wrong behavior) whenever you have one -- it substantially improves fix quality.

write_testsA

Write tests covering the golden path and realistic edge cases for given code.

Provide exactly one of code or file_path. Set framework (e.g. "pytest", "jest") to match your project's conventions; otherwise the model infers one from the code's language.

explain_codeA

Explain what code does, including control/data flow and non-obvious behavior.

Provide exactly one of code or file_path. Explanations are usually fast enough that think=False (the default) is sufficient.

code_review_diffA

Review a git diff (e.g. git diff main...HEAD) as if for a pull request.

Provide exactly one of diff (inline diff text) or diff_file (a server-side path to a saved diff). context can carry the PR description or any background the model should know.

batch_refactorA

Apply a refactor instruction to every file matching a glob pattern, sequentially.

glob_pattern matches relative paths under root_dir (default: the server's allowed base directory), e.g. "src/**/*.py". Files are processed one at a time against the local model. With dry_run=True (the default) nothing is written -- you get a unified diff per file to review first; set dry_run=False to write accepted changes to disk. Large match sets are capped (see OLLAMA_MCP_MAX_BATCH_FILES) to avoid runaway sequential runs.

ollama_statusA

Check connectivity to the configured Ollama host and report available models.

Call this first if other tools are failing, or proactively before a batch of delegated work, to confirm the local model is reachable and pulled before relying on it.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

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/darthzen/ollama-code-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server