Skip to main content
Glama

list_ports

Retrieve all ports monitored by Shodan for internet-connected devices, aiding in 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': calls shodanClient.listPorts() and formats the response as text content.
    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 implementation of listPorts in ShodanClient: makes API call to /shodan/ports and returns { ports: data }.
    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 in ListToolsRequestSchema handler: defines name, description, and empty inputSchema for 'list_ports'.
    name: "list_ports", description: "List all ports that Shodan crawls on the Internet", inputSchema: { type: "object", properties: {} } },
  • Input schema for list_ports tool: empty object schema (no parameters required).
    name: "list_ports", description: "List all ports that Shodan crawls on the Internet", 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