msexchange-mcp
Version:
MCP server for Microsoft Exchange/Outlook email operations via Microsoft Graph API
52 lines (42 loc) • 1.1 kB
JavaScript
// Test script to debug MCP crash
import { spawn } from 'child_process';
import { writeFileSync } from 'fs';
const mcpRequest = {
jsonrpc: '2.0',
id: 1,
method: 'tools/call',
params: {
name: 'query_emails',
arguments: {
user_id: 'olivier@surge.management',
limit: 20,
include_body: true,
order_by: 'receivedDateTime DESC'
}
}
};
console.log('Starting MCP server test...');
const child = spawn('node', ['dist/cli.js'], {
stdio: ['pipe', 'pipe', 'pipe'],
env: process.env
});
child.stderr.on('data', (data) => {
console.error('STDERR:', data.toString());
});
child.stdout.on('data', (data) => {
console.log('STDOUT:', data.toString());
});
child.on('close', (code) => {
console.log(`Child process exited with code ${code}`);
});
child.on('error', (error) => {
console.error('Process error:', error);
});
// Send the request
console.log('Sending request:', JSON.stringify(mcpRequest, null, 2));
child.stdin.write(JSON.stringify(mcpRequest) + '\n');
// Wait a bit then exit
setTimeout(() => {
child.kill();
}, 5000);