Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Agent Setup

Bobbin integrates with AI coding assistants through the Model Context Protocol (MCP). This gives your AI agent semantic search, code coupling analysis, and context assembly capabilities over your codebase.

Claude Code

Add bobbin as an MCP server in your Claude Code configuration:

Project-level (.claude/settings.json):

{
  "mcpServers": {
    "bobbin": {
      "command": "bobbin",
      "args": ["serve"],
      "env": {}
    }
  }
}

Global (~/.claude/settings.json): Same format, applies to all projects.

Once configured, Claude Code can use bobbin’s tools (search, grep, context, related, find_refs, list_symbols, read_chunk, hotspots, prime) directly in conversation.

Option 2: Hook Integration

For automatic context injection on every prompt (no manual tool calls needed):

bobbin hook install

This registers hooks in Claude Code’s settings.json that:

  1. On every prompt (UserPromptSubmit): Search your codebase for code relevant to the prompt and inject it as context.
  2. After compaction (SessionStart): Restore codebase awareness when context is compressed.

You can also install the git hook for automatic re-indexing:

bobbin hook install-git-hook

See hook CLI reference for configuration options (--threshold, --budget, --global).

Both Together

MCP server and hooks complement each other:

  • Hooks provide passive, automatic context on every prompt
  • MCP tools let the agent actively search, explore, and analyze code
# Set up both
bobbin hook install
# Add MCP server to .claude/settings.json (see above)

Cursor

Add bobbin as an MCP server in Cursor’s settings:

.cursor/mcp.json:

{
  "mcpServers": {
    "bobbin": {
      "command": "bobbin",
      "args": ["serve"]
    }
  }
}

Other MCP Clients

Any MCP-compatible client can connect to bobbin. The server communicates via stdio by default:

bobbin serve            # MCP server on stdio
bobbin serve --server   # HTTP REST API instead

For remote or shared deployments, see HTTP Mode.

Verifying the Connection

Once configured, your AI agent should have access to bobbin’s tools. Test by asking it to:

  • “Search for error handling code” (uses search tool)
  • “What files are related to src/main.rs?” (uses related tool)
  • “Find the definition of parse_config” (uses find_refs tool)

Prerequisites

Before connecting an agent, make sure your repository is initialized and indexed:

bobbin init
bobbin index

Next Steps