What is MCP?
Model Context Protocol (MCP) is an open protocol that allows AI assistants to connect to external tools and data sources. Nogic exposes its code intelligence through MCP, so AI agents like Claude and Cursor can query your codebase in real-time.How It Works
- You index your codebase using the Nogic CLI (
nogic watchornogic sync) - Your AI agent connects to Nogic’s MCP server using your API key
- The agent calls tools like
find_symbolorbefore_writingas it works - Nogic queries your code graph and returns results to the agent
Project ID
All MCP tools require aproject_id parameter. Your AI agent reads this from .nogic/config.json in your project root:
nogic init before using MCP tools.
Setup Guides
Claude Code
Set up with Claude Code CLI
Cursor
Set up with Cursor IDE
Windsurf
Set up with Windsurf
Other Editors
VS Code, Antigravity, Claude Desktop, and more
Tools Reference
Nogic provides 22 MCP tools organized into ten categories.Before Writing Code
These tools should be called before writing any new code to prevent duplication and enforce naming conventions.before_writing
Call this FIRST before writing any new code. Combines similarity search and convention detection in a single call. If similar code already exists, the agent should reuse it instead of writing a duplicate.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
description | string | Yes | What you’re about to write (e.g., “email validation function”) |
find_similar
Find existing code similar to a natural language description. Use before_writing instead when writing new code — this tool is for targeted searches when you need more results or a different similarity threshold.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
query | string | Yes | — | Natural language description |
max_results | int | No | 5 | Maximum results to return |
threshold | float | No | 0.7 | Minimum similarity score (0–1) |
get_conventions
Detect naming conventions used across the codebase. Usually, before_writing is sufficient — use this directly only when you need a detailed breakdown by category.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
Symbol Discovery
find_symbol
The primary code discovery tool. Locate any function, class, or method by name with fuzzy matching. Returns exact file:line locations with caller/usage stats and importance context.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
name | string | One of name/node_id | — | Symbol name (partial match OK) |
node_id | string | One of name/node_id | — | Exact node ID from previous results |
node_type | string | No | — | Filter by type: Function, Class, Method |
include_stats | bool | No | true | Include caller/usage counts |
max_results | int | No | 10 | Maximum results to return |
Code Relationships
These tools require anode_id obtained from find_symbol results.
get_references
Find all callers of a symbol. Returns every function that calls the target with file:line locations and distribution analysis.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
node_id | string | Yes | — | Symbol’s ID (from find_symbol) |
max_results | int | No | 15 | Maximum callers to return |
get_dependencies
Find everything a symbol depends on. Returns every function the target calls with file:line locations.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
node_id | string | Yes | — | Symbol’s ID (from find_symbol) |
max_results | int | No | 15 | Maximum dependencies to return |
assess_impact
Assess the risk of modifying a symbol. Returns the blast radius (affected files and functions) and test coverage information.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
node_id | string | Yes | — | Symbol’s ID (from find_symbol) |
depth | int | No | 2 | How many levels of callers to check |
LOW, MEDIUM, or HIGH), number of affected functions and files, test file coverage in the blast radius.
File & Directory Analysis
list_files
List all indexed files in the project, grouped by area (core, tests, examples) with language breakdown.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
get_directory_structure
Browse the project directory tree incrementally. Start with an empty path for the project root.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
path | string | No | "" | Directory path to browse (empty = root) |
get_file_structure
Get the outline of a file — every class, function, and component with line numbers and signatures. Useful for understanding a file’s structure before reading the whole thing.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
file_path | string | Yes | Path to the file (relative to project root) |
get_file_dependencies
Get import/export relationships for a file. Shows what files it imports and what files import it, plus the file’s architectural role.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
file_path | string | Yes | Path to the file (relative to project root) |
UTILITY, HIGH-LEVEL, ENTRY POINT, STANDALONE, INTERMEDIATE).
Class Analysis
get_class_structure
Get a class’s full API: methods with signatures, instance variables, class variables, and inheritance hierarchy.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
node_id | string | Yes | The class node ID (from find_symbol) |
find_tests
Find tests for a specific function or method. Returns all tests with file:line locations and a coverage assessment.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
node_id | string | Yes | — | Function/method node ID (from find_symbol) |
include_indirect | bool | No | false | Include tests that call the function indirectly |
NO TESTS, INDIRECT ONLY, MINIMAL, GOOD), and test file paths.
Framework Patterns
find_by_framework
Find API routes, models, controllers, services, tests, and other framework-specific patterns.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
pattern_type | string | Yes | — | One of: route, model, controller, service, test, auth, task |
framework | string | No | — | Filter by framework (e.g., fastapi, flask, django, nestjs) |
http_method | string | No | — | For routes only: filter by HTTP method (GET, POST, PUT, DELETE) |
file:line locations. For routes, includes HTTP method and route path.
Error Analysis
find_error_paths
Find functions that raise a given exception type and trace which callers handle or propagate them.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | UUID from .nogic/config.json |
error_type | string | No | "" | Exception class name to search for (empty = all) |
get_unhandled_errors
Find exceptions that propagate up without any caller catching them. High-value for identifying potential crash paths.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
Project Overview
describe_project
Get a high-level overview of the codebase: size, language composition, project type, and scale.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
resolve_project
Resolve a workspace path to a project_id when ~/.nogic/projects.json is unavailable.
| Parameter | Type | Required | Description |
|---|---|---|---|
workspace_path | string | Yes | Absolute path to the workspace root |
machine_id | string | No | UUID from ~/.nogic/machine_id |
project_id for the given workspace path.
Code Review
review_step
Step-by-step code review investigation tool. Call repeatedly to investigate code changes. The server returns prioritized assignments with node_ids you can pass directly to other tools.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
thought | string | Yes | Current investigation step |
step_number | int | Yes | Current step (1-based) |
total_steps | int | Yes | Estimated total steps |
next_step_needed | bool | Yes | Whether more investigation is needed |
file_paths | list | First call only | Changed file paths |
finalize_review
Write .nogic/review.json with the complete review results. Call after review_step’s synthesizing phase.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
summary | string | Yes | What changed and why it matters |
rating | int | Yes | 1–5 (5 = definitely mergeable) |
annotations | list | Yes | List of findings with risk levels |
.nogic/review.json with server-computed review depth.
Canvas & Visualization
agent_canvas
Create interactive visual diagrams and flowcharts. Build incrementally by adding elements, connections, groups, and narrative steps.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
mode | string | No | "create" or "build" (build incrementally, then create) |
agent_canvas_sequence
Create sequence diagrams showing participant interactions and message flows.
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | UUID from .nogic/config.json |
title | string | No | Diagram title |
mode | string | No | "create" or "build" |
Recommended Workflow
- Start a session: Call
describe_projectto understand the codebase - Before writing code: Call
before_writingwith a description of what you plan to create - Find existing code: Use
find_symbolto locate functions and classes by name - Understand relationships: Use
get_referencesandget_dependencieswithnode_idfromfind_symbol - Before refactoring: Call
assess_impactto understand the blast radius - Check test coverage: Use
find_teststo see if a function has tests before modifying it - Find crash paths: Use
get_unhandled_errorsto identify potential unhandled exceptions - Review changes: Use
review_steprepeatedly, thenfinalize_reviewto generate a structured review