The mock-client directory contains debug clients for testing the Socket MCP server.
-
Ensure you are running Node 22 or later:
node --version v22.17.0
-
Set your Socket API key:
export SOCKET_API_KEY="your-api-key-here"
Direct stdio communication using JSON-RPC protocol:
npm run debug-stdioThis client:
- Sends raw JSON-RPC messages to the MCP server
- Tests initialization, tool listing, and depscore calls
- Useful for debugging protocol-level issues
Uses the official MCP SDK client library:
npm run debug-sdkThis client:
- Uses the same SDK that real MCP clients use
- Tests the server's compatibility with the SDK
- Good for integration testing
Tests the HTTP/SSE transport mode:
# First, start the server in HTTP mode:
npm run server-http
# In another terminal:
npm run debug-httpThis client:
- Tests HTTP POST requests and SSE streams
- Verifies session management
- Tests CORS and HTTP-specific features
All clients test the following scenarios:
- Connection initialization - MCP protocol handshake
- Tool discovery - Lists available tools
- Basic depscore call - Tests with npm and PyPI packages
- Error handling - Tests with invalid inputs
- Edge cases - Unknown packages, minimal inputs
{
"content": [
{
"type": "text",
"text": "Package: express@4.18.2\nScore: 0.85\n..."
}
]
}{
"error": {
"code": -32602,
"message": "Invalid params",
"data": "Expected array with at least 1 element"
}
}- API Key Missing: Set
SOCKET_API_KEYenvironment variable - Build Errors: Run
npm run buildfirst - Permission Denied: Check file permissions (should be executable)
- Connection Refused: For HTTP mode, ensure server is running
To test against a local Socket API:
# Edit index.ts and change SOCKET_API_URL
# Then rebuild and testCheck logs at:
/tmp/socket-mcp.log- Info logs/tmp/socket-mcp-error.log- Error logs
Edit the test clients to modify the testPackages array with your specific packages to test.