Skip to main content
Glama
Cyreslab-AI

Shodan MCP Server

list_ports

Discover all internet ports monitored by Shodan for cybersecurity research and threat intelligence analysis.

Instructions

List all ports that Shodan crawls on the Internet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'list_ports' that calls shodanClient.listPorts() and returns the JSON-formatted list of ports.
    case "list_ports": {
      try {
        const ports = await shodanClient.listPorts();
        return {
          content: [{
            type: "text",
            text: JSON.stringify(ports, null, 2)
          }]
        };
      } catch (error) {
        if (error instanceof McpError) {
          throw error;
        }
        throw new McpError(
          ErrorCode.InternalError,
          `Error listing ports: ${(error as Error).message}`
        );
      }
    }
  • Core helper method in ShodanClient that queries the Shodan API /shodan/ports endpoint to retrieve the list of all crawled ports.
     * List all ports that Shodan crawls
     */
    async listPorts(): Promise<any> {
      try {
        const response = await this.axiosInstance.get("/shodan/ports");
        return { ports: response.data };
      } catch (error: unknown) {
        if (axios.isAxiosError(error)) {
          throw new McpError(
            ErrorCode.InternalError,
            `Shodan API error: ${error.response?.data?.error || error.message}`
          );
        }
        throw error;
      }
    }
  • src/index.ts:1056-1062 (registration)
    Tool registration entry in ListToolsRequestSchema handler defining the 'list_ports' tool name, description, and empty input schema.
      name: "list_ports",
      description: "List all ports that Shodan crawls on the Internet",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • Input schema for the 'list_ports' tool, which requires no parameters (empty object).
    inputSchema: {
      type: "object",
      properties: {}
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists ports but does not describe any behavioral traits, such as whether it returns a static list, requires authentication, has rate limits, or provides real-time data. This leaves significant gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It is front-loaded with the core purpose, making it highly efficient and easy to understand.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks details on behavior, usage context, or output format, which could be helpful for an AI agent despite the low complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not add parameter details, but since there are no parameters, this is acceptable, and the baseline score is 4 for tools with zero parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all ports') and the resource ('that Shodan crawls on the Internet'), providing a specific verb+resource combination. However, it does not explicitly differentiate from sibling tools like 'list_protocols' or 'list_search_facets', which prevents a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description does not mention any context, exclusions, or prerequisites, such as when to choose this over other listing tools or if it's for general information retrieval.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Cyreslab-AI/shodan-mcp-server'

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