llama-diffusion-mcp
Enables LLMs like Claude to bidirectionally chat with diffusion-based LLMs (e.g., DiffusionGemma, LLaDA) via a persistent llama-diffusion-cli process, with support for restarting sessions and full configuration.
README
Llama Diffusion MCP Bridge
A robust, bidirectional Model Context Protocol (MCP) server that allows Large Language Models (like Claude) to seamlessly interact with diffusion-based LLMs (e.g., DiffusionGemma, LLaDA, RND1) via llama-diffusion-cli.
✨ Features
- Bidirectional Interactive Chat: Spawns and manages a persistent background instance of
llama-diffusion-clito maintain conversation context and avoid reloading heavy GGUF weights on every turn. - Graceful Lifecycle Management: Includes tools for the LLM to cleanly terminate (
/exit) and restart the background process when you ask to start a new chat session. - Zero-Setup Execution: Configured with
uvandpyproject.tomlso it can be run directly from the repository without manually managing virtual environments. - Fully Configurable: Supports all standard
llama.cppdiffusion parameters (steps, algorithms, temperature, batch sizing) directly through initialization arguments.
🛠️ Prerequisites
- Python 3.10+
- uv (Recommended package manager)
- llama-diffusion-cli: Must be compiled from the
llama.cpprepository.
🚀 Quick Start & Installation
uv run --with git+https://github.com/hkbu-kennycheng/llama-diffusion-mcp.git llama-diffusion-mcp -hf unsloth/diffusiongemma-26B-A4B-it-GGUF:Q4_K_M -ngl 99 -n 128000
🔌 Connecting to Claude Desktop
To use this bridge with Claude Desktop (or any other MCP Client), add the server to your configuration file.
Path:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Example Configuration (LLaDA 8B)
{
"mcpServers": {
"llama-diffusion-chat": {
"command": "uv",
"args": [
"run",
"--with", "git+https://github.com/hkbu-kennycheng/llama-diffusion-mcp.git",
"llama-diffusion-mcp",
"-hf", "unsloth/diffusiongemma-26B-A4B-it-GGUF:Q4_K_M",
"-ngl", "99",
"-n", "128000"
],
"env": {
"LLAMA_DIFFUSION_CLI_PATH": "/absolute/path/to/llama.cpp/build/bin/llama-diffusion-cli"
}
}
}
}
Note: Restart Claude Desktop after updating the config.
⚙️ Configuration Options
The MCP server accepts standard llama-diffusion-cli arguments:
| Argument | Description |
|---|---|
-m, --model |
(Required) Path to the GGUF model file. |
-i, --interactive |
Run in interactive mode (Highly recommended for this bridge). |
-c, --ctx-size |
Context size. |
-ub, --ubatch-size |
Maximum sequence length (ubatch size). |
--diffusion-steps |
Number of diffusion steps (e.g., 256). |
--diffusion-algorithm |
Algorithm for token selection (0-4). |
--temp |
Temperature for sampling. |
Advanced MCP Settings
| Argument | Description |
|---|---|
--mcp-prompt-marker |
The string the CLI prints when waiting for input (Default: > ). Determines when the server stops reading the stream. |
LLAMA_DIFFUSION_CLI_PATH |
Environment variable pointing to your CLI executable. Defaults to llama-diffusion-cli if in your system PATH. |
🛠️ Exposed MCP Tools
Once connected, your LLM will have access to the following tools:
chat_with_diffusion(prompt: str)Sends a message to the persistently running Diffusion LLM and returns the generated text.restart_chat_session()Gracefully exits the current chat process using the/exitcommand and spins up a fresh session. The LLM will use this if you ask it to clear context or start over.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.