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}`);
    }
Behavior4/5

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

Discloses the authentication requirement and summarizes return data (services, certificates, OS, etc.). With no annotations provided, the description carries the full burden; it indicates a read-only operation without mentioning potential rate limits or idempotency, but is otherwise clear.

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?

Two concise sentences with no unnecessary words. The first sentence explains the action and output; the second covers a critical prerequisite. Every phrase adds value.

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

Completeness4/5

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

For a simple single-IP lookup, the description covers purpose, returned data, and authentication. Lacks mention of any side effects or limits, but given the tool's simplicity and no output schema, it is sufficiently complete for an agent to understand what to expect.

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 only parameter 'ip' is fully described in the schema (coverage 100%), and the description adds no extra detail about format (e.g., IPv4/IPv6) or constraints. Baseline score of 3 is appropriate since the schema already documents the parameter adequately.

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?

Clearly states the verb 'Get' and specific resource 'detailed Censys host information for a single IP'. Lists included data (services, certificates, OS, location, ASN), distinguishing it from sibling tools like censys_certificates or censys_hosts that may handle multiple IPs or different queries.

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?

Explicitly notes the prerequisite of API credentials (CENSYS_API_ID + CENSYS_API_SECRET). However, it does not provide explicit when-not-to-use or alternatives among siblings, though the purpose implicitly guides usage for single IP lookups.

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