task-manager-mcp-wrapper
Version:
Complete task management and assignment MCP servers with 16 AI-powered tools for intelligent task planning, scheduling, risk prediction, team collaboration, and automated workflow management
66 lines (52 loc) • 1.39 kB
JavaScript
#!/usr/bin/env node
const { spawn } = require('child_process');
const path = require('path');
const os = require('os');
function main() {
// 设置环境变量
const env = { ...process.env };
// 运行任务分配服务器
const pythonExe = os.platform() === 'win32' ? 'python' : 'python3';
const packageDir = path.join(__dirname, '..');
const pythonArgs = ['-W', 'ignore', '-c', `
import sys
import os
import io
import warnings
# Suppress all warnings and debug output
warnings.filterwarnings('ignore')
os.environ['PYTHONWARNINGS'] = 'ignore'
os.environ['PYTHONIOENCODING'] = 'utf-8'
# Set UTF-8 encoding
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
sys.path.insert(0, '${packageDir.replace(/\\/g, '/')}')
try:
from task_assignment_mcp.server import create_server
server = create_server()
server.run()
except Exception as e:
sys.exit(1)
`];
const child = spawn(pythonExe, pythonArgs, {
stdio: 'inherit',
env: env,
cwd: packageDir
});
child.on('error', (error) => {
process.exit(1);
});
child.on('exit', (code) => {
process.exit(code);
});
// 处理信号
process.on('SIGINT', () => {
child.kill('SIGINT');
});
process.on('SIGTERM', () => {
child.kill('SIGTERM');
});
}
if (require.main === module) {
main();
}