@venly/wallet-mcp
Version:
Production-ready MCP server enabling AI agents to perform Web3 wallet operations through Venly's blockchain infrastructure. Supports 14+ networks including Ethereum, Polygon, Arbitrum, and stablecoin operations.
86 lines • 3.11 kB
JavaScript
/**
* Docker Server Entry Point
*
* Starts the HTTP server for Docker deployment with health checks and metrics
*/
import { HttpServer } from './server/HttpServer.js';
import winston from 'winston';
// Create logger
const logger = winston.createLogger({
level: process.env['MCP_LOG_LEVEL'] || 'info',
format: winston.format.combine(winston.format.timestamp(), winston.format.errors({ stack: true }), winston.format.json()),
defaultMeta: { service: 'venly-mcp-docker' },
transports: [
new winston.transports.Console({
format: winston.format.combine(winston.format.colorize(), winston.format.simple())
})
]
});
// Global error handlers
process.on('uncaughtException', (error) => {
logger.error('Uncaught Exception', { error });
process.exit(1);
});
process.on('unhandledRejection', (reason, promise) => {
logger.error('Unhandled Rejection', { reason, promise });
process.exit(1);
});
// Graceful shutdown handler
let httpServer = null;
const gracefulShutdown = async (signal) => {
logger.info(`Received ${signal}, starting graceful shutdown...`);
if (httpServer) {
try {
await httpServer.stop();
await httpServer.stopMcpServer();
logger.info('Graceful shutdown completed');
process.exit(0);
}
catch (error) {
logger.error('Error during graceful shutdown', { error });
process.exit(1);
}
}
else {
process.exit(0);
}
};
// Register shutdown handlers
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
process.on('SIGINT', () => gracefulShutdown('SIGINT'));
// Main function
async function main() {
try {
logger.info('Starting Venly MCP Server for Docker deployment...');
// Note: VENLY_CLIENT_ID and VENLY_CLIENT_SECRET are provided per-request, not as env vars
// Create and start HTTP server
httpServer = new HttpServer();
await httpServer.start();
// Log startup information
const status = httpServer.getStatus();
logger.info('Venly MCP Server started successfully', {
httpPort: status.http.port,
mcpVersion: status.mcp.version,
toolsCount: status.mcp.toolsCount,
environment: process.env['VENLY_ENVIRONMENT'] || 'sandbox'
});
// Log available endpoints
logger.info('Health check endpoints available:');
logger.info(` http://localhost:${status.http.port}/health`);
logger.info(` http://localhost:${status.http.port}/health/ready`);
logger.info(` http://localhost:${status.http.port}/health/live`);
logger.info(` http://localhost:${status.http.port}/metrics`);
logger.info(` http://localhost:${status.http.port}/status`);
}
catch (error) {
logger.error('Failed to start server', { error });
process.exit(1);
}
}
// Start the server
main().catch((error) => {
logger.error('Startup error', { error });
process.exit(1);
});
//# sourceMappingURL=docker-server.js.map