Skip to main content
Glama
badchars

osint-mcp-server

by badchars

censys_host_details

Retrieve detailed host information from Censys for any IP address, including services, certificates, OS, location, and ASN.

Instructions

Get detailed Censys host information for a single IP: all services, certificates, OS, location, ASN. Requires CENSYS_API_ID + CENSYS_API_SECRET.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesIP address to look up

Implementation Reference

  • The core handler function `censysHostDetails` that fetches detailed Censys host info for a single IP address via the Censys API v2 `/hosts/{ip}` endpoint.
    export async function censysHostDetails(ip: string, auth: CensysAuth): Promise<CensysHost> {
      const data = await censysFetch("GET", `/hosts/${encodeURIComponent(ip)}`, auth);
      const h = data.result ?? {};
    
      return {
        ip: h.ip ?? 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.tls?.certificates?.leaf_data?.fingerprint,
        })),
        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,
      };
    }
  • Tool definition including schema (zod validation for `ip` string) and execute wrapper registered under name `censys_host_details`.
    const censysHostDetailsTool: ToolDef = {
      name: "censys_host_details",
      description: "Get detailed Censys host information for a single IP: all services, certificates, OS, location, ASN. Requires CENSYS_API_ID + CENSYS_API_SECRET.",
      schema: {
        ip: z.string().describe("IP address to look up"),
      },
      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 censysHostDetails(args.ip as string, { id, secret }));
      },
    };
  • Registration of `censysHostDetailsTool` in the `allTools` array alongside other Censys tools.
    censysHostsTool,
    censysHostDetailsTool,
    censysCertificatesTool,
  • Helper function `censysFetch` used by the handler to make authenticated API calls to Censys.
    async function censysFetch(method: string, path: string, auth: CensysAuth, body?: any): Promise<any> {
      await limiter.acquire();
      const opts: RequestInit = {
        method,
        headers: {
          Authorization: authHeader(auth),
          Accept: "application/json",
          ...(body ? { "Content-Type": "application/json" } : {}),
        },
        ...(body ? { body: JSON.stringify(body) } : {}),
      };
    
      const res = await fetch(`${CENSYS_BASE}${path}`, opts);
      if (!res.ok) throw new Error(`Censys API error: ${res.status} ${res.statusText}`);
      return res.json();
    }
  • Helper function `authHeader` that generates the Basic auth header for Censys API authentication.
    function authHeader(auth: CensysAuth): string {
      return "Basic " + btoa(`${auth.id}:${auth.secret}`);
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.1/5.0
Behavior3/5

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

Without annotations, the description carries the full burden. It describes the tool as a read operation and lists returned data types, but lacks details on rate limits, error behavior (e.g., unknown IP), or data volume. This is adequate but not rich.

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 extremely concise: two sentences, front-loaded with the core purpose, and no wasted words.

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

Completeness5/5

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

For a simple tool with one parameter and no output schema, the description fully covers what the tool does and its requirements. It is complete given the complexity.

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?

The single parameter 'ip' is fully described in the schema (100% coverage). The description adds the nuance of 'single IP' and lists what is returned, but this does not significantly enhance understanding beyond the schema.

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 identifies the tool's purpose: retrieving detailed Censys host information for a single IP. It lists specific data categories (services, certificates, OS, location, ASN), distinguishing it from sibling tools like shodan_host or bgp_ip.

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 explicitly states the requirement for API credentials (CENSYS_API_ID + CENSYS_API_SECRET), providing necessary context. However, it does not provide exclusions or explicitly contrast with sibling tools, though the context of sibling names allows inference.

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