casefile-repository-mcp-server
Version:
Vessel casefile management system with MCP integration for maritime operations
43 lines (37 loc) • 1.21 kB
JavaScript
import { execSync } from 'child_process';
import { existsSync, mkdirSync, writeFileSync } from 'fs';
import { join } from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Create test directory
const testDir = join(__dirname, 'test');
if (!existsSync(testDir)) {
mkdirSync(testDir, { recursive: true });
}
// Create test configuration
const config = {
mongoUri: process.env.MONGO_URI || 'mongodb://localhost:27017/casefile_repository',
typesenseHost: process.env.TYPESENSE_HOST || 'localhost',
typesensePort: process.env.TYPESENSE_PORT || '8108',
typesenseProtocol: process.env.TYPESENSE_PROTOCOL || 'http',
typesenseApiKey: process.env.TYPESENSE_API_KEY || 'test_key'
};
// Write test configuration
writeFileSync(join(testDir, 'config.json'), JSON.stringify(config, null, 2));
// Run the server
try {
console.log('Starting test server...');
execSync('node dist/index.js', {
stdio: 'inherit',
env: {
...process.env,
...config
}
});
} catch (error) {
console.error('Error running test server:', error);
process.exit(1);
}