connect_eveng_server
Establish a connection to an EVE-NG server for network emulation management by providing authentication credentials to enable subsequent operations.
Instructions
Connect to EVE-NG server and authenticate.
This tool establishes a connection to the EVE-NG server using the provided
credentials. The connection will be maintained for subsequent operations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arguments | Yes |
Implementation Reference
- The core handler function for the 'connect_eveng_server' tool. It updates the EVENG client configuration with provided arguments, connects to the server, retrieves status, and returns success/error messages via TextContent.async def connect_eveng_server(arguments: ConnectServerArgs) -> list[TextContent]: """ Connect to EVE-NG server and authenticate. This tool establishes a connection to the EVE-NG server using the provided credentials. The connection will be maintained for subsequent operations. """ try: logger.info(f"Attempting to connect to EVE-NG server at {arguments.host}") # Update client configuration config = eveng_client.config config.eveng.host = arguments.host config.eveng.username = arguments.username config.eveng.password = arguments.password config.eveng.port = arguments.port config.eveng.protocol = arguments.protocol # Connect to server await eveng_client.connect() # Get server status for confirmation status = await eveng_client.get_server_status() result = { "status": "connected", "server": f"{arguments.protocol}://{arguments.host}:{arguments.port}", "username": arguments.username, "server_info": status } logger.info(f"Successfully connected to EVE-NG server at {arguments.host}") return [TextContent( type="text", text=f"Successfully connected to EVE-NG server!\n\n" f"Server: {arguments.protocol}://{arguments.host}:{arguments.port}\n" f"Username: {arguments.username}\n" f"Server Version: {status.get('version', 'Unknown')}\n" f"Status: {status.get('status', 'Unknown')}" )] except EVENGAuthenticationError as e: logger.error(f"Authentication failed: {e}") return [TextContent( type="text", text=f"Authentication failed: {str(e)}\n\n" f"Please check your username and password and try again." )] except EVENGConnectionError as e: logger.error(f"Connection failed: {e}") return [TextContent( type="text", text=f"Connection failed: {str(e)}\n\n" f"Please check the server address and network connectivity." )] except Exception as e: logger.error(f"Unexpected error: {e}") return [TextContent( type="text", text=f"Unexpected error occurred: {str(e)}\n\n" f"Please check your configuration and try again." )]
- Pydantic model defining the input schema for the connect_eveng_server tool, specifying fields for host, username, password, port, and protocol with descriptions and defaults.class ConnectServerArgs(BaseModel): """Arguments for connect_eveng_server tool.""" host: str = Field(description="EVE-NG server hostname or IP address") username: str = Field(description="Username for authentication") password: str = Field(description="Password for authentication") port: int = Field(default=80, description="Server port (default: 80)") protocol: str = Field(default="http", description="Protocol (http/https, default: http)")
- eveng_mcp_server/tools/connection.py:32-35 (registration)The registration function for connection tools, where the @mcp.tool() decorator is applied to define and register the connect_eveng_server handler.def register_connection_tools(mcp: "FastMCP", eveng_client: "EVENGClientWrapper") -> None: """Register connection management tools.""" @mcp.tool()
- eveng_mcp_server/server.py:52-53 (registration)Top-level call to register_tools in the main server class, which chains to registering the connect_eveng_server tool.# Register tools register_tools(self.mcp, self.eveng_client)
- eveng_mcp_server/tools/__init__.py:18-19 (registration)Intermediate registration call within tools/__init__.py's register_tools function, specifically invoking the connection tools registration.# Connection management tools register_connection_tools(mcp, eveng_client)