Skip to main content
Glama
badchars

osint-mcp-server

by badchars

censys_hosts

Search Censys for hosts matching specific criteria to identify IP addresses, services, ports, location data, and ASN information for reconnaissance and attack surface mapping.

Instructions

Search Censys for hosts matching a query. Returns IPs, services, ports, location, ASN. Requires CENSYS_API_ID + CENSYS_API_SECRET.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesCensys search query
per_pageNoResults per page (max 100, default: 25)

Implementation Reference

  • The handler function that executes the censys_hosts tool logic by calling the Censys API.
    export async function censysHosts(query: string, auth: CensysAuth, perPage = 25): Promise<CensysHostsResult> {
      const data = await censysFetch("POST", "/hosts/search", auth, {
        q: query,
        per_page: Math.min(perPage, 100),
      });
    
      const result = data.result ?? {};
      const hosts: CensysHost[] = (result.hits ?? []).map((h: any) => ({
        ip: h.ip,
        services: (h.services ?? []).map((s: any) => ({
          port: s.port,
          serviceName: s.service_name ?? s.extended_service_name ?? "",
          transportProtocol: s.transport_protocol ?? "TCP",
          certificate: s.certificate,
        })),
        location: h.location
          ? { country: h.location.country, city: h.location.city, province: h.location.province }
          : undefined,
        autonomousSystem: h.autonomous_system
          ? { asn: h.autonomous_system.asn, name: h.autonomous_system.name, bgpPrefix: h.autonomous_system.bgp_prefix }
          : undefined,
        lastUpdatedAt: h.last_updated_at,
        operatingSystem: h.operating_system
          ? { product: h.operating_system.product, version: h.operating_system.version }
          : undefined,
      }));
    
      return { total: result.total ?? 0, hosts, query };
    }
  • Schema/Interface defining the structure of the Censys host search result.
    interface CensysHostsResult {
      total: number;
      hosts: CensysHost[];
      query: string;
    }
  • Registration of the 'censys_hosts' tool definition in the protocol tools file.
    const censysHostsTool: ToolDef = {
      name: "censys_hosts",
      description: "Search Censys for hosts matching a query. Returns IPs, services, ports, location, ASN. Requires CENSYS_API_ID + CENSYS_API_SECRET.",
      schema: {
        query: z.string().describe("Censys search query"),
        per_page: z.number().optional().describe("Results per page (max 100, default: 25)"),
      },
      execute: async (args, ctx) => {
        const id = requireApiKey(ctx.config.censysApiId, "Censys", "CENSYS_API_ID");
        const secret = requireApiKey(ctx.config.censysApiSecret, "Censys", "CENSYS_API_SECRET");
        return json(await censysHosts(args.query as string, { id, secret }, args.per_page as number | undefined));
      },
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds some context by mentioning authentication requirements and listing the types of data returned, but it lacks details on rate limits, pagination (beyond per_page parameter), error handling, or whether the search is real-time or cached. The description does not contradict any annotations, as none are given.

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 front-loaded with the core purpose and key details in two efficient sentences. Every sentence earns its place: the first defines the action and output, and the second specifies prerequisites. There is no redundant or verbose language, making it highly concise and well-structured.

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 moderate complexity (search with authentication), no annotations, and no output schema, the description is partially complete. It covers the purpose, output types, and prerequisites but lacks details on behavioral aspects like rate limits, error responses, or pagination beyond the per_page parameter. For a tool with no output schema, it should ideally describe the return format more explicitly, but it provides enough to be minimally viable.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents both parameters (query and per_page) adequately. The description does not add any additional meaning or examples for the parameters beyond what the schema provides, such as query syntax or format examples. The baseline score of 3 is appropriate when the schema handles parameter documentation effectively.

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

Purpose5/5

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

The description clearly states the specific action ('Search Censys for hosts'), resource ('hosts'), and scope ('matching a query'), distinguishing it from sibling tools like censys_certificates (certificates) or censys_host_details (detailed host info). It explicitly identifies the data returned (IPs, services, ports, location, ASN), making the purpose unambiguous.

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

Usage Guidelines4/5

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

The description provides clear context by specifying prerequisites ('Requires CENSYS_API_ID + CENSYS_API_SECRET'), which helps determine when the tool can be used. However, it does not explicitly state when to use this tool versus alternatives like shodan_host or hackertarget_hostsearch for similar host search purposes, nor does it mention any exclusions or specific scenarios where this tool is preferred.

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/badchars/osint-mcp-server'

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