#!/usr/bin/env node
/**
* Simple test script for the Sentry Sensei MCP Server
* This demonstrates how to interact with the MCP server programmatically
*/
const { spawn } = require('child_process');
const path = require('path');
// Test function to send MCP requests
function testMCPServer() {
console.log('๐งช Testing Sentry Sensei MCP Server...\n');
// Start the MCP server process
const serverPath = path.join(__dirname, '..', 'src', 'index.js');
const server = spawn('node', [serverPath], {
stdio: ['pipe', 'pipe', 'pipe'],
});
// Test: List tools request
const listToolsRequest = {
jsonrpc: '2.0',
id: 1,
method: 'tools/list',
};
console.log('๐ Sending list tools request...');
console.log(JSON.stringify(listToolsRequest, null, 2));
server.stdin.write(`${JSON.stringify(listToolsRequest)}\n`);
// Handle server response
server.stdout.on('data', data => {
const response = data.toString().trim();
if (response) {
try {
const parsed = JSON.parse(response);
console.log('\nโ
Server response:');
console.log(JSON.stringify(parsed, null, 2));
if (parsed.result && parsed.result.tools) {
console.log(`\n๐ง Found ${parsed.result.tools.length} available tools:`);
parsed.result.tools.forEach(tool => {
console.log(` - ${tool.name}: ${tool.description}`);
});
}
} catch {
console.log('๐ Raw response:', response);
}
}
});
server.stderr.on('data', data => {
console.log('๐ Server info:', data.toString());
});
// Clean up after a few seconds
setTimeout(() => {
console.log('\n๐ Stopping test server...');
server.kill();
console.log('โ
Test complete!');
}, 3000);
}
// Run the test
testMCPServer();