import logging import argparse from mcp.server.fastmcp import FastMCP from pmcp.mcp_server.github_server.github import initialize_github_client # Configure logging logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" ) logger = logging.getLogger(__name__) def parse_args(): parser = argparse.ArgumentParser(description="Avvia il Github MCP Server") parser.add_argument("--api-key", type=str, required=True, help="API key per GitHub") return parser.parse_args() def main(): args = parse_args() initialize_github_client(args.api_key) mcp = FastMCP("Github MCP Server") #import here because the client is not initialized yet from pmcp.mcp_server.github_server.tools.tools import register_tools register_tools(mcp) try: logger.info("Starting Github MCP Server in Stdio...") mcp.run() logger.info("Github MCP Server started successfully") except KeyboardInterrupt: logger.info("Shutting down server...") except Exception as e: logger.error(f"Server error: {str(e)}") raise if __name__ == "__main__": main()