Skip to main content
Glama
jsebgiraldo

OpenWRT SSH MCP Server

by jsebgiraldo

openwrt_opkg_info

Retrieve detailed information about OpenWRT packages to verify availability, dependencies, and installation status for remote router management.

Instructions

Get detailed information about a specific package

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYesName of the package

Implementation Reference

  • The actual implementation of opkg_info that validates package name format, executes 'opkg info {package_name}' command, parses the output into a dictionary, and returns the package information
    @staticmethod
    async def opkg_info(package_name: str) -> dict[str, Any]:
        """
        Get information about a package.
        
        Args:
            package_name: Name of the package
            
        Returns:
            dict: Package information
        """
        # Validate package name
        if not re.match(r'^[a-zA-Z0-9._-]+$', package_name):
            return {
                "success": False,
                "error": "Invalid package name. Use only alphanumeric characters, dash, underscore, and dot.",
            }
    
        command = f"opkg info {package_name}"
        result = await OpenWRTTools.execute_command(command)
    
        if result["success"]:
            # Parse package info
            info = {}
            for line in result["output"].strip().split("\n"):
                if ": " in line:
                    key, value = line.split(": ", 1)
                    info[key.lower().replace(" ", "_")] = value
    
            return {
                "success": True,
                "package_info": info,
            }
        else:
            return {
                "success": False,
                "error": result["error"],
                "output": result["output"],
            }
  • Tool registration with schema definition including the tool name, description, and inputSchema defining package_name as a required string parameter
    Tool(
        name="openwrt_opkg_info",
        description="Get detailed information about a specific package",
        inputSchema={
            "type": "object",
            "properties": {
                "package_name": {
                    "type": "string",
                    "description": "Name of the package",
                },
            },
            "required": ["package_name"],
        },
    ),
  • Handler routing logic that extracts package_name from arguments, validates it's present, and delegates to OpenWRTTools.opkg_info(package_name)
    elif name == "openwrt_opkg_info":
        package_name = arguments.get("package_name")
        if not package_name:
            raise ValueError("Missing required argument: package_name")
        result = await OpenWRTTools.opkg_info(package_name)

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/jsebgiraldo/openwrt_ssh_mcp'

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