MCP Server
Use Gerbil with Claude Desktop, Cursor, and other MCP clients.
What is MCP?
The Model Context Protocol (MCP) allows AI assistants like Claude to use local tools. Gerbil's MCP server gives Claude access to local LLM inference for tasks like summarization, code review, and commit message generation — all running on your machine.
Quick Start
Start the MCP server:
Terminal
gerbil serve --mcpClaude Desktop Setup
Add Gerbil to your Claude Desktop configuration:
claude_desktop_config.json
{ "mcpServers": { "gerbil": { "command": "npx", "args": ["-y", "@tryhamster/gerbil", "serve", "--mcp"] } }}Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
Cursor Setup
Add Gerbil to Cursor's MCP configuration:
.cursor/mcp.json
{ "servers": { "gerbil": { "command": "npx", "args": ["-y", "@tryhamster/gerbil", "serve", "--mcp", "--model", "qwen3-0.6b"] } }}Available Tools
When connected, Claude can use these tools:
| Tool | Description |
|---|---|
gerbil_generate | Generate text with local LLM |
gerbil_summarize | Summarize content |
gerbil_explain | Explain code or concepts |
gerbil_review | Code review |
gerbil_commit | Generate commit message from diff |
gerbil_translate | Translate text |
gerbil_embed | Generate embeddings |
Usage Examples
Once configured, you can ask Claude:
- "Use gerbil to summarize this document locally"
- "Generate a commit message for my staged changes with gerbil"
- "Have gerbil review this code for security issues"
- "Ask gerbil to explain this function"
Server Options
Terminal
# Specify modelgerbil serve --mcp --model qwen3-0.6b
# Limit available toolsgerbil serve --mcp --tools generate,summarize,commit
# HTTP mode (for custom clients)gerbil serve --port 3000Custom Tools
Define custom tools in a config file:
gerbil.config.ts
01// gerbil.config.ts02import { defineConfig } from "@tryhamster/gerbil";03
04export default defineConfig({05 model: "qwen3-0.6b",06 mcp: {07 tools: {08 generate: true,09 summarize: true,10 commit: true,11 12 // Custom tool13 analyze_sentiment: {14 name: "analyze_sentiment",15 description: "Analyze sentiment of text",16 parameters: {17 text: { type: "string", description: "Text to analyze" },18 },19 handler: async ({ text }, gerbil) => {20 return gerbil.json(21 `Analyze sentiment: ${text}`,22 { schema: sentimentSchema }23 );24 },25 },26 },27 },28});Troubleshooting
Server not connecting
Make sure Gerbil is installed globally or use npx:
Terminal
npm install -g @tryhamster/gerbilModel loading slowly
Models are cached after first download. Use a smaller model for faster startup:
Terminal
gerbil serve --mcp --model smollm2-360mCheck server status
Terminal
# Test the serverecho '{"method":"tools/list","id":1}' | gerbil serve --mcp