mlx-mcp-server

mlx-mcp-server

Bridges Claude Code and Claude Desktop to a locally-running LLM, optimized for MLX LM on Apple Silicon with support for any OpenAI-compatible backend.

Category
Visit Server

README

mlx-mcp-server

A Model Context Protocol (MCP) server that gives Claude Code and Claude Desktop a set of tools to talk to a locally-running LLM. Optimised for oMLX and MLX LM on Apple Silicon, with support for any OpenAI-compatible backend (Ollama, LM Studio, etc.).

The idea: Claude stays Claude. Your local model becomes a tool Claude can call โ€” fast, private, free, and clearly labelled ๐Ÿ  LOCAL in every response.


How it works

You (in Claude Code or Claude Desktop)
        โ”‚
        โ–ผ
  Claude (Sonnet / your tier)          โ† still the primary AI
        โ”‚
        โ”‚  calls MCP tools when useful
        โ–ผ
  mlx-mcp-server  (subprocess)         โ† this repo
        โ”‚
        โ”‚  HTTP  POST /v1/chat/completions
        โ–ผ
  Your local LLM backend               โ† oMLX ยท MLX LM ยท Ollama ยท LM Studio
        โ”‚
        โ–ผ
  Response with ๐Ÿ  LOCAL badge         โ† so you always know which model answered

Claude Code spawns mlx-mcp-server as a background subprocess at startup. The server sits idle until you โ€” or Claude โ€” explicitly invoke one of its tools. Nothing is routed automatically; you're always talking to real Claude unless a tool is called.


Quick install

macOS with Homebrew Python โ€” use uv (pip is blocked by PEP 668):

uv tool install mlx-mcp-server

Other environments:

pip install mlx-mcp-server

oMLX (recommended on Apple Silicon)

# Add to Claude Code
mlx-mcp-server install --claude-code \
  --base-url http://localhost:8000 \
  --api-key YOUR_OMLX_KEY \
  --model "Qwen3.6-35B-A3B-4bit"

# Add to Claude Desktop
mlx-mcp-server install \
  --base-url http://localhost:8000 \
  --api-key YOUR_OMLX_KEY \
  --model "Qwen3.6-35B-A3B-4bit"

MLX LM

# Start the server first
mlx_lm.server --model mlx-community/Mistral-7B-Instruct-v0.3-4bit

# Then install (no API key needed, model auto-detected)
mlx-mcp-server install --claude-code --base-url http://localhost:8080

Ollama

ollama serve && ollama pull mistral

mlx-mcp-server install --claude-code \
  --base-url http://localhost:11434 \
  --model mistral

Restart Claude Code / Claude Desktop after installing.


Tools

These are the MCP tools Claude can call. You can invoke them directly by name in conversation, or ask Claude to use the local model for a specific task.

chat

Send a message to your local LLM and get a response.

# In Claude Code โ€” just say it:
"Use the local model to write a SQL migration for adding a users table"
"Ask the local model to summarise this error log"
"Use local: write boilerplate for a new Go HTTP handler"

Parameters:

Parameter Type Default Description
message string required The prompt to send
system_prompt string "" Optional system prompt (overrides default)
temperature float 0.7 Sampling temperature
max_tokens int 512 Max response tokens
top_p float 1.0 Nucleus sampling
top_k int 0 Top-k sampling (0 = disabled)

Response format:

๐Ÿ  LOCAL ยท Qwen3.6-35B-A3B-4bit

[model response here]

---
Tokens: 12 prompt + 48 completion = 60 total | 1.24s

quick_test

Run a predefined diagnostic prompt to benchmark your model and verify it's working.

quick_test math        # 347 ร— 28 โ€” tests reasoning + speed
quick_test hello       # intro prompt โ€” tests personality / identity
quick_test creative    # two-sentence robot story โ€” tests creativity
quick_test code_review # Python snippet review โ€” tests code understanding

Response format:

Test: math
Prompt: What is 347 ร— 28? Show your working.

Response:
347 ร— 28 = 9,716  [working shown]

---
๐Ÿ  LOCAL ยท Qwen3.6-35B-A3B-4bit ยท 54.7 tok/s ยท 312 tokens ยท 5.71s

health_check

Verify your LLM backend is reachable and report what's loaded.

health_check

Response (oMLX):

{
  "status": "ok",
  "url": "http://localhost:8000",
  "models_loaded": "1/2"
}

Response (unreachable):

{
  "status": "unreachable",
  "url": "http://localhost:8000",
  "hint": "Make sure your LLM backend is running at http://localhost:8000."
}

list_models

List the models available on your backend.

list models

Response:

- Qwen3.5-27B-4bit
- Qwen3.6-35B-A3B-4bit

Configuration

Set via environment variables, or use the install command to write them automatically.

Variable Default Description
MLX_BASE_URL http://localhost:8080 Backend URL
MLX_DEFAULT_MODEL "" Model name. If empty, auto-detected from /v1/models on first call
MLX_API_KEY "" API key for secured backends (e.g. oMLX)
MLX_TIMEOUT 30 Request timeout in seconds

Auto-detection

When MLX_DEFAULT_MODEL is not set, the server queries /v1/models on the first chat call and uses whatever model the backend reports. The result is cached for the session. This works well for single-model backends (MLX LM, Ollama). For oMLX with multiple configured models, set MLX_DEFAULT_MODEL explicitly since oMLX lists all configured models, not just the loaded one.


Install command reference

mlx-mcp-server install [options]
Flag Description
--claude-code Target Claude Code (~/.claude/settings.json) instead of Claude Desktop
--base-url URL Backend URL (default: http://localhost:8080)
--model NAME Model name โ€” optional, auto-detected if omitted
--api-key KEY API key for secured backends
--dry-run Print the config that would be written without touching any files

Preview before writing:

mlx-mcp-server install --claude-code \
  --base-url http://localhost:8000 \
  --api-key mykey \
  --model "Qwen3.6-35B-A3B-4bit" \
  --dry-run

Update model without changing other settings (just re-run with new --model):

mlx-mcp-server install --claude-code \
  --base-url http://localhost:8000 \
  --api-key mykey \
  --model "Qwen3.5-27B-4bit"

Manual config

If you prefer to edit the config file directly:

Claude Desktop โ€” ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)

Claude Code โ€” ~/.claude/settings.json

{
  "mcpServers": {
    "mlx": {
      "command": "mlx-mcp-server",
      "env": {
        "MLX_BASE_URL": "http://localhost:8000",
        "MLX_DEFAULT_MODEL": "Qwen3.6-35B-A3B-4bit",
        "MLX_API_KEY": "your-key-here"
      }
    }
  }
}

Supported backends

Backend Platform Default port Notes
oMLX macOS (Apple Silicon) 8000 Requires API key + explicit model name
MLX LM macOS (Apple Silicon) 8080 No auth needed, model auto-detected
Ollama macOS / Linux / Windows 11434 Set MLX_DEFAULT_MODEL to model name
LM Studio macOS / Windows 1234 Enable "Local Server" in LM Studio

oMLX-specific notes

oMLX is a native macOS GUI for running MLX models on Apple Silicon. A few quirks to know:

  • Port: listens on 127.0.0.1:8000 (not 8080)
  • API key required: set one in oMLX settings and pass it via --api-key
  • Model field required: oMLX returns 422 if model is omitted from requests โ€” always set MLX_DEFAULT_MODEL
  • /health endpoint: unauthenticated, returns engine pool info โ€” health_check uses this first
  • MoE models: Qwen3.6-35B-A3B-4bit activates only ~3B params per token โ€” 5โ€“6ร— faster than dense 27B models at the same quality level

Requirements

  • Python 3.11+
  • A running OpenAI-compatible LLM backend

Development

git clone https://github.com/deresolution20/mlx-mcp-server
cd mlx-mcp-server

# Install with dev dependencies
uv sync --dev

# Run tests
uv run pytest tests/ -v

# Install locally for testing
uv tool uninstall mlx-mcp-server 2>/dev/null
uv tool install . --no-cache

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured