Core Feature

Code Search

Powerful text search and AST-based code pattern matching

Overview

kit-dev-mcp provides two powerful search capabilities: fast literal string search with grep, and AST-based pattern matching for finding code by structure using tree-sitter.

Search Tools

grep_code

Fast literal string search with context lines

grep_code(repo_id="...", pattern="TODO", context_lines=2)

grep_ast

AST-based search to find code by structure (functions, classes, try blocks, etc.)

grep_ast(repo_id="...", pattern="async def", mode="simple", max_results=20)

Text Search Features

Regex Support

Full regular expression support for complex pattern matching

Find all function definitions:
pattern="^def\s+\w+\("
Find imports:
pattern="^import|^from.*import"

AST Pattern Search (grep_ast)

Structure-Based Search

Find code by its structure using Abstract Syntax Tree patterns

How it works: AST search uses tree-sitter to parse code and match structural patterns. For example, searching for "async def" will find all async functions, "class $NAME(BaseModel)" finds classes extending BaseModel, or{"type": "try_statement"} finds all try blocks.

Usage Examples

Find TODO comments with context

# Ask your AI:
"Find all TODO comments with surrounding context"

# AI executes:
grep_code(
  repo_id="...",
  pattern="TODO",
  context_lines=3,
  case_sensitive=false
)