Supports GraphQL adapter integration for schema extraction and validation (roadmap feature).
Provides partial support for analyzing Python code for schema extraction and usage tracing (roadmap feature).
Generates React hooks from MCP tool schemas, providing type-safe client code that correctly consumes MCP server tools.
Provides partial support for analyzing Rust code for schema extraction and usage tracing (roadmap feature).
Analyzes TypeScript code to extract MCP tool schemas from server implementations and trace tool usage patterns in client code, detecting schema mismatches between producers and consumers.
Extracts and validates Zod schemas from MCP tool definitions to ensure type safety between server tool outputs and client expectations.
Trace MCP
Static analysis engine for detecting schema mismatches between data producers and consumers.
What It Does
Trace MCP finds mismatches between:
Backend API responses and frontend expectations
MCP tool outputs and client code that uses them
Service A's events and Service B's handlers
Installation
Configuration
Add to your MCP client configuration (e.g., claude_desktop_config.json or Roo-Code settings):
Tools Reference
Trace MCP provides 11 tools organized into three categories:
Core Analysis Tools
Tool | Description |
| Extract MCP tool definitions from server source code |
| Extract schemas from a single file |
| Trace how client code uses MCP tools |
| Trace tool usage in a single file |
| Full pipeline: extract → trace → compare → report |
Code Generation Tools
Tool | Description |
| Generate client code from producer schema |
| Generate server stub from client usage |
| Add cross-reference comments to validated pairs |
Project Management Tools
Tool | Description |
| Initialize a trace project with
config |
| Watch files for changes and auto-revalidate |
| Get project config, cache state, and validation results |
Tool Details
extract_schemas
Extract MCP tool definitions (ProducerSchemas) from server source code. Scans for server.tool() calls and parses their Zod schemas.
Parameters:
rootDir(required): Root directory of MCP server source codeinclude: Glob patterns to include (default:**/*.ts)exclude: Glob patterns to exclude (default:node_modules,dist)
Example:
extract_file
Extract MCP tool definitions from a single TypeScript file.
Parameters:
filePath(required): Path to a TypeScript file
trace_usage
Trace how client code uses MCP tools. Finds callTool() invocations and tracks which properties are accessed on results.
Parameters:
rootDir(required): Root directory of consumer source codeinclude: Glob patterns to includeexclude: Glob patterns to exclude
trace_file
Trace MCP tool usage in a single TypeScript file.
Parameters:
filePath(required): Path to a TypeScript file
compare
Full analysis pipeline: extract producer schemas, trace consumer usage, and compare them to find mismatches.
Parameters:
producerDir(required): Path to MCP server source directoryconsumerDir(required): Path to consumer/client source directoryformat: Output format (json,markdown,summary)strict: Strict mode - treat missing optional properties as warningsdirection: Data flow direction (producer_to_consumer,consumer_to_producer,bidirectional)
Example Output (Markdown):
scaffold_consumer
Generate consumer code from a producer schema. Creates TypeScript functions, React hooks, or Zustand actions that correctly call MCP tools.
Parameters:
producerDir(required): Path to MCP server source directorytoolName(required): Name of the tool to scaffoldtarget: Output format (typescript,javascript,react-hook,zustand-action)includeErrorHandling: Include try/catch error handling (default: true)includeTypes: Include TypeScript type definitions (default: true)
Example Output:
scaffold_producer
Generate producer schema stub from consumer usage. Creates MCP tool definition based on how client code calls it.
Parameters:
consumerDir(required): Path to consumer source directorytoolName(required): Name of the tool to scaffoldincludeHandler: Include handler stub (default: true)
Example Output:
comment_contract
Add cross-reference comments to validated producer/consumer pairs. Documents the contract relationship in both files.
Parameters:
producerDir(required): Path to MCP server source directoryconsumerDir(required): Path to consumer source directorytoolName(required): Name of the validated tooldryRun: Preview without writing (default: true)style: Comment style (jsdoc,inline,block)
Example Preview:
init_project
Initialize a trace project with .trace-mcp config directory for watch mode and caching.
Parameters:
projectDir(required): Root directory for the trace projectproducerPath(required): Relative path to producer/server codeconsumerPath(required): Relative path to consumer/client codeproducerLanguage: Language (typescript,python,go,rust,json_schema)consumerLanguage: Language (typescript,python,go,rust,json_schema)
Example:
watch
Watch project files for changes and auto-revalidate contracts.
Parameters:
projectDir(required): Root directory with.trace-mcpconfigaction:start,stop,status, orpoll
Actions:
start: Begin watching for file changesstop: Stop watchingstatus: Check current watcher statepoll: Get pending events and last validation result
get_project_status
Get the status of a trace project including config, cache state, and last validation result.
Parameters:
projectDir(required): Root directory with.trace-mcpconfig
Example Output:
Typical Workflow
1. Quick One-Off Analysis
2. Continuous Validation (Watch Mode)
3. Generate Missing Code
Roadmap
MCP tool schema extraction
Consumer usage tracing
Basic mismatch detection
Code scaffolding (consumer & producer)
Contract comments
Watch mode with auto-revalidation
Enhanced TypeScript interface extraction (beyond Zod)
OpenAPI/GraphQL adapter support
Python/Go/Rust language support (partial)
License
MIT