This document summarizes the testing process for the krep-mcp-server, focusing on MCP protocol compliance and compatibility with various clients.
File: test-mcp-inspector.js
This test validates that the krep-mcp-server strictly follows the MCP protocol format required by MCP Inspector.
Test Components:
- Exact Content-Length header format (
Content-Length: N\r\n\r\n
) - Proper JSON-RPC message structure
- UTF-8 and binary data handling
- Error recovery mechanisms
- Capability reporting
Test Functions:
- Initialize sequence
- Search function with file paths
- Match function with string content
- Count function for occurrence counting
Results: ✅ The server successfully passes all MCP Inspector compatibility tests
File: test-claude-desktop.js
This test verifies that the krep-mcp-server works properly with Claude Desktop.
Test Components:
- Environment variable handling (
CLAUDE_MCP=true
) - Initialize sequence
- Function execution
- Unicode handling
- Buffer management for large messages
Test Functions:
- Initialize with Claude Desktop client info
- Search function for file patterns
- Match function for text patterns
Results: ✅ The server successfully passes all Claude Desktop integration tests
Directory: test/unit/
These tests verify individual components of the server:
- Algorithm selection logic
- API endpoint correctness
- Error handling
- URI parsing
- Performance metrics
Directory: test/integration/
These tests verify how components work together:
- SDK integration workflows
- MCP URI validation
- MCP protocol compliance
- Client compatibility
-
JSON-RPC Message Format
- Fixed strict Content-Length header format
- Ensured proper UTF-8 encoding
- Implemented atomic message writing
-
Output Separation
- Redirected all debug output to stderr
- Kept stdout clean for JSON-RPC messages only
-
Buffer Handling
- Improved handling of binary data
- Added type checking for Buffer.concat
- Enhanced chunk accumulation
-
Error Recovery
- Added buffer clearing for large accumulations
- Improved error reporting
- Enhanced message parsing resilience
- Node.js v23.7.0
- macOS Ventura
- krep 1.2.1
To run the tests:
# MCP Inspector compatibility test
node test-mcp-inspector.js
# Claude Desktop integration test
node test-claude-desktop.js
# All unit and integration tests
npm test
The test/benchmark.js
and test/mcp_benchmark.js
files provide performance benchmarks for:
- Search performance across different pattern sizes
- Buffer handling with large messages
- Protocol message parsing speed
Current benchmark results show that the krep-mcp-server maintains high performance while ensuring protocol compliance.