Manual Testing Guide: MCP Client Integration
October 9, 2025 · View on GitHub
This guide documents how to manually test the MCP client integration with the real MCP SDK. These tests should be performed in the VS Code extension development host to verify the implementation works correctly.
Setup
- Open this project in VS Code
- Press
F5to start the Extension Development Host - Open the Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) - Look for "AST Helper" commands
Test 1: Server Startup and Connection
###Expected Behavior
When the extension activates (if autoStart is enabled):
- Open "AST Helper Server" output channel
- Should see:
Server Process Manager initialized Server path: /path/to/packages/ast-mcp-server/dist/index.js Working directory: /path/to/workspace Starting MCP server... MCP server started successfully (PID: XXXX) MCP Client Manager initialized Connecting to MCP server... MCP client connected successfully Server capabilities: { tools: {...}, resources: {...} }
Success Criteria
- ✅ Server process starts without errors
- ✅ Client connects to server
- ✅ Server capabilities received and logged
- ✅ No error messages in output channel
Test 2: Status Bar Integration
Expected Behavior
- Look at VS Code status bar (bottom right)
- Should see "AST Helper" status item
- When connected: Shows
$(check) AST Helper(green checkmark) - When disconnected: Shows
$(x) AST Helper(red X) - Click status item to open output channel
Success Criteria
- ✅ Status item visible in status bar
- ✅ Status updates in real-time
- ✅ Tooltip shows connection information
- ✅ Clicking opens output channel
Test 3: Server Capabilities
Expected Behavior
After connection, the server should expose its capabilities:
- Check output channel logs
- Should see available tools listed:
query_ast_contextast_file_queryast_index_statusast_find_referencesast_find_definitionsast_symbol_search- (and others)
Success Criteria
- ✅ All expected tools are listed
- ✅ Tool descriptions and schemas are present
- ✅ Resources capability exposed (if applicable)
Test 4: Tool Invocation
Test 4.1: ast_index_status Tool
Manual Test: Add temporary test code to extension:
// In extension.ts or a command handler
const clientManager = // get MCPClientManager instance
const client = clientManager.getClient();
if (client) {
const result = await client.callTool({
name: "ast_index_status",
arguments: {}
});
console.log("Tool result:", result);
}
Expected Response:
{
"content": [
{
"type": "text",
"text": "Index status: X files indexed, Y symbols total"
}
]
}
Test 4.2: Error Handling - Invalid Tool Name
Manual Test:
try {
await client.callTool({
name: "non_existent_tool",
arguments: {},
});
} catch (error) {
console.log("Expected error:", error);
}
Expected Error:
Error: Tool not found: non_existent_tool
Test 4.3: Error Handling - Invalid Arguments
Manual Test:
try {
await client.callTool({
name: "ast_file_query",
arguments: {}, // Missing required 'file_path'
});
} catch (error) {
console.log("Expected error:", error);
}
Expected Error:
Error: Missing required argument: file_path
Success Criteria
- ✅ Tool calls return expected results
- ✅ Errors are caught and logged appropriately
- ✅ Extension does not crash on errors
- ✅ Response format matches MCP protocol
Test 5: Reconnection Handling
Test 5.1: Detect Server Crash
Manual Test:
- Note the server PID from output channel
- Kill the process:
kill -9 <PID> - Check output channel
Expected Logs:
Transport closed
Client state changed: connected -> disconnected
Attempting to reconnect (attempt 1/5)...
Starting MCP server...
MCP server started successfully
Reconnecting client...
MCP client connected successfully
Test 5.2: Manual Server Restart
Manual Test:
- Run command: "AST Helper: Restart Server"
- Check output channel
Expected Logs:
Restarting MCP server...
Stopping MCP server...
MCP server stopped
Starting MCP server...
MCP server started successfully (PID: XXXX)
Reconnecting client...
MCP client connected successfully
Success Criteria
- ✅ Disconnect detected within heartbeat interval (default 30s)
- ✅ Automatic reconnection attempts occur
- ✅ Status bar updates to show disconnected state
- ✅ Status bar updates back to connected after reconnection
- ✅ No zombie processes left behind
- ✅ Tools work after reconnection
Test 6: Transport Message Handling
Test 6.1: Large Responses
Manual Test: Call a tool that returns a large response (e.g., query on a large file):
const result = await client.callTool({
name: "query_ast_context",
arguments: {
query: "find all functions",
max_results: 100,
},
});
Expected Behavior:
- Response should be complete (not truncated)
- No buffer overflow warnings in logs
- All data accessible and properly parsed
Test 6.2: Concurrent Requests
Manual Test:
const promises = [
client.listTools(),
client.callTool({ name: "ast_index_status", arguments: {} }),
client.listResources(),
];
const results = await Promise.all(promises);
console.log("All results:", results);
Expected Behavior:
- All 3 requests complete successfully
- No race conditions or corrupted messages
- Responses arrive in correct order
- No JSON parsing errors
Test 6.3: Malformed JSON Handling
Expected Behavior (automatic): If server sends invalid JSON, Transport should:
- Log error: "Failed to parse JSON-RPC message: ..."
- Not crash the extension
- Continue processing other messages
Success Criteria
- ✅ Large responses handled without truncation
- ✅ Concurrent requests complete successfully
- ✅ Malformed messages logged but don't crash extension
- ✅ Newline-delimited JSON parsing works correctly
Test 7: Performance and Reliability
Test 7.1: Extended Connection Stability
Manual Test:
- Leave extension running for 30+ minutes
- Periodically check status bar (should stay green)
- Make tool calls after extended idle time
Expected Behavior:
- Heartbeat keeps connection alive
- No unexpected disconnects
- Tool calls work after idle period
- No memory leaks (check Task Manager/Activity Monitor)
Test 7.2: Rapid Connect/Disconnect Cycles
Manual Test:
- Rapidly toggle server on/off using commands
- Or repeatedly call start() and stop()
Expected Behavior:
- Clean state transitions
- No crashes or errors
- No zombie processes
- No resource leaks
Success Criteria
- ✅ Connection stable over extended period
- ✅ Heartbeat prevents timeouts
- ✅ No memory leaks
- ✅ Clean shutdown on extension deactivation
- ✅ Handles rapid start/stop cycles
Test 8: VS Code Integration
Test 8.1: Workspace Changes
Manual Test:
- Close and reopen workspace
- Server should stop and restart
Expected Behavior:
- Server stops gracefully on workspace close
- Server starts on workspace open (if autoStart enabled)
- Client reconnects automatically
Test 8.2: Extension Deactivation
Manual Test:
- Disable the extension
- Check that server process stops
Expected Behavior:
- Server process terminates
- No orphaned processes
- Clean shutdown logged
Success Criteria
- ✅ Handles workspace changes correctly
- ✅ Clean deactivation with no orphaned processes
- ✅ Extension can be reactivated without issues
Debugging Tips
View Logs
- Extension Output: Output panel → "AST Helper Server"
- MCP Server Logs: Check stderr from server process
- Chrome DevTools: Help → Toggle Developer Tools
Common Issues
-
"Server process not available"
- Check server path in configuration
- Verify
packages/ast-mcp-server/dist/index.jsexists - Run
yarn buildto rebuild server
-
"Failed to parse JSON-RPC message"
- Check server stdout for non-JSON output
- Verify server uses newline-delimited JSON
- Check for stderr contamination of stdout
-
Connection timeout
- Increase
connectionTimeoutin configuration - Check if server is stuck in startup
- Verify server responds to initialization
- Increase
-
Heartbeat failures
- Check network/IPC latency
- Verify server responds to ping
- Adjust
heartbeatIntervalif needed
Success Checklist
Before considering MCP client integration complete, verify:
- ✅ Server starts and client connects successfully
- ✅ Status bar shows correct connection state
- ✅ All tools can be called and return results
- ✅ Error handling works for invalid tool/args
- ✅ Reconnection works after server crash
- ✅ Transport handles large responses
- ✅ Concurrent requests work correctly
- ✅ Connection stable over extended period
- ✅ Clean shutdown on extension deactivation
- ✅ No memory leaks or zombie processes
Next Steps
After manual testing is complete:
- Document findings in issue tracker
- Fix any bugs discovered during testing
- Add unit tests for critical paths (where possible with VS Code mocking)
- Update user documentation with any configuration needed
- Prepare for end-to-end testing with real workspaces