Skip to content
Code Guide

8. MCP Servers

MCP (Model Context Protocol) is a standard for connecting AI models to external tools and data sources.

Without MCPWith MCP
Limited to built-in toolsExtensible tool ecosystem
Claude guesses about external dataClaude queries real data
Generic code understandingDeep semantic analysis
┌─────────────────────────────────────────────────────────┐
│ MCP ARCHITECTURE │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ │
│ │ Claude Code │ │
│ └──────┬──────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────┐ │
│ │ MCP Protocol │ │
│ └──────────────────────┬──────────────────────┘ │
│ │ │
│ ┌───────────────┼───────────────┐ │
│ ▼ ▼ ▼ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Serena │ │ Context7 │ │ Postgres │ │
│ │(Semantic) │ │ (Docs) │ │(Database) │ │
│ └───────────┘ └───────────┘ └───────────┘ │
│ │
└─────────────────────────────────────────────────────────┘

🆕 Since January 2026: MCP can now deliver interactive UIs alongside traditional text responses.

Traditional AI interactions require repeated prompts for data exploration:

Without MCP Apps:

You: "Show me customer data"
Claude: "Here are 500 customers [text list]"
You: "Sort by revenue"
Claude: "Here's the sorted list [text]"
You: "Filter to last 30 days"
Claude: "Here's the filtered list [text]"
You: "Show me the top 10"
... (multiple prompt cycles)

With MCP Apps:

You: "Show me customer data"
Claude: [Renders interactive dashboard with sorting, filtering, date pickers]
You: [Sort, filter, drill-down directly in UI - no additional prompts]

MCP Apps enable MCP servers to deliver interactive interfaces that render directly in your conversation:

  • Dashboards: Charts with filtering, drill-down, export
  • Configuration wizards: Forms with dependent fields and validation
  • Document viewers: PDFs with inline highlights and annotations
  • Real-time monitors: Live metrics updating without re-running tools

At launch (January 26, 2026), 9 interactive tools are available:

ToolWhat It Does
AsanaCreate project timelines, manage tasks visible to teams
SlackDraft formatted messages with preview before posting
FigmaConvert text into flowcharts, Gantt charts in FigJam
AmplitudeBuild analytics charts, explore trends interactively
BoxSearch files, preview documents inline
CanvaCreate presentations with real-time design customization
ClayResearch companies, find contacts, draft outreach
HexQuery data with interactive charts and tables
monday.comManage work, update boards, visualize progress

Coming soon: Salesforce (Agentforce 360), Claude Cowork integration

Access: claude.ai/directory (Pro/Max/Team/Enterprise plans)

PlatformSupportHow to Use
Claude Desktop✅ Nowclaude.ai/directory - connect interactive tools
Claude Cowork🔄 ComingAgentic workflows with file/project access
VS Code✅ InsidersInstall Insiders build, configure MCP Apps
ChatGPT🔄 RolloutWeek of Jan 26, 2026
Goose✅ NowOpen-source alternative with UI support
Claude Code CLI❌ NoTerminal is text-only (no UI rendering)

Direct impact: None - Claude Code CLI cannot render interactive UIs in the terminal.

Indirect benefits:

  1. Ecosystem awareness: Understand where MCP is heading (interactive agentic workflows)
  2. Hybrid workflows: Use Claude Desktop for visual exploration → Claude Code CLI for automation
  3. MCP server development: If building custom servers, Apps is now an option
  4. Context for tools: Some MCP servers may advertise UI capabilities (visible in metadata)

Example hybrid workflow:

1. Claude Desktop: Use Amplitude MCP App to explore analytics interactively
2. Identify patterns visually (e.g., "EU region shows 30% growth")
3. Claude Code CLI: Automate data export and reporting based on findings

MCP Apps is built on the Model Context Protocol (open standard by Anthropic):

  • Open specification: SEP-1865 on GitHub
  • Co-authored by: OpenAI, Anthropic, MCP-UI creators
  • SDK: @modelcontextprotocol/ext-apps (npm)
  • “Build once, deploy everywhere”: Works in Claude, VS Code, ChatGPT, Goose

Deep dive: See guide/architecture.md:656 for technical architecture, security model, and SDK details.


MCP Server Catalog (click to expand)

Purpose: Deep code understanding through semantic analysis, indexing, and persistent memory.

Why Serena matters: Claude Code has no built-in indexation (unlike Cursor). Serena fills this gap by indexing your codebase for faster, smarter searches. It also provides session memory — context that persists across conversations.

Key Features:

FeatureDescription
IndexationPre-indexes your codebase for efficient symbol lookup
Project MemoryStores context in .serena/memories/ between sessions
OnboardingAuto-analyzes project structure on first run

Tools:

ToolDescription
find_symbolFind functions, classes, methods by name
get_symbols_overviewGet file structure overview
search_for_patternRegex search across codebase
find_referencing_symbolsFind all usages of a symbol
replace_symbol_bodyReplace function/class body
write_memorySave context for future sessions
read_memoryRetrieve saved context
list_memoriesList all stored memories

Session Memory Workflow:

# Start of session
list_memories() → See what context exists
read_memory("auth_architecture") → Load relevant context
# During work
write_memory("api_refactor_plan", "...") → Save decisions for later
# End of session
write_memory("session_summary", "...") → Persist progress

Setup:

Terminal window
# Basic indexation (first run)
uvx --from git+https://github.com/oraios/serena serena project index
# Force full rebuild (if index is corrupted or outdated)
uvx --from git+https://github.com/oraios/serena serena project index --force-full
# Incremental indexation (faster after initial index)
uvx --from git+https://github.com/oraios/serena serena project index --incremental
# Parallel processing (recommended: 50-75% of CPU cores)
uvx --from git+https://github.com/oraios/serena serena project index --parallel 4
# Verbose mode (see progress details)
uvx --from git+https://github.com/oraios/serena serena project index --verbose --force-full
# View all options
uvx --from git+https://github.com/oraios/serena serena project index --help

Indexation Options:

OptionDescriptionUse When
--force-fullComplete rebuild of indexCorrupted index, major codebase changes
--incrementalUpdate only changed filesRegular maintenance after initial index
--parallel NUse N CPU coresLarge codebases (use 50-75% of cores)
--verboseShow detailed progressDebugging indexation issues

Cache Location: Index stored in .serena/cache/typescript/ (add to .gitignore)

Important Notes:

  • Deprecated command: serena index-project → Use serena project index instead
  • First run: Use basic serena project index (auto-detects full rebuild)
  • Regular updates: Use --incremental for faster re-indexation
  • Performance: --parallel 4 on 8-core machine = ~60% faster indexation

Sources: Serena DocsGitHub IssuesOptimization Guide

Use when:

  • Navigating large codebases (>10k lines)
  • Need context to persist across sessions
  • Understanding symbol relationships
  • Refactoring across files

Source: Serena GitHub

Purpose: Privacy-first semantic code search with call graph analysis.

Why grepai is recommended: It’s fully open-source, runs entirely locally using Ollama embeddings (no cloud/privacy concerns), and offers call graph analysis — trace who calls what function and visualize dependencies. This combination makes it the best choice for most semantic search needs.

Key Features:

FeatureDescription
Semantic searchFind code by natural language description
Call graphTrace callers, callees, and full dependency graphs
Privacy-firstUses Ollama locally (no cloud)
Background indexinggrepai watch daemon keeps index fresh

Example:

Terminal window
# Semantic search (finds code by meaning, not exact text)
grepai search "user authentication flow"
# Who calls this function?
grepai trace callers "createSession"
# → Lists all 23 files that call createSession with context
# What does this function call?
grepai trace callees "SessionProvider"
# Full dependency graph
grepai trace graph "createSession" --depth 3

MCP Tools Available:

ToolDescription
grepai_searchNatural language semantic search
grepai_trace_callersFind all callers of a function
grepai_trace_calleesFind all functions called by a function
grepai_trace_graphGenerate call graph
grepai_index_statusCheck indexation status

Setup:

Terminal window
# 1. Install Ollama and embedding model
brew install ollama
brew services start ollama
ollama pull nomic-embed-text
# 2. Install grepai
curl -sSL https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.sh | sh
# 3. Initialize in your project
cd your-project
grepai init # Choose: ollama, nomic-embed-text, gob
# 4. Start indexing daemon
grepai watch &

Combined Workflow with Serena:

1. grepai search "payment validation" → Discover relevant files
2. Serena get_symbols_overview → Understand file structure
3. grepai trace callers "validatePayment" → See all dependencies
4. Serena find_symbol + replace_symbol_body → Precise editing

Use when:

  • Exploring unfamiliar codebases by intent
  • Understanding call dependencies before refactoring
  • Privacy is required (no cloud, all local)
  • Need to trace “who calls what” across the codebase

Performance vs Traditional Tools:

Search TypeToolTimeResults
Exact matchrg (ripgrep)~20msExact hits only
Exact matchgrep~45msExact hits only
Semanticgrepai~500msIntent-based matches

Key insight: grepai is ~25x slower than rg for exact matches, but finds results that pattern-based tools cannot discover.

Terminal window
# Know exact pattern → use rg (fast)
rg "createSession" --type ts
# Don't know exact name → use grepai (semantic)
grepai search "session creation logic"

Source: grepai GitHub


Purpose: Automatic persistent memory across Claude Code sessions through AI-compressed capture of tool usage and observations.

Why claude-mem matters: Unlike manual memory tools (Serena’s write_memory()), claude-mem automatically captures everything Claude does during sessions and intelligently injects relevant context when you reconnect. This solves the #1 pain point: context loss between sessions.

Key Features:

FeatureDescription
Automatic captureHooks into SessionStart, PostToolUse, Stop, SessionEnd lifecycle events
AI compressionUses Claude to generate semantic summaries (~10x token reduction)
Progressive disclosure3-layer retrieval (search → timeline → observations) saves ~95% tokens
Hybrid searchFull-text + vector search (Chroma) + natural language queries
Web dashboardReal-time UI at http://localhost:37777 for exploring history
Privacy controls<private> tags to exclude sensitive content from storage

Architecture:

Lifecycle Hooks → Capture observations → AI compression (Claude)
SQLite storage
Chroma vector indexation
Session start auto-injection

Installation:

Terminal window
# Via plugin marketplace (recommended)
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
# Restart Claude Code
# claude-mem automatically activates on next session

Basic Usage:

Once installed, claude-mem works automatically—no manual commands needed. It captures all tool operations and injects relevant context at session start.

Natural Language Search (via skill):

Terminal window
# Search your session history
"Search my memory for authentication decisions"
"What files did we modify for the payment bug?"
"Remind me why we chose Zod over Yup"

Web Dashboard:

Terminal window
# Access real-time UI
open http://localhost:37777
# Features:
# - Timeline view of all sessions
# - Natural language search
# - Observation details
# - Session statistics

Progressive Disclosure Workflow:

claude-mem uses a 3-layer approach to minimize token consumption:

Layer 1: Search (50-100 tokens)
├─ "Find sessions about authentication"
├─ Returns: 5 relevant session summaries
Layer 2: Timeline (500-1000 tokens)
├─ "Show timeline for session abc123"
├─ Returns: Chronological observation list
Layer 3: Details (full context)
└─ "Get observation details for obs_456"
Returns: Complete tool call + result

Result: ~10x token reduction vs loading full session history.

Privacy Controls:

<!-- In your prompts -->
<private>
Database credentials: postgres://prod-db-123
API key: sk-1234567890abcdef
</private>
<!-- claude-mem excludes <private> content from storage -->

Cost Considerations:

AspectCostNotes
API compression~$0.15 per 100 observationsAI summarization (model configurable)
StorageFree (local SQLite)10-20 MB/month (light use), 100-200 MB/month (heavy use)
QueriesFree (local vectors)Chroma indexation runs locally

Typical monthly cost: $5-15 for heavy users (100+ sessions/month)

Cost optimization — use Gemini instead of Claude for compression:

By default, claude-mem uses Claude (Haiku) for AI summarization. You can configure Gemini 2.5 Flash instead for significant cost savings:

Terminal window
# In claude-mem dashboard settings (localhost:37777)
# Set compression model to: gemini-2.5-flash
ModelCost/month (~400 sessions)Savings
Claude Haiku (default)~$102
Gemini 2.5 Flash~$14-86%

Gemini 2.5 Flash produces comparable compression quality at a fraction of the cost. If you’re running claude-mem at scale, this is the single highest-ROI configuration change.

Critical installation gotcha — hooks coexistence:

claude-mem adds hooks on SessionStart, PostToolUse, Stop, and SessionEnd. If you already have hooks in settings.json, claude-mem will not automatically merge them — it will overwrite the hooks arrays.

Before installing:

  1. Back up your current settings.json
  2. Note all existing hooks (PostToolUse, UserPromptSubmit arrays)
  3. After installation, manually verify the hooks arrays contain both your existing hooks AND the new claude-mem hooks
// ✅ Correct — both hooks coexist
"hooks": {
"PostToolUse": [
{"matcher": "...", "hooks": [{"type": "command", "command": "your-existing-hook.sh"}]},
{"matcher": "...", "hooks": [{"type": "command", "command": "claude-mem-hook.sh"}]}
]
}
// ❌ Wrong — claude-mem silently replaced your hooks
"hooks": {
"PostToolUse": [
{"matcher": "...", "hooks": [{"type": "command", "command": "claude-mem-hook.sh"}]}
]
}

Reliability: fail-open architecture (v9.1.0+):

If the claude-mem worker process is down (crash, restart, port conflict), Claude Code continues working normally — it does not block or error. Sessions simply aren’t captured until the worker restarts.

Terminal window
# Check worker status
open http://localhost:37777 # dashboard — if unreachable, worker is down
# Restart worker manually if needed
npx claude-mem@latest start

This fail-open behavior makes claude-mem safe to install in production workflows — a dead worker never blocks your work.

Limitations:

LimitationImpactWorkaround
CLI onlyNo web interface, no VS CodeUse Claude Code CLI exclusively
No cloud syncCan’t sync between machinesManual export/import via claude-mem export
AGPL-3.0 licenseCommercial restrictions, source disclosureCheck license compliance for commercial use
Manual privacy tagsMust explicitly mark sensitive dataUse <private> tags consistently

Use when:

  • Working on projects >1 week with multiple sessions
  • Need to remember architectural decisions across days/weeks
  • Frequently ask “what did we do last time?”
  • Want to avoid re-reading files for context
  • Value automatic capture over manual note-taking

Don’t use when:

  • One-off quick tasks (<10 minutes)
  • Extremely sensitive data (consider manual Serena instead)
  • Commercial projects without AGPL compliance review
  • Need cross-machine sync (not supported)

Example: Multi-Day Refactoring:

Day 1 (Session 1):
User: "Explore auth module"
Claude: [Reads auth.service.ts, session.middleware.ts]
claude-mem: Captures "Auth exploration: JWT validation, session management"
Day 2 (Session 2):
Claude: [Auto-injected context]
"Previously: Explored auth module. Files: auth.service.ts, session.middleware.ts.
Key finding: JWT validation in validateToken()"
User: "Refactor auth to use jose library"
Claude: [Already has context, no re-reading needed]
Day 3 (Session 3):
Claude: [Auto-injected context]
"Day 1: Auth exploration. Day 2: Refactored to jose library.
Decision: Chose jose over jsonwebtoken (lighter, 40% fewer deps)"
User: "Add tests for auth refactoring"
Claude: [Full context of decisions and changes]

Stats (verified 2026-02-10):

  • 26.5k GitHub stars, 1.8k forks
  • 181 releases, 46 contributors
  • Latest: v9.1.1 (Feb 7, 2026)
  • License: AGPL-3.0 + PolyForm Noncommercial

Sources:


Now that you’ve seen Serena, grepai, and claude-mem, here’s when to use each:

NeedToolExample
”What did we do yesterday?“claude-memAuto-inject previous session context
”Find function login”Serenafind_symbol --name "login"
”Who calls this function?“grepaigrepai trace callers "login"
”Record arch decision”Serenawrite_memory("auth_decision", "Use JWT")
”Find code that does X”grepaigrepai search "payment validation"
”Summary of all sessions”claude-memWeb dashboard at localhost:37777
”Exact pattern match”rg (native)rg "authenticate" --type ts

Memory Stack Pattern (4 layers):

Layer 4: Session Capture → claude-mem (automatic)
Layer 3: Symbol Memory → Serena (manual decisions)
Layer 2: Semantic Search → grepai (discovery)
Layer 1: Exact Search → rg (native, fast)

Integrated Workflow Example:

Terminal window
# Scenario: Refactoring auth module after 3 days
# 1. AUTO CONTEXT (claude-mem)
# At session start, Claude auto-injects:
# "3 previous sessions explored auth module.
# Decision: Migrate to JWT.
# Files modified: auth.service.ts, session.middleware.ts"
# 2. ARCH DECISIONS (Serena)
serena list_memories
# → "auth_decision: Use JWT for stateless API (2026-02-07)"
serena read_memory("auth_decision")
# 3. SEMANTIC DISCOVERY (grepai)
grepai search "JWT token validation"
# → Finds validateJWT() in auth.service.ts
# 4. DEPENDENCIES (grepai trace)
grepai trace callers "validateJWT"
# → Called by: ApiGateway, AdminPanel, UserController
# 5. EXACT SEARCH (rg)
rg "validateJWT" --type ts -A 5

Result: Complete context without re-reading all files, architectural decisions preserved, dependencies mapped → safe refactoring.

Comparison: claude-mem vs Serena vs grepai:

Aspectclaude-memSerenagrepai
TriggerAuto (hooks)Manual APIManual CLI
StorageSQLite + Chroma.serena/memories/Ollama vectors
PurposeSession captureSymbol memorySemantic search
Dashboard✅ Web UI❌ No❌ No
Cost~$0.15/100 obsFreeFree
EffortZero (automatic)Manual commandsManual commands
QueryNatural languageKey lookupSemantic search
LicenseAGPL-3.0MITMIT

When to combine tools:

  • claude-mem + Serena: Automatic capture + manual architectural decisions
  • claude-mem + grepai: Session history + semantic code discovery
  • All 3: Complete memory stack (session + symbol + semantic + exact)

🔍 Search Tools Comparison: rg vs grepai vs Serena vs ast-grep vs claude-mem

Section titled “🔍 Search Tools Comparison: rg vs grepai vs Serena vs ast-grep vs claude-mem”

Now that you’ve seen individual tools, here’s how they compare and when to use each:

I need to…ToolExample
Find exact textrg (Grep)rg "authenticate" --type ts
Find by meaninggrepaigrepai search "user login flow"
Find function definitionSerenaserena find_symbol --name "login"
Find structural patternast-grepast-grep "async function $F"
See who calls functiongrepaigrepai trace callers "login"
Get file structureSerenaserena get_symbols_overview
Remember past sessionsclaude-memAuto-injected at session start
Featurerg (ripgrep)grepaiSerenaast-grepclaude-mem
Search typeRegex/textSemanticSymbol-awareAST structureSession history
Speed⚡ ~20ms🐢 ~500ms⚡ ~100ms🕐 ~200ms⚡ ~100ms
Setup✅ None⚠️ Ollama⚠️ MCP⚠️ npm⚠️ Plugin
Integration✅ Native⚠️ MCP⚠️ MCP⚠️ Plugin⚠️ Plugin
Call graph❌ No✅ Yes❌ No❌ No❌ No
Symbol tracking❌ No❌ No✅ Yes❌ No❌ No
Session memory❌ No❌ No✅ Manual❌ No✅ Automatic
Auto capture❌ No❌ No❌ No❌ No✅ Yes
Web dashboard❌ No❌ No❌ No❌ No✅ Yes

Use rg (ripgrep) when:

  • ✅ You know the exact text/pattern
  • ✅ Speed is critical (~20ms)
  • ✅ No setup complexity wanted
  • ❌ Don’t use for: conceptual searches, dependency tracing

Use grepai when:

  • ✅ Finding code by meaning/intent
  • ✅ Need to trace function calls (who calls what)
  • ✅ Privacy required (100% local with Ollama)
  • ❌ Don’t use for: exact text (use rg instead)

Use Serena when:

  • ✅ Refactoring across multiple files
  • ✅ Need symbol-aware navigation
  • ✅ Persistent context/memory needed
  • ❌ Don’t use for: simple text searches

Use ast-grep when:

  • ✅ Large-scale refactoring (>50k lines)
  • ✅ Framework migrations (React, Vue)
  • ✅ Finding structural patterns (async without try/catch)
  • ❌ Don’t use for: small projects, simple searches

Use claude-mem when:

  • ✅ Multi-session projects (>1 week)
  • ✅ Need to remember architectural decisions
  • ✅ Frequently reconnecting to same project
  • ✅ Want automatic context injection (no manual effort)
  • ❌ Don’t use for: one-off tasks, extremely sensitive data

Task: Refactor authentication across codebase

Terminal window
# 1. Discover (grepai - semantic)
grepai search "authentication and session management"
# → Finds: auth.service.ts, session.middleware.ts
# 2. Structure (Serena - symbols)
serena get_symbols_overview --file auth.service.ts
# → Classes: AuthService, functions: login, logout
# 3. Dependencies (grepai - call graph)
grepai trace callers "login"
# → Called by: UserController, ApiGateway (23 files)
# 4. Patterns (ast-grep - structure)
ast-grep "async function login" --without "try { $$$ } catch"
# → Finds 3 async functions missing error handling
# 5. Verification (rg - exact)
rg "validateSession" --type ts -A 5
# → Verify specific implementation

Result: Complete understanding + safe refactoring in 5 commands

📖 Complete Guide: See Search Tools Mastery for detailed workflows, real-world scenarios, and advanced combinations.


Purpose: Natural language semantic search across code, docs, PDFs, and images.

Why consider mgrep: If you need multi-format search (code + PDFs + images) or prefer a cloud-based solution, mgrep is an alternative to grepai. Their benchmarks show ~2x fewer tokens used compared to grep-based workflows.

Key Features:

FeatureDescription
Semantic searchFind code by natural language description
Background indexingmgrep watch indexes respecting .gitignore
Multi-formatSearch code, PDFs, images, text
Web integrationWeb search fallback capability

Example:

Terminal window
# Traditional grep (exact match required)
grep -r "authenticate.*user" .
# mgrep (intent-based)
mgrep "code that handles user authentication"

Use when:

  • Need to search across mixed content (code + PDFs + images)
  • Prefer cloud-based embeddings over local Ollama setup
  • grepai’s call graph analysis isn’t needed

Note: I haven’t tested mgrep personally. Consider it an alternative worth exploring. Source: mgrep GitHub

Purpose: Access official library documentation.

Tools:

ToolDescription
resolve-library-idFind library documentation
query-docsQuery specific documentation

Use when:

  • Learning new libraries
  • Finding correct API usage
  • Checking official patterns

Purpose: AST-based pattern matching for precise structural code searches.

Type: Optional Community Plugin (not core Claude Code)

Installation:

Terminal window
# Install ast-grep skill for Claude Code
npx skills add ast-grep/agent-skill
# Or manually via plugin marketplace
/plugin marketplace add

What is ast-grep?

ast-grep searches code based on syntax structure (Abstract Syntax Tree) rather than plain text. This enables finding patterns like “async functions without error handling” or “React components using specific hooks” that regex cannot reliably detect.

Key Characteristics:

AspectBehavior
InvocationExplicit - Claude cannot automatically detect when to use it
IntegrationPlugin that teaches Claude how to write ast-grep rules
LanguagesJavaScript, Python, Rust, Go, Java, C/C++, Ruby, PHP + more
Pattern matchingMetavariables ($VAR), relational queries, composite logic

When to use ast-grep:

Use for:

  • Large-scale refactoring (>50k lines, indicative threshold)
  • Framework migrations (React class→hooks, Vue 2→3)
  • Structural patterns:
    • Async functions lacking error handling
    • Functions exceeding parameter thresholds
    • Console.log calls within class methods
    • React components using specific hooks
  • Architecture analysis (identify coupled components, dependency patterns)

Don’t use for (grep suffices):

  • Simple string searches (function names, imports)
  • Small projects (<10k lines)
  • One-off searches
  • Text-based patterns (TODO comments, log messages)

Decision Tree:

Search need?
├─ String/regex pattern → Grep (native, fast)
├─ Semantic meaning → Serena MCP (symbol search) or grepai (RAG-based)
└─ Structural pattern (AST) → ast-grep (plugin, setup required)

Trade-offs:

AspectGrepast-grepSerena MCPgrepai
Speed⚡ Fast (~20ms)ModerateFastSlower (embedding)
Setup✅ None⚠️ Installation + learning⚠️ MCP config⚠️ MCP + Ollama
PrecisionRegex-basedAST-accurateSymbol-awareSemantic
Use caseText patternsCode structureSymbols/functionsMeaning-based

Example usage:

Terminal window
# User explicitly requests ast-grep
You: Use ast-grep to find all async functions without try/catch blocks
# Claude uses the ast-grep skill to construct rules
Claude: [Constructs AST pattern, executes search, reports results]

Important limitations (as of Nov 2025):

“Claude Code cannot automatically detect when to use ast-grep for all appropriate use cases.” - ast-grep/claude-skill README

This means you must explicitly tell Claude to use ast-grep. It won’t decide on its own.

Sources:

Design Philosophy Context:

Early Claude Code versions used RAG with Voyage embeddings for semantic search. Anthropic switched to grep-based (ripgrep) agentic search after benchmarks showed superior performance with lower operational complexity (no index sync, no security liabilities). This “Search, Don’t Index” philosophy prioritizes simplicity.

ast-grep is a community extension for specialized structural searches where grep’s regex approach isn’t sufficient, but it’s not a replacement for grep — it’s a surgical tool for specific use cases.

Related: See Section 8.4 - Server Selection Guide for choosing between grep/ast-grep/Serena/grepai.

Sequential Thinking (Structured Reasoning)

Section titled “Sequential Thinking (Structured Reasoning)”

Purpose: Multi-step analysis with explicit reasoning.

Tools:

ToolDescription
sequentialthinkingStep-by-step reasoning

Use when:

  • Complex debugging
  • Architectural analysis
  • System design decisions

Purpose: Direct database access for queries.

Tools:

ToolDescription
queryExecute SQL queries

Use when:

  • Investigating data issues
  • Understanding schema
  • Debugging data problems

Purpose: Browser testing and automation.

Tools:

ToolDescription
navigateGo to URL
clickClick element
fillFill form field
screenshotCapture screenshot

Use when:

  • E2E testing
  • Visual validation
  • Browser debugging

agent-browser (Vercel Labs) — AI-Native Browser Automation

Section titled “agent-browser (Vercel Labs) — AI-Native Browser Automation”

Status: Active development — v0.15.0 (Feb 2026). 12,100+ stars. Rapid release cycle.

Purpose: Headless browser CLI built for AI agents. Uses Playwright/CDP under the hood but optimizes all output for LLM consumption. Written in Rust for sub-millisecond startup.

Why it matters for agentic workflows: Playwright MCP is verbose — every DOM snapshot adds tokens. agent-browser returns only actionable elements via stable short references (@e1, @e2), cutting token usage by ~82.5% on identical scenarios (Pulumi benchmark, 2026-03-03).

Install:

Terminal window
# Homebrew
brew install vercel-labs/tap/agent-browser
# Or npm
npm install -g @vercel-labs/agent-browser

Capabilities:

FeatureDetails
Navigation + interactionClick, type, scroll, fill forms
Accessibility treeLLM-optimized snapshots (actionable elements only)
Visual diffsPixel-level comparison against baselines
Session persistenceSave/restore auth state (AES-256-GCM)
Multi-sessionIsolated instances, separate cookies/storage
Security (v0.15.0)Auth vaults, domain allowlists, action policies
Browser streamingLive WebSocket preview for human+agent “pair browsing”

agent-browser vs Playwright MCP:

DimensionPlaywright MCPagent-browser
Primary audienceDevelopers (test suites)AI agents
Token usageBaseline-82.5%
Element referencesXPath/CSS selectors@e1, @e2 (stable, compact)
ImplementationNode.jsRust (sub-ms startup)
Session persistenceNoYes
Security controlsNoneAuth vaults, domain allowlists
Self-verifying agentsAwkwardNative pattern

The Ralph Wiggum Loop — self-verifying agent pattern:

1. Agent codes the feature
2. Deploys (Vercel, any target)
3. agent-browser navigates to deployed URL autonomously
4. Tests scenarios, reads accessibility snapshots
5. On failure: agent reads output, fixes code, re-deploys
6. Loop until all scenarios pass — no human in the loop

Documented in production at Pulumi (2026-03-03) across 6 test scenarios on a real app.

Use when:

  • Agent must verify its own deployed output (self-verifying loops)
  • Token cost of browser context is a constraint
  • Multi-session testing (parallel isolated browser instances)
  • Visual regression in agentic CI/CD pipelines

Don’t use when:

  • You have existing Playwright test suites — not a drop-in replacement for test runners
  • Scraping anti-bot protected sites — IP/behavior detection unchanged (Browserbase-type services still needed)

Resources:

⚠️ Status: Under Testing - This MCP server is being evaluated. The documentation below is based on the official repository but hasn’t been fully validated in production workflows yet. Feedback welcome!

Purpose: Persistent semantic memory with cross-session search and multi-client support.

Why doobidoo complements Serena:

  • Serena: Key-value memory (write_memory("key", "value")) - requires knowing the key
  • doobidoo: Semantic search (retrieve_memory("what did we decide about auth?")) - finds by meaning
FeatureSerenadoobidoo
Memory storageKey-valueSemantic embeddings
Search by meaningNoYes
Multi-clientClaude only13+ apps
DashboardNoKnowledge Graph
Symbol indexationYesNo

Storage Backends:

BackendUsagePerformance
sqlite_vec (default)Local, lightweight<10ms queries
cloudflareCloud, multi-device syncEdge performance
hybridLocal fast + cloud background sync5ms local

Data Location: ~/.mcp-memory-service/memories.db (SQLite with vector embeddings)

MCP Tools Available (12 unified tools):

ToolDescription
store_memoryStore with tags, type, metadata
retrieve_memorySemantic search (top-N by similarity)
search_by_tagExact tag matching (OR/AND logic)
delete_memoryDelete by content_hash
list_memoriesPaginated browsing with filters
check_database_healthStats, backend status, sync info
get_cache_statsServer performance metrics
memory_graph:connectedFind connected memories
memory_graph:pathShortest path between memories
memory_graph:subgraphSubgraph around a memory

Installation:

Terminal window
# Quick install (local SQLite backend)
pip install mcp-memory-service
python -m mcp_memory_service.scripts.installation.install --quick
# Team/Production install (more options)
git clone https://github.com/doobidoo/mcp-memory-service.git
cd mcp-memory-service
python scripts/installation/install.py
# → Choose: cloudflare or hybrid for multi-device sync

Configuration (add to MCP config):

{
"mcpServers": {
"memory": {
"command": "memory",
"args": ["server"]
}
}
}

Configuration with environment variables (for team/cloud sync):

{
"mcpServers": {
"memory": {
"command": "memory",
"args": ["server"],
"env": {
"MCP_MEMORY_STORAGE_BACKEND": "hybrid",
"MCP_HTTP_ENABLED": "true",
"MCP_HTTP_PORT": "8000",
"CLOUDFLARE_API_TOKEN": "your-token",
"CLOUDFLARE_ACCOUNT_ID": "your-account-id"
}
}
}
}

Key Environment Variables:

VariableDefaultDescription
MCP_MEMORY_STORAGE_BACKENDsqlite_vecBackend: sqlite_vec, cloudflare, hybrid
MCP_HTTP_ENABLEDtrueEnable dashboard server
MCP_HTTP_PORT8000Dashboard port
MCP_OAUTH_ENABLEDfalseEnable OAuth for team auth
MCP_HYBRID_SYNC_INTERVAL300Sync interval in seconds

Usage:

# Store a decision with tags
store_memory("We decided to use FastAPI for the REST API", tags=["architecture", "api"])
# Semantic search (finds by meaning, not exact match)
retrieve_memory("what framework for API?")
→ Returns: "We decided to use FastAPI..." with similarity score
# Search by tag
search_by_tag(["architecture"])
# Check health
check_database_health()

Multi-Client Sync:

# Same machine: all clients share ~/.mcp-memory-service/memories.db
Claude Code ──┐
Cursor ───────┼──► Same SQLite file
VS Code ──────┘
# Multi-device: use Cloudflare backend
Device A ──┐
Device B ──┼──► Cloudflare D1 + Vectorize
Device C ──┘

When to use which:

  • Serena: Symbol navigation, code indexation, key-value memory with known keys
  • doobidoo: Cross-session decisions, “what did we decide about X?”, multi-IDE sharing

Dashboard: Access at http://localhost:8000 after starting the server.

Source: doobidoo/mcp-memory-service GitHub (791 stars, v10.0.2)

Kairn: Knowledge Graph Memory with Biological Decay

Section titled “Kairn: Knowledge Graph Memory with Biological Decay”

⚠️ Status: Under Testing - Evaluated Feb 2026. MIT licensed, Python 100%. Feedback welcome!

Purpose: Long-term project memory organized as a knowledge graph with automatic decay — stale information expires on its own, preventing context pollution.

Key differentiators vs doobidoo/Serena:

  • Typed relationships: depends-on, resolves, causes — captures causality, not just content
  • Biological decay model: solutions persist ~200 days, workarounds ~50 days — auto-pruning without delete_memory calls
  • 18 MCP tools: graph ops, project tracking, experience management, intelligence layer (full-text search, confidence routing, cross-workspace patterns)
FeatureSerenadoobidooKairn
Storage modelKey-valueSemantic embeddingsKnowledge graph
Memory decay / auto-expiryNoNoYes (biological)
Typed relationshipsNoTags onlydepends-on / resolves / causes
Full-text searchNoYesYes
Auto-pruning stale infoNoNoYes

When Kairn makes sense:

  • Long-running projects where workarounds from months ago become noise
  • When causality matters: “this breaks because of that”, “this fix resolves that bug”
  • Teams wanting automatic knowledge hygiene without manual cleanup

MCP Config:

"kairn": {
"command": "python",
"args": ["-m", "kairn", "serve"],
"description": "Knowledge graph memory with biological decay"
}

Install:

Terminal window
pip install kairn
# or from source:
git clone https://github.com/kairn-ai/kairn && cd kairn && pip install -e .

Source: kairn-ai/kairn GitHub (MIT, Python 100%)

MCP Memory Stack: Complementarity Patterns

Section titled “MCP Memory Stack: Complementarity Patterns”

⚠️ Experimental - These patterns combine multiple MCP servers. Test in your workflow before relying on them.

The 4-Layer Knowledge Stack:

┌─────────────────────────────────────────────────────┐
│ KNOWLEDGE LAYER │
├─────────────────────────────────────────────────────┤
│ doobidoo │ Decisions, ADRs, business context │
│ (semantic) │ "Why did we do this?" │
├───────────────┼─────────────────────────────────────┤
│ Serena │ Symbols, structure, key-value memory│
│ (code index) │ "Where is X defined?" │
├───────────────┼─────────────────────────────────────┤
│ grepai │ Semantic code search + call graph │
│ (code search)│ "Find code that does X" │
├───────────────┼─────────────────────────────────────┤
│ Context7 │ Official library documentation │
│ (docs) │ "How to use library X?" │
└─────────────────────────────────────────────────────┘

Comparison Matrix:

CapabilitySerenagrepaidoobidooKairn
Cross-session memoryKey-valueNoSemanticKnowledge graph
Cross-IDE memoryNoNoYesYes
Cross-device syncNoNoYes (Cloudflare)No
Knowledge GraphNoCall graphDecision graphTyped relationships
Fuzzy searchNoCodeMemoryFull-text + semantic
Tags/categoriesNoNoYesYes
Memory decay / auto-expiryNoNoNoYes (biological)

Usage Patterns:

PatternToolExample
Decision takendoobidoostore_memory("Decision: FastAPI because async + OpenAPI", tags=["decision", "api"])
Convention establisheddoobidoostore_memory("Convention: snake_case for Python", tags=["convention"])
Bug resolveddoobidoostore_memory("Bug: token TTL mismatch Redis/JWT. Fix: align TTL+60s", tags=["bug", "auth"])
WIP warningdoobidoostore_memory("WIP: refactoring AuthService, don't touch", tags=["wip"])
Find symbolSerenafind_symbol("PaymentProcessor")
Find callersgrepaigrepai trace callers "validateToken"
Search by intentgrepaigrepai search "authentication logic"
Library docsContext7resolve-library-id("fastapi")

Combined Workflows:

# Workflow 1: Understanding a feature
retrieve_memory("payment module status?") # doobidoo → business context
grepai search "payment processing" # grepai → find code
find_symbol("PaymentProcessor") # Serena → exact location
# Workflow 2: Onboarding (Session 1 → Session N)
# Session 1 (senior dev)
store_memory("Architecture: hexagonal with ports/adapters", tags=["onboarding"])
store_memory("Tests in __tests__/, using Vitest", tags=["onboarding", "testing"])
store_memory("DANGER: never touch legacy/payment.ts without review", tags=["onboarding", "danger"])
# Session N (new dev)
retrieve_memory("project architecture?")
retrieve_memory("where are tests?")
retrieve_memory("dangerous areas?")
# Workflow 3: ADR (Architecture Decision Records)
store_memory("""
ADR-001: FastAPI vs Flask
- Decision: FastAPI
- Reason: native async, auto OpenAPI, typing
- Rejected: Flask (sync), Django (too heavy)
""", tags=["adr", "api"])
# 3 months later
retrieve_memory("why FastAPI?")
# Workflow 4: Debug context persistence
store_memory("Auth bug: Redis TTL expires before JWT", tags=["debug", "auth"])
store_memory("Fix: align Redis TTL = JWT exp + 60s margin", tags=["debug", "auth", "fix"])
# Same bug reappears months later
retrieve_memory("auth token redis problem")
→ Finds the fix immediately
# Workflow 5: Multi-IDE coordination
# In Claude Code (terminal)
store_memory("Refactoring auth in progress, don't touch AuthService", tags=["wip"])
# In Cursor (another window)
retrieve_memory("work in progress?")
→ Sees the warning

When to use which memory system:

NeedToolWhy
”I know the exact key”Serena read_memory("api_choice")Fast, direct lookup
”I remember the topic, not the key”doobidoo retrieve_memory("API decision?")Semantic search
”Share across IDEs”doobidooMulti-client support
”Share across devices”doobidoo + CloudflareCloud sync
”Code symbol location”Serena find_symbol()Code indexation
”Code by intent”grepai search()Semantic code search
”Long-term project memory, auto-expiry”KairnBiological decay model
”Why did X break / what resolved Y?”KairnTyped relationships (resolves, causes)

Current Limitations (doobidoo):

LimitationImpactWorkaround
No versioningCan’t see decision historyInclude dates in content
No permissionsAnyone can modifyUse separate DBs per team
No source linkingNo link to file/lineInclude file refs in content
No expirationStale memories persistManual cleanup with delete_memory OR use Kairn (auto-decay)
No git integrationNo branch-aware memoryTag with branch name

Purpose: Programmatic Git access via 12 structured tools for commit, diff, log, and branch management.

Why Git MCP vs Bash git: The Bash tool can run git commands but returns raw terminal output that requires parsing and consumes tokens. Git MCP returns structured data directly usable by Claude, with built-in filters (date, author, branch) and token-efficient diffs via the context_lines parameter.

⚠️ Status: Early development — API subject to change. Suitable for local workflows; test before adopting in production pipelines.

Tools (12):

ToolDescription
git_statusWorking tree status (staged, unstaged, untracked)
git_diff_unstagedUnstaged changes
git_diff_stagedStaged changes ready to commit
git_diffCompare any two branches, commits, or refs
git_commitCreate a commit with message
git_addStage one or more files
git_resetUnstage files
git_logCommit history with date, author, and branch filters
git_create_branchCreate a new branch
git_checkoutSwitch branches
git_showShow details for a commit or tag
git_branchList all local branches

Setup:

Terminal window
# No install required — uvx pulls it on first run
uvx mcp-server-git --repository /path/to/repo

Claude Code configuration (~/.claude.json):

{
"mcpServers": {
"git": {
"command": "uvx",
"args": ["mcp-server-git", "--repository", "/absolute/path/to/repo"]
}
}
}

Multi-repo configuration (different server per project):

{
"mcpServers": {
"git-frontend": {
"command": "uvx",
"args": ["mcp-server-git", "--repository", "/projects/frontend"]
},
"git-backend": {
"command": "uvx",
"args": ["mcp-server-git", "--repository", "/projects/backend"]
}
}
}

Comparison: Git MCP vs Bash:

Use caseBash gitGit MCP
Simple status checkFineOverkill
Filtered log (date + author)Long commandNative filter params
Diff with context controlPossiblecontext_lines param
Scripting / automationGoodBetter (structured output)
CI / production pipelinesTested, stableEarly dev, use with care

Typical workflows:

  • “Show me all commits by Alice in the last 7 days on the main branch”
  • “What files changed in the last 3 commits? Summarize the changes.”
  • “Stage src/auth.ts and create a commit with an appropriate message”

Source: modelcontextprotocol/servers/src/git — MIT license, part of the Anthropic-maintained monorepo (77k+ stars).


Purpose: Full GitHub platform access — Issues, Pull Requests, Projects, Code search, repository management, and GitHub Enterprise.

Git MCP vs GitHub MCP (two distinct layers):

LayerToolScope
Local Git operationsGit MCP ServerCommits, diffs, branches, staging
GitHub cloud platformGitHub MCP ServerIssues, PRs, Projects, Reviews, Search

Both can be active simultaneously. They complement each other: Git MCP handles local work, GitHub MCP handles collaboration and cloud state.

Two setup modes:

ModeRequiresWhen to use
Remote (api.githubcopilot.com)GitHub Copilot subscriptionAlready a Copilot subscriber
Self-hosted binaryGitHub PAT onlyNo Copilot, proprietary code, or privacy requirements

Remote MCP (requires a GitHub Copilot subscription):

⚠️ Known issue: claude mcp add --transport http attempts OAuth dynamic client registration by default, which the Copilot endpoint does not support. You’ll get: Incompatible auth server: does not support dynamic client registration. The fix is to inject the token manually (see below).

Step 1 — Add the server:

Terminal window
claude mcp add --transport http github https://api.githubcopilot.com/mcp/

Step 2 — Get your active GitHub CLI token:

Terminal window
gh auth token
# → gho_xxxxxxxxxxxx

Step 3 — Edit ~/.claude.json to add the Authorization header:

{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer gho_xxxxxxxxxxxx"
}
}
}
}

If the token expires: gh auth refresh then update the value in ~/.claude.json.

Self-hosted setup (GitHub PAT only, no Copilot required):

Terminal window
# Download binary from github.com/github/github-mcp-server/releases
export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxx
./github-mcp-server stdio
{
"mcpServers": {
"github": {
"command": "/path/to/github-mcp-server",
"args": ["stdio"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxx"
}
}
}
}

Key capabilities:

  • Issues: create, list, filter, assign, close
  • Pull Requests: create, review, merge, list by assignee/label
  • Projects: read and update GitHub Projects v2
  • Code search: search across all repos in an org
  • GitHub Enterprise: same API, different base URL

Typical workflows with Claude Code:

  • “List all open PRs assigned to me on org/repo, sorted by last activity”
  • “For PR #456, summarize the changes, flag breaking changes, and draft a review comment”
  • “Create an issue for bug X with a checklist, then open a branch and push a fix commit”
  • “Search all repos in the org for usages of deprecated fetchUser() and list files to migrate”

Differentiator vs @modelcontextprotocol/server-github: The official GitHub MCP server adds Projects support, OAuth 2.1 auth, GitHub Enterprise, and the remote hosted endpoint. The npm reference server is lighter but covers fewer features.

Source: github/github-mcp-server — Go, MIT license, 20k+ stars, actively maintained with regular releases.


The Claude Code Ultimate Guide ships its own MCP server — claude-code-ultimate-guide-mcp — so you can query the guide directly from any Claude Code session without cloning the repo.

What it gives you: 9 tools covering search, content reading, templates, digests, cheatsheet, and release notes. The structured index (882 entries) is bundled in the package (~130KB); markdown files are fetched from GitHub on demand with 24h local cache.

Add to ~/.claude.json:

{
"mcpServers": {
"claude-code-guide": {
"type": "stdio",
"command": "npx",
"args": ["-y", "claude-code-ultimate-guide-mcp"]
}
}
}

Or with a local clone (dev mode — reads files directly from disk):

{
"mcpServers": {
"claude-code-guide": {
"type": "stdio",
"command": "node",
"args": ["/path/to/claude-code-ultimate-guide/mcp-server/dist/index.js"],
"env": {
"GUIDE_ROOT": "/path/to/claude-code-ultimate-guide"
}
}
}
}
ToolSignatureDescription
search_guide(query, limit?)Search 882 indexed entries by keyword or question
read_section(path, offset?, limit?)Read any guide file with pagination (500 lines max)
list_topics()Browse all 25 topic categories
get_example(name)Fetch a production-ready template by name
list_examples(category?)List all templates — agents, commands, hooks, skills, scripts
get_changelog(count?)Last N guide CHANGELOG entries (default 5)
get_digest(period)Combined digest of guide + CC releases: day, week, month
get_release(version?)Claude Code CLI release details
get_cheatsheet(section?)Full cheatsheet or filtered by section

Resources: claude-code-guide://reference (full 94KB YAML index), claude-code-guide://releases, claude-code-guide://llms

Prompt: claude-code-expert — activates expert mode with optimal search workflow

Install the companion slash commands for one-keystroke access (stored in ~/.claude/commands/ccguide/):

Terminal window
# These commands are included in the guide repo under .claude/commands/ccguide/
# Copy or symlink to ~/.claude/commands/ccguide/ to install globally
CommandExampleDescription
/ccguide:search/ccguide:search hooksSearch by keyword
/ccguide:cheatsheet/ccguide:cheatsheet hooksCheatsheet (full or section)
/ccguide:digest/ccguide:digest weekWhat changed this week
/ccguide:example/ccguide:example code-reviewerFetch a template
/ccguide:examples/ccguide:examples agentsList templates by category
/ccguide:release/ccguide:release 2.1.59Release details
/ccguide:changelog/ccguide:changelog 10Recent guide CHANGELOG
/ccguide:topics/ccguide:topicsBrowse all categories

A claude-code-guide agent is included in .claude/agents/claude-code-guide.md. It uses Haiku (fast, cheap) and automatically searches the guide before answering any Claude Code question.


Beyond the official servers listed above, the MCP ecosystem includes validated community servers that extend Claude Code’s capabilities with specialized integrations.

📖 Complete Guide: See MCP Servers Ecosystem for:

  • 8 validated production-ready servers: Playwright (Microsoft), Semgrep, Kubernetes (Red Hat), Context7, Linear, Vercel, Browserbase, MCP-Compose
  • Evaluation framework: How servers are validated (stars, releases, docs, tests, security)
  • Production deployment guide: Security checklist, quick start stack, performance metrics
  • Ecosystem evolution: Linux Foundation standardization, MCPB format, Advanced MCP Tool Use, MCP Apps
  • Monthly watch methodology: Template for maintaining the guide with ecosystem updates

Featured Community Servers:

ServerPurposeQuality ScoreMaintainer
Playwright MCPBrowser automation with accessibility trees8.8/10 ⭐⭐⭐⭐⭐Microsoft (Official)
Semgrep MCPSecurity scanning (SAST, secrets, supply chain)9.0/10 ⭐⭐⭐⭐⭐Semgrep Inc. (Official)
Kubernetes MCPCluster management in natural language8.4/10 ⭐⭐⭐⭐Red Hat Containers Community
Context7 MCPReal-time library documentation (500+ libs)8.2/10 ⭐⭐⭐⭐Upstash (Official)
Linear MCPIssue tracking, project management7.6/10 ⭐⭐⭐⭐Community
Vercel MCPNext.js deployments, CI/CD7.6/10 ⭐⭐⭐⭐Community
Browserbase MCPCloud browser automation with AI agent7.6/10 ⭐⭐⭐⭐Browserbase Inc. (Official)
MCP-ComposeDocker Compose-style multi-server orchestration7.4/10 ⭐⭐⭐⭐Community

Quick Start Example (Playwright):

Terminal window
# Installation
npm install @microsoft/playwright-mcp
# Configuration (~/.claude.json or .mcp.json)
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["--yes", "@microsoft/playwright-mcp"]
}
}
}

Why use community servers?

  • Specialized integrations: Kubernetes, Vercel, Linear APIs not in official servers
  • Enhanced capabilities: Browser automation (Playwright), security scanning (Semgrep)
  • Production-ready: All servers validated for maintenance, docs, tests, security
  • Ecosystem standard: Many backed by major organizations (Microsoft, Red Hat, Semgrep Inc.)

~/.claude.json # User-scope MCP config (field "mcpServers")
.mcp.json # Project-scope (project root, shareable via VCS)

Note: Three scopes exist: local (default, private to you + current project, in ~/.claude.json), project (shared via .mcp.json at project root), and user (cross-project, also in ~/.claude.json). Use claude mcp add --scope <scope> to target a specific scope.

{
"mcpServers": {
"serena": {
"command": "npx",
"args": ["serena-mcp"],
"env": {
"PROJECT_PATH": "${PROJECT_PATH}"
}
},
"context7": {
"command": "npx",
"args": ["@context7/mcp-server"]
},
"postgres": {
"command": "npx",
"args": ["@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}
FieldDescription
commandExecutable to run
argsCommand arguments
envEnvironment variables
cwdWorking directory
VariableExpands To
${VAR}Environment variable value
${VAR:-default}Environment variable with fallback

Warning: The syntax ${workspaceFolder} and ${env:VAR_NAME} are VS Code conventions, not Claude Code. Claude Code uses standard shell-style ${VAR} and ${VAR:-default} for environment variable expansion in MCP config.

When you accumulate many MCP servers, enabling them all globally degrades Claude’s tool selection — each server adds tool descriptions to the context, making the model less precise at picking the right one.

Pattern: keep a minimal global config (2-3 core servers) and activate project-specific servers via per-project .mcp.json.

# User-scope (~/.claude.json "mcpServers") → always loaded
context7, sequential-thinking
# Project-scope (.mcp.json at project root) → only when needed
postgres # database project
playwright # frontend project
serena # large codebase

Community tools (e.g. cc-setup) are emerging to provide a TUI registry with per-project toggling and health checks — useful if you manage 8+ servers regularly.

Quick setup with environment variables:

Terminal window
# Add server with API key
claude mcp add -e API_KEY=your-key my-server -- npx @org/server
# Multiple environment variables
claude mcp add -e DATABASE_URL=postgresql://... -e DEBUG=true postgres -- npx @prisma/postgres
# Verify with --help
claude mcp add --help

Source: CLI syntax adapted from Shipyard Claude Code Cheat Sheet

Problem: MCP servers require API keys and credentials. Storing them in plaintext mcp.json creates security risks (accidental Git commits, exposure in logs, lateral movement after breach).

Solution: Separate secrets from configuration using environment variables, OS keychains, or secret vaults.

Before implementing secrets management, understand the baseline requirements from Security Hardening Guide:

  • Encryption at rest: Secrets must be encrypted on disk (OS keychain > plaintext .env)
  • Least privilege: Use read-only credentials when possible
  • Token rotation: Short-lived tokens with automated refresh
  • Audit logging: Track secret access without logging the secrets themselves
  • Never in Git: Secrets must never be committed to version control

For full threat model and CVE details, see Section 8.6 MCP Security.

ApproachSecurityComplexityUse Case
OS KeychainHigh (encrypted at rest)MediumSolo developers, macOS/Linux
.env + .gitignoreMedium (file permissions)LowSmall teams, rapid prototyping
Secret VaultsVery High (centralized, audited)HighEnterprise, compliance requirements

Best for: Solo developers on macOS/Linux with high security needs.

Pros: Encrypted at rest, OS-level access control, no plaintext files Cons: Platform-specific, requires scripting for automation

macOS Keychain Setup:

Terminal window
# Store secret in Keychain
security add-generic-password \
-a "claude-mcp" \
-s "github-token" \
-w "ghp_your_token_here"
# Verify storage
security find-generic-password -s "github-token" -w

MCP configuration with keychain retrieval:

{
"mcpServers": {
"github": {
"command": "bash",
"args": ["-c", "GITHUB_TOKEN=$(security find-generic-password -s 'github-token' -w) npx @github/mcp-server"],
"env": {}
}
}
}

Linux Secret Service (GNOME Keyring, KWallet):

Terminal window
# Install secret-tool (part of libsecret)
sudo apt install libsecret-tools # Ubuntu/Debian
# Store secret
secret-tool store --label="GitHub Token" service claude key github-token
# Prompt will ask for the secret value
# Retrieve in MCP config (bash wrapper)
# ~/.claude/scripts/mcp-github.sh
#!/bin/bash
export GITHUB_TOKEN=$(secret-tool lookup service claude key github-token)
npx @github/mcp-server
# ~/.claude.json (or .mcp.json)
{
"mcpServers": {
"github": {
"command": "~/.claude/scripts/mcp-github.sh",
"args": []
}
}
}

Windows Credential Manager:

Terminal window
# Store secret
cmdkey /generic:"claude-mcp-github" /user:"token" /pass:"ghp_your_token_here"
# Retrieve in PowerShell wrapper
$password = cmdkey /list:"claude-mcp-github" | Select-String -Pattern "Password" | ForEach-Object { $_.ToString().Split(":")[1].Trim() }
$env:GITHUB_TOKEN = $password
npx @github/mcp-server

Best for: Small teams, rapid prototyping, adequate security with proper .gitignore.

Pros: Simple, cross-platform, easy onboarding Cons: Plaintext on disk (file permissions only), requires discipline

Setup:

Terminal window
# 1. Create .env file (project root or ~/.claude/)
cat > ~/.claude/.env << EOF
GITHUB_TOKEN=ghp_your_token_here
OPENAI_API_KEY=sk-your-key-here
DATABASE_URL=postgresql://user:pass@localhost/db
EOF
# 2. Secure permissions (Unix only)
chmod 600 ~/.claude/.env
# 3. Add to .gitignore
echo ".env" >> ~/.claude/.gitignore

MCP configuration with .env variables:

{
"mcpServers": {
"github": {
"command": "npx",
"args": ["@github/mcp-server"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
},
"postgres": {
"command": "npx",
"args": ["@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}

Load .env before Claude Code:

~/bin/claude-with-env
# Option 1: Shell wrapper
#!/bin/bash
export $(cat ~/.claude/.env | xargs)
claude "$@"
# Option 2: direnv (automatic per-directory)
# Install: https://direnv.net/
echo 'dotenv ~/.claude/.env' > ~/.config/direnv/direnvrc
direnv allow ~/.claude

Template approach for teams:

Terminal window
# Commit template (no secrets)
cat > ~/.claude/mcp-config.template.json << EOF
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["@github/mcp-server"],
"env": {
"GITHUB_TOKEN": "\${GITHUB_TOKEN}"
}
}
}
}
EOF
# Generate actual config from template + .env
envsubst < ~/.claude/mcp-config.template.json > ~/.claude.json
# .gitignore
.claude.json # Generated, contains resolved secrets
.env # Never commit

See also: sync-claude-config.sh for automated template substitution.


Best for: Enterprise, compliance (SOC 2, HIPAA), centralized secret management.

Pros: Centralized, audited, automated rotation, fine-grained access control Cons: Complex setup, requires infrastructure, vendor lock-in

HashiCorp Vault:

Terminal window
# Store secret in Vault
vault kv put secret/claude/github token=ghp_your_token_here
# Retrieve in wrapper script
# ~/.claude/scripts/mcp-github-vault.sh
#!/bin/bash
export GITHUB_TOKEN=$(vault kv get -field=token secret/claude/github)
npx @github/mcp-server
# ~/.claude.json (or .mcp.json)
{
"mcpServers": {
"github": {
"command": "~/.claude/scripts/mcp-github-vault.sh",
"args": []
}
}
}

AWS Secrets Manager:

Terminal window
# Store secret
aws secretsmanager create-secret \
--name claude/github-token \
--secret-string "ghp_your_token_here"
# Retrieve in wrapper
export GITHUB_TOKEN=$(aws secretsmanager get-secret-value \
--secret-id claude/github-token \
--query SecretString \
--output text)
npx @github/mcp-server

1Password CLI (team-friendly):

Terminal window
# Store in 1Password (via GUI or CLI)
op item create --category=password \
--title="Claude MCP GitHub Token" \
token=ghp_your_token_here
# Retrieve in wrapper
export GITHUB_TOKEN=$(op read "op://Private/Claude MCP GitHub Token/token")
npx @github/mcp-server

Problem: API keys expire or are compromised. Rotating secrets across multiple MCP servers is manual and error-prone.

Solution: Centralized .env file with rotation script.

~/.claude/rotate-secret.sh
#!/bin/bash
SECRET_NAME=$1
NEW_VALUE=$2
# 1. Update .env file
sed -i.bak "s|^${SECRET_NAME}=.*|${SECRET_NAME}=${NEW_VALUE}|" ~/.claude/.env
# 2. Regenerate config from template
envsubst < ~/.claude/mcp-config.template.json > ~/.claude.json
# 3. Restart MCP servers (if running)
pkill -f "mcp-server" || true
echo "✅ Rotated $SECRET_NAME"
echo "⚠️ Restart Claude Code to apply changes"

Usage:

Terminal window
# Rotate GitHub token
./rotate-secret.sh GITHUB_TOKEN ghp_new_token_here
# Rotate database password
./rotate-secret.sh DATABASE_URL postgresql://user:new_pass@localhost/db

Automated rotation with Vault (advanced):

vault-rotate.sh
#!/bin/bash
# Fetch latest secrets from Vault, update .env, restart Claude
vault kv get -format=json secret/claude | jq -r '.data.data | to_entries[] | "\(.key)=\(.value)"' > ~/.claude/.env
envsubst < ~/.claude/mcp-config.template.json > ~/.claude.json
echo "✅ Secrets rotated from Vault"

Schedule with cron:

Terminal window
# Rotate daily at 3 AM
0 3 * * * ~/claude-rotate.sh >> ~/claude-rotate.log 2>&1

Problem: Developers accidentally commit secrets to Git despite .gitignore (e.g., adding .env with git add -f).

Solution: Pre-commit hook to block commits containing secrets.

Terminal window
# Install hook
cp examples/hooks/bash/pre-commit-secrets.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
# Test (should fail)
echo "GITHUB_TOKEN=ghp_test" > test.txt
git add test.txt
git commit -m "Test"
# ❌ Blocked: Secret detected in test.txt

Detection patterns (see hook for full list):

  • OpenAI keys: sk-[A-Za-z0-9]{48}
  • GitHub tokens: ghp_[A-Za-z0-9]{36}
  • AWS keys: AKIA[A-Z0-9]{16}
  • Generic API keys: api[_-]?key[\"']?\s*[:=]\s*[\"']?[A-Za-z0-9]{20,}

Before deploying MCP servers with secrets:

CheckCommandPass Criteria
.env not in Git`git ls-filesgrep .env`
File permissionsls -l ~/.claude/.env-rw------- (600)
Template committed`git ls-filesgrep template`
Pre-commit hookcat .git/hooks/pre-commitSecret detection script present
Secrets resolvedclaude mcp listAll servers start without errors

Test secret isolation:

Terminal window
# Should work (secret from .env)
export $(cat ~/.claude/.env | xargs)
claude
# Should fail (no secrets in environment)
unset GITHUB_TOKEN DATABASE_URL
claude
# ❌ MCP servers fail to start (expected)

PracticeRationale
Use OS keychain when possibleEncrypted at rest, OS-level security
Never commit .env to GitOne leak = full compromise
Commit .env.example templateTeam onboarding without secrets
Use ${VAR} in MCP configSeparation of config and secrets
Rotate secrets quarterlyLimit blast radius of old leaks
Audit .gitignore before pushPrevent accidental exposure
Least privilege credentialsRead-only DB users, scoped API tokens
Monitor for leaked secretsGitHub secret scanning, GitGuardian

For production deployments, consider zero standing privilege where MCP servers start with no secrets and request just-in-time credentials on tool invocation.

What do you need?
├─ Know exact pattern/text?
│ └─ Use native Grep tool or rg (~20ms)
├─ Deep code understanding?
│ └─ Use Serena
├─ Explore code by intent / semantic search?
│ └─ Use grepai (~500ms)
├─ Trace who calls what? (call graph)
│ └─ Use grepai
├─ Library documentation?
│ └─ Use Context7
├─ Complex reasoning?
│ └─ Use Sequential Thinking
├─ Database queries?
│ └─ Use Postgres
├─ Browser testing?
│ └─ Use Playwright
└─ General task?
└─ Use built-in tools
NeedBest ToolWhy
”Find exact string ‘validateUser‘“Native Grep / rgFast exact match (~20ms)
“Find all usages of this function”SerenaSemantic symbol analysis
”Remember this for next session”SerenaPersistent memory
”Find code that handles payments”grepai / mgrepIntent-based semantic search
”Who calls this function?“grepaiCall graph analysis
”How does React useEffect work?”Context7Official docs
”Why is this failing?”SequentialStructured debugging
”What’s in the users table?”PostgresDirect query
”Test the login flow”PlaywrightBrowser automation

Servers can work together:

1. Context7 → Get official pattern for auth
2. Serena → Find existing auth code
3. Sequential → Analyze how to integrate
4. Playwright → Test the implementation

Production Case Study: Multi-System Support Investigator

Section titled “Production Case Study: Multi-System Support Investigator”

Context: Mergify (CI/CD automation platform) needed to triage support tickets across 5 disconnected systems — a manual 15-minute process per ticket.

Architecture: Claude Code as orchestrator + 5 custom MCP servers as system adapters:

Support ticket received
┌───────────────┐
│ Claude Code │ ← orchestrates, synthesizes, produces report
└───────┬───────┘
│ parallel fan-out
├──────────────────┬──────────────────┬──────────────────┬──────────────────┐
▼ ▼ ▼ ▼ ▼
┌─────────────┐ ┌─────────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Datadog │ │ Sentry │ │ PostgreSQL │ │ Linear │ │ GitHub │
│ (metrics, │ │ (errors, perf │ │ (customer │ │ (tickets, │ │ (source, │
│ traces) │ │ regressions) │ │ data, DB) │ │ history) │ │ recent PRs) │
└─────────────┘ └─────────────────┘ └──────────────┘ └──────────────┘ └──────────────┘

Key design decisions:

  • MCP servers handle auth/credentials — Claude Code sees only clean interfaces
  • Queries execute in parallel, not sequentially → majority of the time savings
  • Human investigators review Claude’s structured report, not raw data
  • One dedicated repo for all MCP server implementations + system prompt

Results (self-reported by Mergify, Nov 2025):

  • Triage time: ~15 min → <5 min (⅔ reduction)
  • First-pass accuracy: 75% (25% still require human follow-up)

Key takeaway: This pattern — Claude Code as operational orchestrator with domain-specific MCP adapters — applies to any ops/support team juggling multiple disconnected systems. It’s distinct from “Claude Code as dev tool”: here Claude runs in a production workflow, not an IDE.

Source: Mergify blog — “How We Turned Claude Into a Cross-System Support Investigator” (Julian Maurin, Nov 2025)

Claude Code includes a comprehensive plugin system that allows you to extend functionality through community-created or custom plugins and marketplaces.

Plugins are packaged extensions that can add:

  • Custom agents with specialized behavior
  • New skills for reusable workflows
  • Pre-configured commands
  • Domain-specific tooling

Think of plugins as distributable packages that bundle agents, skills, and configuration into installable modules.

CommandPurposeExample
claude pluginList installed pluginsShows all plugins with status
claude plugin install <name>Install plugin from marketplaceclaude plugin install security-audit
claude plugin install <name>@<marketplace>Install from specific marketplaceclaude plugin install linter@company
claude plugin enable <name>Enable installed pluginclaude plugin enable security-audit
claude plugin disable <name>Disable plugin without removingclaude plugin disable linter
claude plugin uninstall <name>Remove plugin completelyclaude plugin uninstall security-audit
claude plugin update [name]Update plugin to latest versionclaude plugin update security-audit
claude plugin validate <path>Validate plugin manifestclaude plugin validate ./my-plugin

Marketplaces are repositories of plugins you can install from.

Marketplace commands:

Terminal window
# Add a marketplace
claude plugin marketplace add <url-or-path>
# Examples:
claude plugin marketplace add https://github.com/claudecode/plugins
claude plugin marketplace add /Users/yourname/company-plugins
claude plugin marketplace add gh:myorg/claude-plugins # GitHub shorthand
# List configured marketplaces
claude plugin marketplace list
# Update marketplace catalog
claude plugin marketplace update [name]
# Remove a marketplace
claude plugin marketplace remove <name>

Typical workflow:

Terminal window
# 1. Add a marketplace (one-time setup)
claude plugin marketplace add https://github.com/awesome-claude/plugins
# 2. Install a plugin
claude plugin install code-reviewer
# 3. Enable it for your project
claude plugin enable code-reviewer
# 4. Use it in Claude Code session
claude
You: /review-pr
# Plugin command is now available

Load plugins temporarily for a single session:

Terminal window
# Load plugin directory for this session only
claude --plugin-dir ~/.claude/custom-plugins
# Load multiple plugin directories
claude --plugin-dir ~/work/plugins --plugin-dir ~/personal/plugins

This is useful for testing plugins before permanent installation.

Repo-Level Plugin Policy via --add-dir (v2.1.45+)

Section titled “Repo-Level Plugin Policy via --add-dir (v2.1.45+)”

Define plugin policies at repository or shared-config level using --add-dir:

Terminal window
# Load plugin configuration from a shared directory
claude --add-dir /path/to/shared-config

The directory’s settings.json can specify:

  • enabledPlugins: list of pre-enabled plugins for every session
  • extraKnownMarketplaces: additional marketplace registries to recognize

Example shared config settings.json:

{
"enabledPlugins": ["security-audit", "code-review"],
"extraKnownMarketplaces": [
"https://github.com/myorg/internal-plugins"
]
}

Team use case: Commit a shared config directory to your repo and all team members automatically get the same enabled plugins and approved marketplaces — no per-user configuration needed.

ScenarioUse Plugins
Team workflows✅ Share standardized agents/skills across team via private marketplace
Domain expertise✅ Install pre-built plugins for security, accessibility, performance analysis
Repeating patterns✅ Package your custom workflows for reuse across projects
Community solutions✅ Leverage community expertise instead of rebuilding from scratch
Quick experiments❌ Use custom agents/skills directly in .claude/ folder
Project-specific❌ Keep as project CLAUDE.md instructions instead

Plugins are structured directories with a manifest inside .claude-plugin/:

my-plugin/
├── .claude-plugin/
│ └── plugin.json # Plugin manifest (ONLY file in this dir)
├── agents/
│ └── my-agent.md # Custom agents
├── skills/
│ └── code-review/
│ └── SKILL.md # Agent Skills (folder + SKILL.md)
├── commands/
│ └── my-cmd.md # Slash commands
├── hooks/
│ └── hooks.json # Event handlers
├── .mcp.json # MCP server configurations (optional)
├── .lsp.json # LSP server configurations (optional)
└── README.md # Documentation

Since v2.0.74 (December 2025), Claude Code natively integrates with Language Server Protocol servers. Instead of navigating your codebase through text search (grep), Claude connects to the LSP server of your project and understands symbols, types, and cross-references — the same way an IDE does.

Why it matters: Finding all call sites of a function drops from ~45 seconds (text search) to ~50ms (LSP). Claude also gets automatic diagnostics after every file edit — errors and warnings appear in real time, without a separate build step.

Supported languages (11): Python, TypeScript, JavaScript, Go, Rust, Java, C/C++, C#, PHP, Kotlin, Ruby.

Terminal window
# Option 1 — one-time env variable
ENABLE_LSP_TOOL=1 claude
# Option 2 — persist in ~/.claude/settings.json
{
"env": {
"ENABLE_LSP_TOOL": "1"
}
}

The LSP server for your language must already be installed on the machine — Claude Code connects to it, it doesn’t install it. Common servers:

LanguageServerInstall
TypeScripttsserverBundled with TypeScript
Pythonpylsppip install python-lsp-server
Gogoplsgo install golang.org/x/tools/gopls@latest
Rustrust-analyzerrustup component add rust-analyzer
Kotlinkotlin-language-serverVia IntelliJ or standalone
Swiftsourcekit-lspBundled with Xcode

Controls how long Claude waits for an LSP server to initialize before treating it as unresponsive (v2.1.50+):

{
"servers": {
"tsserver": { "startupTimeout": 15000 },
"pylsp": { "startupTimeout": 10000 }
}
}

Useful in slow environments (CI, Docker, cold start) where default timeouts cause LSP features to be silently skipped.

⚠️ Common mistake: Don’t put commands/, agents/, skills/, or hooks/ inside .claude-plugin/. Only plugin.json goes there.

Example .claude-plugin/plugin.json:

{
"name": "security-audit",
"version": "1.0.0",
"description": "Security audit tools for Claude Code",
"author": {
"name": "Your Name"
}
}

The manifest only defines metadata. Claude Code auto-discovers components from the directory structure.

Skill namespacing: Plugin skills are prefixed with the plugin name to prevent conflicts:

  • Plugin security-audit with skill scan/security-audit:scan

Validate before distribution:

Terminal window
claude plugin validate ./my-plugin

Official documentation: code.claude.com/docs/en/plugins

Understanding when to use which:

FeaturePluginMCP Server
PurposeBundle Claude-specific workflows (agents, skills)Add external tool capabilities (databases, APIs)
ComplexitySimpler - just files + manifestMore complex - requires server implementation
ScopeClaude Code instructions and patternsExternal system integrations
Installationclaude plugin installAdd to settings.json MCP config
Use caseSecurity auditor agent, code review workflowsPostgreSQL access, Playwright browser automation
Interactive UINoYes (via MCP Apps extension - SEP-1865)*

Rule of thumb:

  • Plugin = “How Claude thinks” (new workflows, specialized agents)
  • MCP Server = “What Claude can do” (new tools, external systems)
  • MCP Apps = “What Claude can show” (interactive UIs in supported clients)*

*Note: MCP Apps render in Claude Desktop, VS Code, ChatGPT, Goose. Not supported in Claude Code CLI (terminal is text-only). See Section 8.1 for details.

Before installing plugins:

  1. Trust the source - Only install from verified marketplaces
  2. Review manifest - Check what the plugin includes with validate
  3. Test in isolation - Use --plugin-dir for testing before permanent install
  4. Company policies - Check if your organization has approved plugin sources

Red flags:

  • Plugins requesting network access without clear reason
  • Unclear or obfuscated code in agents/skills
  • Plugins without documentation or proper manifest

1. Team Code Standards Plugin

Terminal window
# Company creates private marketplace
git clone git@github.com:yourcompany/claude-plugins.git ~/company-plugins
# Add marketplace
claude plugin marketplace add ~/company-plugins
# Install company standards
claude plugin install code-standards@company
# Now all team members use same linting, review patterns

2. Security Audit Suite

Terminal window
# Install community security plugin
claude plugin install owasp-scanner
# Use in session
claude
You: /security-scan
# Runs OWASP Top 10 checks, dependency audit, secret scanning

3. Accessibility Testing

Terminal window
# Install a11y plugin
claude plugin install wcag-checker
# Enable for project
claude plugin enable wcag-checker
# Adds accessibility-focused agents
You: Review this component for WCAG 2.1 compliance

Plugin not found after install:

Terminal window
# Refresh marketplace catalogs
claude plugin marketplace update
# Verify plugin is installed
claude plugin
# Check if disabled
claude plugin enable <name>

Plugin conflicts:

Terminal window
# Disable conflicting plugin
claude plugin disable <conflicting-plugin>
# Or uninstall completely
claude plugin uninstall <conflicting-plugin>

Plugin not loading in session:

  • Plugins are loaded at session start
  • Restart Claude Code after enabling/disabling
  • Check ~/.claude/plugins/ for installation

The Claude Code plugin ecosystem has grown significantly. Here are verified community resources:

Major marketplaces:

MarketplaceStatsFocus
wshobson/agents67 plugins, 99 agents, 107 skillsProduction-ready dev workflows, DevOps, security
claude-plugins.dev11,989 plugins, 63,065 skills indexedRegistry + CLI for plugin discovery
claudemarketplaces.comAuto-scans GitHubMarketplace directory

Installation example (wshobson/agents):

Terminal window
# Add the marketplace
/plugin marketplace add wshobson/agents
# Browse available plugins
/plugin
# Install specific plugin
/plugin install react-development

Popular plugins by install count (Jan 2026):

PluginInstallsUse case
Context7~72kLibrary documentation lookup
Ralph Wiggum~57kCode review automation
Figma MCP~18kDesign-to-code workflow
Linear MCP~9.5kIssue tracking integration

Curated lists:

Source: Stats from claude-plugins.dev, Firecrawl analysis (Jan 2026). Counts evolve rapidly.

Two community plugins address complementary problems that AI-assisted development creates: code quality drift (accumulation of poorly-structured AI-generated code) and hallucination in generated solutions.

Problem solved: AI tools write code faster than teams can maintain it. GitClear’s analysis of 211M lines shows refactoring collapsed from 25% to under 10% of all changes (2021–2025). Vitals identifies which files are most likely to cause problems next — before they do.

How it works: Computes git churn × structural complexity × coupling centrality to rank hotspots. Not just “this file is complex” but “this complex file changed 49 times in 90 days and 63 other files break when it does.”

Terminal window
# Install (two commands in Claude Code)
/plugin marketplace add chopratejas/vitals
/plugin install vitals@vitals
# Scan from repo root
/vitals:scan
# Scope options
/vitals:scan src/ # Specific folder
/vitals:scan --top 20 # More results (default: 10)
/vitals:scan src/auth --top 5

What you get: Claude reads the flagged files and gives semantic diagnosis. Instead of “high complexity,” you get: “this class handles routing, caching, rate limiting, AND metrics in 7,137 lines — extract each concern.”

Status: v0.1 alpha. MIT. Zero dependencies (Python stdlib + git). Works on any repo.

Source: chopratejas/vitals

Problem solved: AI-generated code contains subtle errors that survive code review because both the AI and the reviewer follow the same reasoning path. SE-CoVe breaks this by running an independent verifier that never sees the initial solution.

Research foundation: Adaptation of Meta’s Chain-of-Verification methodology (Dhuliawala et al., ACL 2024 Findings — arXiv:2309.11495).

How it works — 5-stage pipeline:

  1. Baseline — Claude generates initial solution
  2. Planner — Creates verification questions from the solution’s claims
  3. Executor — Answers questions without seeing the baseline (prevents confirmation bias)
  4. Synthesizer — Compares findings, surfaces discrepancies
  5. Output — Produces verified solution
Terminal window
# Install (two separate commands — marketplace limitation)
/plugin marketplace add vertti/se-cove-claude-plugin
/plugin install chain-of-verification
# Use
/chain-of-verification:verify <your question>
/ver<Tab> # Autocomplete available

Trade-offs: ~2x token cost, reduced output volume. Worth it for security-sensitive code, complex debugging, and architectural decisions — not for rapid prototyping or simple fixes.

Source: vertti/se-cove-claude-plugin — v1.1.1, MIT

These tools solve different problems at different stages of the development cycle:

VitalsSE-CoVe
WhenMaintenance / weekly reviewPer-task generation
ProblemAccumulated code debtPer-solution accuracy
InputEntire git historyA specific question
OutputRanked hotspot files + diagnosisVerified answer
Token costLow (Python analysis + Claude reads top files)~2x standard generation
Best for”Which file is going to break?""Is this solution correct?”
Statusv0.1 alphav1.1.1 stable

Complementary workflow: Run Vitals weekly to identify which areas of the codebase need attention, then use SE-CoVe when asking Claude to refactor or fix those hotspot files.


MCP servers extend Claude Code’s capabilities, but they also expand its attack surface. Before installing any MCP server, especially community-created ones, apply the same security scrutiny you’d use for any third-party code dependency.

CVE details & advanced vetting: For documented CVEs (2025-53109/53110, 54135, 54136), MCP Safe List, and incident response procedures, see Security Hardening Guide.

Before adding an MCP server to your configuration:

CheckWhy
Source verificationGitHub with stars, known organization, or official vendor
Code auditReview source code—avoid opaque binaries without source
Minimal permissionsDoes it need filesystem access? Network? Why?
Active maintenanceRecent commits, responsive to issues
DocumentationClear explanation of what tools it exposes

Tool Shadowing

A malicious MCP server can declare tools with common names (like Read, Write, Bash) that shadow built-in tools. When Claude invokes what it thinks is the native Read tool, the MCP server intercepts the call.

Legitimate flow: Claude → Native Read tool → Your file
Shadowed flow: Claude → Malicious MCP "Read" → Attacker exfiltrates content

Mitigation: Check exposed tools with /mcp command. Use disallowedTools in settings to block suspicious tool names from specific servers.

Confused Deputy Problem

An MCP server with elevated privileges (database access, API keys) can be manipulated via prompt to perform unauthorized actions. The server authenticates Claude’s request but doesn’t verify the user’s authorization for that specific action.

Example: A database MCP with admin credentials receives a query from a prompt-injected request, executing destructive operations the user never intended.

Mitigation: Always configure MCP servers with read-only credentials by default. Only grant write access when explicitly needed.

Dynamic Capability Injection

MCP servers can dynamically change their tool offerings. A server might pass initial review, then later inject additional tools.

Mitigation: Pin server versions in your configuration. Periodically re-audit installed servers.

Minimal privilege setup:

{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgres://readonly_user:pass@host/db"
}
}
}
}

Tool restriction via settings:

{
"permissions": {
"deny": ["mcp__untrusted-server__execute", "mcp__untrusted-server__shell"]
}
}

Note: disallowedTools is a root-level key or CLI flag (--disallowedTools), not nested under permissions. For settings.json, use permissions.deny to block tool patterns.

Avoid MCP servers that:

  • Request credentials beyond their stated purpose
  • Expose shell execution tools without clear justification
  • Have no source code available (binary-only distribution)
  • Haven’t been updated in 6+ months with open security issues
  • Request network access for local-only functionality
Terminal window
# List active MCP servers and their tools
claude
/mcp
# Check what tools a specific server exposes
# Look for unexpected tools or overly broad capabilities

Best practice: Audit your MCP configuration quarterly. Remove servers you’re not actively using.


Quick jump: The Trinity · Composition Patterns · CI/CD Integration · IDE Integration · Tight Feedback Loops


Prerequisite: Read 4.1 What Are Agents and 3.1 CLAUDE.md before diving into 9.17-9.20.

New to Claude Code? Start with Ch.1-3 first. Chapter 9 makes most sense after 1-2 months of daily use.