MCP server for code mapping and analysis
npm install mcp-server-code-mapperA Model Context Protocol (MCP) server implementation for the Code Mapper tool, designed to analyze TypeScript/React project structures.
- Implements the MCP protocol for integration with Cursor and other MCP-compatible clients
- Provides tools for analyzing project structure and generating reports
- Enhanced logging for debugging and monitoring
- JSON-RPC 2.0 compliant API
``bashInstall globally
npm install -g mcp-server-code-mapper
Usage
$3
`bash
Start the MCP server
mcp-server-code-mapperOr use the cursor-test version with enhanced logging
mcp-server-code-mapper-cursor-test
`$3
To use this MCP server with Cursor:
1. Open Cursor
2. Go to Settings > Extensions > MCP
3. Add a new MCP server with the command:
`
npx mcp-server-code-mapper-cursor-test@latest
`
4. Name it "Code Mapper"
5. Save and activate the server$3
#### analyze_project
Analyzes the project structure and generates a report.
Parameters:
-
include: Comma-separated list of glob patterns to include (e.g., "src//.{ts,tsx},functions//.{ts,tsx}")
- exclude: Comma-separated list of glob patterns to exclude (e.g., "/node_modules/,/dist/")
- output: Path to save the report (default: code-mapper-report.json)
- verbose: Enable verbose logging#### check_report
Checks a report for issues.
Parameters:
-
report: Path to the report file (default: code-mapper-report.json)
- error_threshold: Maximum number of errors allowed (default: 0)
- warning_threshold: Maximum number of warnings allowed (default: 10)Enhanced Logging
The
cursor-test.js script provides enhanced logging capabilities:$3
When running
mcp-server-code-mapper-cursor-test, two log files are created in the current working directory:1.
cursor-test-debug.log: Detailed debug logs for troubleshooting
2. cursor-mcp.log: Structured, human-readable logs for monitoring$3
The
cursor-mcp.log file uses a structured format:`
[TIMESTAMP] [LOG_TYPE] Message
{
"json": "data if available"
}
--------------------------------------------------------------------------------
`$3
-
STARTUP: Server initialization events
- ENV: Environment information
- REQUEST: Incoming requests
- METHOD: Method processing
- RESPONSE: Outgoing responses
- ERROR: Error information
- TOOL: Tool execution details
- RESOURCE: Resource handling
- CRITICAL: Critical errors
- SIGNAL: Process signals
- SHUTDOWN: Server shutdown events
- HEARTBEAT: Regular server heartbeatsTroubleshooting
If you encounter issues with the MCP server:
1. Check the log files in your current working directory
2. Ensure you're using the latest version
3. Verify your Cursor configuration is correct
4. Check for any error messages in the logs
Development
To contribute to this project:
`bash
Clone the repository
git clone https://github.com/derekzar/mcp-server-code-mapper.gitInstall dependencies
cd mcp-server-code-mapper
npm installRun the server
npm startTest the cursor version
npm test
``MIT