Skip to main content
Glama
moimran

EVE-NG MCP Server

by moimran

connect_node_to_network

Connect a node interface to a network in an EVE-NG lab to enable communication between devices through that network connection.

Instructions

Connect a node to a network.

This tool creates a connection between a node interface and a network in the lab, enabling communication through that network.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argumentsYes

Implementation Reference

  • The @mcp.tool()-decorated async handler function implementing the connect_node_to_network tool logic. It uses eveng_client.connect_node_to_cloud to perform the connection and returns formatted TextContent responses.
    @mcp.tool()
    async def connect_node_to_network(arguments: ConnectNodeToNetworkArgs) -> list[TextContent]:
        """
        Connect a node to a network.
    
        This tool creates a connection between a node interface and a network
        in the lab, enabling communication through that network.
        """
        try:
            logger.info(f"Connecting node {arguments.node_id} to network {arguments.network_id}")
    
            if not eveng_client.is_connected:
                return [TextContent(
                    type="text",
                    text="Not connected to EVE-NG server. Use connect_eveng_server tool first."
                )]
    
            # Connect node to network (cloud)
            result = await eveng_client.connect_node_to_cloud(
                arguments.lab_path,
                arguments.node_id,
                arguments.node_interface,
                arguments.network_id
            )
    
            if result.get('status') == 'success':
                return [TextContent(
                    type="text",
                    text=f"Successfully connected node to network!\n\n"
                         f"Lab: {arguments.lab_path}\n"
                         f"Node: {arguments.node_id}\n"
                         f"Interface: {arguments.node_interface}\n"
                         f"Network: {arguments.network_id}\n\n"
                         f"Connection established successfully."
                )]
            else:
                return [TextContent(
                    type="text",
                    text=f"Failed to connect node to network: {result.get('message', 'Unknown error')}"
                )]
    
        except Exception as e:
            logger.error(f"Failed to connect node to network: {e}")
            return [TextContent(
                type="text",
                text=f"Failed to connect node to network: {str(e)}"
            )]
  • Pydantic BaseModel schema defining the input arguments for the connect_node_to_network tool.
    class ConnectNodeToNetworkArgs(BaseModel):
        """Arguments for connect_node_to_network tool."""
        lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)")
        node_id: str = Field(description="Source node ID")
        node_interface: str = Field(description="Node interface name (e.g., 'Gi0/0', 'eth0')")
        network_id: str = Field(description="Target network ID")
  • Registration call to register_network_tools which defines and registers the connect_node_to_network tool using @mcp.tool() inside the function.
    # Network management tools
    register_network_tools(mcp, eveng_client)
  • Top-level registration in the main server class, calling register_tools which chains to all tool registrations including network management tools.
    # Register tools
    register_tools(self.mcp, self.eveng_client)
  • Documentation reference for the tool in the static API reference resource.
    ### connect_node_to_network

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/moimran/eveng-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server