We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bsim0927/texas-solver-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
index.js•1.76 KiB
#!/usr/bin/env node
/**
* TexasSolver MCP Server Entry Point
*/
import dotenv from 'dotenv';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { SolverExecutor } from './solver/executor.js';
import { StorageManager } from './storage/manager.js';
import TexasSolverMCPServer from './server.js';
/**
* Main initialization function
*/
async function main() {
try {
// Load environment variables
dotenv.config();
// Get solver path from environment
const solverPath = process.env.TEXAS_SOLVER_PATH;
if (!solverPath) {
console.error('ERROR: TEXAS_SOLVER_PATH environment variable not set');
process.exit(1);
}
// Validate solver binary exists and is executable
const solverValid = await SolverExecutor.validateSolver(solverPath);
if (!solverValid) {
console.error(`ERROR: Solver binary not found or not executable: ${solverPath}`);
process.exit(1);
}
// Initialize storage manager
const dataDir = process.env.MCP_DATA_DIR || './data';
const storageManager = new StorageManager(dataDir);
await storageManager.initialize();
// Create and configure MCP server
const mcpServer = new TexasSolverMCPServer(solverPath, storageManager);
// Connect to stdio transport
const transport = new StdioServerTransport();
await mcpServer.connect(transport);
// Log startup (to stderr only - stdout is for MCP protocol)
if (process.env.DEBUG) {
console.error(`[TexasSolver MCP] Server started`);
console.error(`[TexasSolver MCP] Solver: ${solverPath}`);
console.error(`[TexasSolver MCP] Data directory: ${dataDir}`);
}
} catch (error) {
console.error('FATAL ERROR:', error.message);
process.exit(1);
}
}
// Run the server
main();