Skip to main content
Glama
firesh

SSL Monitor MCP Server

by firesh

Get SSL cert info

get_ssl_cert_info

Retrieve SSL certificate details including validity periods, issuer information, and expiration dates for website security monitoring by specifying a domain and port.

Instructions

Get SSL certificate information for a host and port.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesThe domain to check SSL certificate for (e.g., www.sslmon.dev)
portNoPort number to check (default: 443)

Implementation Reference

  • Core handler function that performs TLS connection to the specified domain and port, retrieves the peer SSL certificate, extracts validity dates, issuer, subject, checks current validity, calculates days until expiry, and returns structured JSON info.
    private async checkSSLCertificate(domain: string, port: number = 443): Promise<any> {
      return new Promise((resolve) => {
        const options = {
          host: domain,
          port: port,
          servername: domain,
        };
    
        const socket = tls.connect(options, () => {
          const cert = socket.getPeerCertificate();
          
          if (!cert || Object.keys(cert).length === 0) {
            resolve({
              content: [
                {
                  type: "text",
                  text: `No SSL certificate found for ${domain}:${port}`,
                },
              ],
            });
            socket.end();
            return;
          }
    
          const validFrom = new Date(cert.valid_from);
          const validTo = new Date(cert.valid_to);
          const now = new Date();
          const isValid = now >= validFrom && now <= validTo;
          const daysUntilExpiry = Math.ceil((validTo.getTime() - now.getTime()) / (1000 * 60 * 60 * 24));
    
          const sslInfo: SSLInfo = {
            domain,
            validFrom: validFrom.toISOString(),
            validTo: validTo.toISOString(),
            issuer: cert.issuer?.CN || 'Unknown',
            subject: cert.subject?.CN || domain,
            isValid,
            daysUntilExpiry,
          };
    
          resolve({
            content: [
              {
                type: "text",
                text: JSON.stringify(sslInfo, null, 2),
              },
            ],
          });
    
          socket.end();
        });
    
        socket.on('error', (error) => {
          resolve({
            content: [
              {
                type: "text",
                text: `SSL connection failed for ${domain}:${port}: ${error.message}`,
              },
            ],
          });
        });
    
        socket.setTimeout(10000, () => {
          socket.destroy();
          resolve({
            content: [
              {
                type: "text",
                text: `SSL connection timeout for ${domain}:${port}`,
              },
            ],
          });
        });
      });
    }
  • src/index.ts:77-97 (registration)
    MCP tool registration, including title, description, Zod input schema for domain and port, and async handler that delegates to checkSSLCertificate with error handling.
    server.registerTool(
      "get_ssl_cert_info",
      {
        title: "Get SSL cert info",
        description: "Get SSL certificate information for a host and port.",
        inputSchema: {
          domain: z.string().describe("The domain to check SSL certificate for (e.g., www.sslmon.dev)"),
          port: z.number().int().positive().default(443).describe("Port number to check (default: 443)"),
        },
      },
      async ({ domain, port = 443 }) => {
        try {
          return await this.checkSSLCertificate(domain, port);
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true,
          };
        }
      }
    );
  • TypeScript interface defining the structure of the SSL certificate information returned by the tool.
      domain: string;
      validFrom: string;
      validTo: string;
      issuer: string;
      subject: string;
      isValid: boolean;
      daysUntilExpiry: number;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but fails to describe key behaviors such as network connectivity requirements, error handling, rate limits, or the format and content of the returned certificate information. This leaves significant gaps for an agent to understand operational constraints.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized for a simple tool, with no wasted information.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what certificate information is returned (e.g., issuer, expiry, validation status), potential errors, or dependencies like network access. For a tool that likely involves external queries and returns structured data, this omission reduces its usefulness for an agent.

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%, with both parameters ('domain' and 'port') well-documented in the schema. The description mentions 'host and port' but adds no additional meaning beyond what the schema provides, such as examples of valid domains or port usage beyond the default. This meets the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('Get SSL certificate information') and the target ('for a host and port'), which is specific and unambiguous. However, it doesn't explicitly differentiate from the sibling tool 'get_domain_info', which might provide overlapping or related information about domains.

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 provides no guidance on when to use this tool versus alternatives like 'get_domain_info'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage based solely on the tool name and parameters.

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/firesh/sslmon-mcp'

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