An MCP tool for indexing your Next.js and TypeScript code to work with agents like Claude Code and Kiro.
Next.js TypeScript Cartographer solves a critical problem when AI agents work with complex TypeScript codebases: quickly locating code elements without expensive searches. When a user says "let's modify UserProfile", the AI agent can instantly find the exact location of the component definition instead of running multiple grep commands or bash scripts to hunt it down.
- Instant Symbol Navigation: Jump to any class, function, interface, or component definition instantly.
- Deep Code Understanding: Provide rich metadata about symbols, including documentation (JSDoc) and source ranges.
- Zero Configuration: Work out of the box for standard Next.js and TypeScript projects.
Next.js TypeScript Cartographer uses ts-morph for semantic code analysis:
- ts-morph integration: Uses the TypeScript Compiler API wrapper for full semantic understanding of TypeScript code.
- Project Loading: Loads
tsconfig.jsonto understand project structure and dependencies. - MCP Server: Built on the
@modelcontextprotocol/sdkfor Model Context Protocol support.- Async/await with Node.js
- JSON Schema validation for tool parameters
- Stdio transport for AI agent integration
- AI-Assisted Development: Enable AI agents to navigate and modify code with surgical precision.
- Code Navigation: Quick lookups for developers and tools.
- Refactoring Support: Understand impact of changes across a codebase.
- Documentation Generation: Extract and organize code documentation.
The server provides two fully functional tools:
Find all occurrences of a TypeScript symbol (class, function, interface, variable, etc.) by name.
Features:
- Search modes: Exact, fuzzy (default), or prefix matching.
- Type filtering: Filter results to only type symbols (classes, interfaces, enums, type aliases).
- Rich metadata: Returns symbol name, kind, file path, line numbers, and documentation.
Example usage:
{
"query": "UserProfile",
"mode": "exact",
"typesOnly": true
}List all symbols defined in a specific file.
Features:
- Returns all functions, methods, classes, interfaces, variables, and more.
- Provides symbol name, kind, line number ranges, and JSDoc documentation.
- Filters out irrelevant symbol kinds automatically.
Example usage:
{
"filePath": "/absolute/path/to/components/UserProfile.tsx"
}- Semantic analysis: Uses
ts-morphfor accurate type information. - Project loading: Automatically loads
tsconfig.json. - Symbol kinds: Supports Class, Method, Property, Function, Interface, Variable, TypeAlias, and Enum.
To install dependencies:
npm installTo run the server (communicates via stdio):
npm run mcpOr:
npx tsx scripts/mcp-server.ts /path/to/projectTo use Next.js TypeScript Cartographer with an MCP-compatible AI agent, add it to your MCP configuration.
For example, with Claude Code:
{
"mcpServers": {
"nextjs-cartographer": {
"command": "npx",
"args": ["-y", "tsx", "/path/to/next.js_typescript_cartographer/scripts/mcp-server.ts", "/path/to/target/project"]
}
}
}Once configured, the AI agent will have access to the find_symbol and enumerate_file tools for navigating your codebase.