Skip to main content
Glama

llama-mcp

An MCP server that exposes a llama.cpp server (llama-server) as tools, so an MCP host such as Claude Code can hand work to a local model.

Tools

Tool

llama-server endpoint

Purpose

chat

POST /v1/chat/completions

Prompt (plus optional system prompt, earlier turns in history and reasoning_effort) → reply

complete

POST /completion

Raw text continuation, no chat template

tokenize

POST /tokenize

Text → token ids

models

GET /v1/models

Model ids and whether each is loaded

health

GET /health

ok once a model is loaded

Related MCP server: mcp-file-system-lmstudio

Usage

Start llama-server, then register the MCP server with Claude Code:

llama-server -m model.gguf --port 8080
claude mcp add llama -- uv run --project ~/Projects/llama-mcp llama-mcp --url http://localhost:8080

Configuration:

  • --url / LLAMA_URL: llama-server base URL (default http://localhost:8080)

  • --model / LLAMA_MODEL: model id to use when a tool call names none. Required when llama-server runs in router mode (started without -m/-hf, offering several models); chat, complete and tokenize also take a per-call model argument.

  • LLAMA_API_KEY: sent as a bearer token, for a llama-server started with --api-key

  • --timeout: request timeout in seconds (default 300)

  • --http PORT: serve streamable HTTP at http://127.0.0.1:PORT/mcp instead of stdio, for testing with MCP Inspector or claude mcp add --transport http

Development

uv sync
uv run pytest
uv run ruff check && uv run ruff format --check
uv run pyrefly check

Available Tools

5 tools
chatC

Send a prompt to the local model through its chat template and return the reply.

    Leave `temperature` unset to use llama-server's own sampling settings.
    

Inputs: prompt (required), model, system, max_tokens, +1 more. Returns: result

completeB

Continue raw text with the local model, with no chat template applied.

    Leave `temperature` unset to use llama-server's own sampling settings.
    

Inputs: prompt (required), model, n_predict, temperature. Returns: result

healthA

Report whether llama-server is up and has a model loaded.

Inputs: no named parameters. Returns: result

modelsA

List the models llama-server offers, with their status.

    A single-model llama-server always reports `loaded`. In router mode a model is `unloaded` until
    a request names it, and the first such request waits while it loads.
    

Inputs: no named parameters. Returns: result

tokenizeC

Return the model's token ids for text.

Inputs: text (required), model. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 5 tools

    Disambiguation4/5

    chat and complete both send text to the model and return output, so their boundary rests entirely on the chat-template distinction, which the descriptions do clarify. tokenize, models, and health are each clearly distinct from that pair and from each other.

    Naming Consistency3/5

    All names are single lowercase words in a consistent casing style, which keeps them readable. However, the set mixes bare verbs (chat, complete, tokenize) with bare nouns (models, health) with no predictable verb_noun pattern.

    Tool Count5/5

    Five tools is well-scoped for a thin wrapper over a local llama-server: two generation modes, tokenizer access, model listing, and a health probe. Each tool earns its place with no obvious redundancy.

    Completeness3/5

    Core inference and diagnostics are covered, but common llama-server capabilities are absent: embeddings, explicit model selection/load-unload for router mode, and detokenization. Agents can still work around these gaps but will hit dead ends for embedding workflows.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Bridges LM Studio local models to Claude Code as MCP tools, enabling private and free AI-assisted subtasks. Includes respond and models tools with automatic model selection and structured output.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes local Ollama as an MCP server so Claude can delegate drafting, summarization, translation, code review, error explanation, model listing, health checks, and file reading to local models via stdio or HTTP.
      1
      Apache 2.0