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 --mcp

Claude 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:

ToolDescription
gerbil_generateGenerate text with local LLM
gerbil_summarizeSummarize content
gerbil_explainExplain code or concepts
gerbil_reviewCode review
gerbil_commitGenerate commit message from diff
gerbil_translateTranslate text
gerbil_embedGenerate 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 model
gerbil serve --mcp --model qwen3-0.6b
# Limit available tools
gerbil serve --mcp --tools generate,summarize,commit
# HTTP mode (for custom clients)
gerbil serve --port 3000

Custom Tools

Define custom tools in a config file:

gerbil.config.ts
01// gerbil.config.ts
02import { 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 tool
13 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/gerbil

Model loading slowly

Models are cached after first download. Use a smaller model for faster startup:

Terminal
gerbil serve --mcp --model smollm2-360m

Check server status

Terminal
# Test the server
echo '{"method":"tools/list","id":1}' | gerbil serve --mcp