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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1614-1632 (handler)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}` ); } }
- src/index.ts:418-433 (helper)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: {} } },
- src/index.ts:1058-1061 (schema)Input schema for the 'list_ports' tool, which requires no parameters (empty object).inputSchema: { type: "object", properties: {} }