#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
const tools_js_1 = require("./tools.js");
/**
* MCP Server for Login Operations
*
* This server provides tools for automated login functionality that can interact
* with the Playwright MCP server for browser automation.
*/
// Server configuration
const SERVER_NAME = "login-server";
const SERVER_VERSION = "1.0.0";
// Create the MCP server instance
const server = new mcp_js_1.McpServer({
name: SERVER_NAME,
version: SERVER_VERSION,
capabilities: {
tools: {}
}
});
// Register all tools with the server
(0, tools_js_1.registerAllTools)(server);
/**
* Main server function
*/
async function main() {
const transport = new stdio_js_1.StdioServerTransport();
await server.connect(transport);
// Log server startup (to stderr so it doesn't interfere with MCP protocol)
console.error(`š MCP Login Server v${SERVER_VERSION} started`);
console.error(`š Available tools: ${(0, tools_js_1.getAvailableTools)().join(', ')}`);
console.error(`šÆ Target URL: ${tools_js_1.LOGIN_CREDENTIALS.targetUrl}`);
console.error(`š¤ Username: ${tools_js_1.LOGIN_CREDENTIALS.username}`);
}
// Handle graceful shutdown
process.on('SIGINT', async () => {
console.error('\nš Shutting down MCP Login Server...');
process.exit(0);
});
process.on('SIGTERM', async () => {
console.error('\nš Shutting down MCP Login Server...');
process.exit(0);
});
// Start the server
if (require.main === module) {
main().catch((error) => {
console.error('š„ Fatal error in MCP Login Server:', error);
process.exit(1);
});
}