Skip to main content
Glama

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: {} }

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