Skip to main content
Glama
badchars

osint-mcp-server

by badchars

censys_certificates

Search the Censys certificate database by query (e.g., domain name) to retrieve certificate fingerprints, subjects, issuers, validity periods, and Subject Alternative Names (SANs).

Instructions

Search Censys certificate database. Returns certificate fingerprints, subjects, issuers, validity, and SANs. Requires CENSYS_API_ID + CENSYS_API_SECRET.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesCertificate search query (e.g. 'parsed.names: example.com')
per_pageNoResults per page (max 100, default: 25)

Implementation Reference

  • ToolDef registration for 'censys_certificates' with schema (query, per_page) and execute handler that calls the censysCertificates function with API credentials.
    const censysCertificatesTool: ToolDef = {
      name: "censys_certificates",
      description: "Search Censys certificate database. Returns certificate fingerprints, subjects, issuers, validity, and SANs. Requires CENSYS_API_ID + CENSYS_API_SECRET.",
      schema: {
        query: z.string().describe("Certificate search query (e.g. 'parsed.names: example.com')"),
        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 censysCertificates(args.query as string, { id, secret }, args.per_page as number | undefined));
      },
    };
  • Main handler for censys_certificates — calls Censys API v2 POST /certificates/search, maps results to CensysCert objects with fingerprint, subject, issuer, validity, and names.
    export async function censysCertificates(query: string, auth: CensysAuth, perPage = 25): Promise<CensysCertsResult> {
      const data = await censysFetch("POST", "/certificates/search", auth, {
        q: query,
        per_page: Math.min(perPage, 100),
      });
    
      const result = data.result ?? {};
      const certificates: CensysCert[] = (result.hits ?? []).map((c: any) => ({
        fingerprint: c.fingerprint_sha256 ?? c.fingerprint ?? "",
        subject: c.parsed?.subject
          ? { commonName: c.parsed.subject.common_name?.[0], organization: c.parsed.subject.organization?.[0] }
          : undefined,
        issuer: c.parsed?.issuer
          ? { commonName: c.parsed.issuer.common_name?.[0], organization: c.parsed.issuer.organization?.[0] }
          : undefined,
        validityStart: c.parsed?.validity?.start,
        validityEnd: c.parsed?.validity?.end,
        names: c.names ?? c.parsed?.names ?? [],
      }));
    
      return { total: result.total ?? 0, certificates, query };
    }
  • Type definitions for certificate search results (CensysCert and CensysCertsResult).
    interface CensysCert {
      fingerprint: string;
      subject?: { commonName?: string; organization?: string };
      issuer?: { commonName?: string; organization?: string };
      validityStart?: string;
      validityEnd?: string;
      names: string[];
    }
    
    interface CensysCertsResult {
      total: number;
      certificates: CensysCert[];
      query: string;
    }
  • Generic HTTP helper for Censys API calls — handles auth headers, rate limiting, and JSON parsing.
    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();
    }
  • Tool included in the exported list of all tool definitions.
    censysCertificatesTool,

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full burden. It clearly indicates that the tool performs a search (read operation), lists the returned fields, and specifies authentication requirements. No contradictions or hidden behaviors are present; the description sufficiently discloses the tool's behavior.

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, consisting of two short sentences. The first sentence front-loads the primary purpose and output, and the second adds the authentication prerequisite. No wasted words.

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?

Given the tool's simplicity (2 parameters, no nested objects, no output schema), the description adequately covers the return values and authentication. It provides sufficient context for an agent to use the tool correctly, though it could optionally mention pagination limits beyond default.

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 input schema has 100% description coverage, providing clear meaning for both parameters. The tool description does not add any additional semantic value beyond what the schema already offers. Baseline score of 3 is appropriate as the schema handles parameter documentation 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?

The description clearly states the tool's action ('Search Censys certificate database') and explicitly lists the returned data fields (fingerprints, subjects, issuers, validity, SANs). It is specific about the resource (Censys certificate database) and distinguishes from sibling tools like crtsh_search by naming the provider and data elements.

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

Usage Guidelines2/5

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

The description mentions the requirement for CENSYS_API_ID and CENSYS_API_SECRET, which is helpful, but provides no guidance on when to use this tool versus alternative certificate search tools in the sibling list (e.g., crtsh_search). There is no when-not-to-use or comparative context.

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