# grepai mcp-serve

> CLI reference for grepai mcp-serve

## grepai mcp-serve

Start grepai as an MCP server

### Synopsis

Start grepai as an MCP (Model Context Protocol) server.

This allows AI agents to use grepai as a native tool through the MCP protocol.
The server communicates via stdio and exposes the following tools:

  - grepai_search: Semantic code search with natural language (includes RPG context when enabled)
  - grepai_trace_callers: Find all functions that call a symbol
  - grepai_trace_callees: Find all functions called by a symbol
  - grepai_trace_graph: Build a call graph around a symbol
  - grepai_refs_readers: Find property/state readers for a symbol name
  - grepai_refs_writers: Find property/state writers for a symbol name
  - grepai_refs_graph: Build a property usage graph (readers + writers)
  - grepai_index_status: Check index health and statistics (includes RPG stats when enabled)
  - grepai_rpg_search: Search RPG graph nodes by feature semantics
  - grepai_rpg_fetch: Fetch hierarchy and edge context for a specific RPG node
  - grepai_rpg_explore: Traverse RPG graph neighborhoods with direction/depth filters
  - grepai_list_workspaces: List available workspace names
  - grepai_list_projects: List the projects of a workspace
  - grepai_stats: Show token savings recorded by grepai

Arguments:
  project-path  Optional path to the grepai project directory.
                If not provided, searches for .grepai from current directory.

Flags:
  --workspace   Workspace name. When set, serves using workspace config from
                ~/.grepai/workspace.yaml without requiring local .grepai/.

Configuration for Claude Code:
  claude mcp add grepai -- grepai mcp-serve
  claude mcp add grepai -- grepai mcp-serve --workspace myworkspace

Configuration for Cursor (.cursor/mcp.json):
  {
    "mcpServers": {
      "grepai": {
        "command": "grepai",
        "args": ["mcp-serve"]
      }
    }
  }

Configuration for Cursor with explicit path (recommended for Windows):
  {
    "mcpServers": {
      "grepai": {
        "command": "grepai",
        "args": ["mcp-serve", "/path/to/your/project"]
      }
    }
  }

```
grepai mcp-serve [project-path] [flags]
```

### Options

```
  -h, --help               help for mcp-serve
      --workspace string   Workspace name for workspace-only mode (no local .grepai/ required)
```

### SEE ALSO

* [grepai](/grepai/commands/grepai/)	 - Semantic code search CLI

###### Auto generated by spf13/cobra on 30-Oct-2026
