Skip to main content
Glama
mako10k

Web Proxy MCP Server

by mako10k

ssl_generate_certificate

Generate SSL/TLS certificates for domains to enable HTTPS connections through the Web Proxy MCP Server for secure traffic monitoring and analysis.

Instructions

Generate server certificate for specific domain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain name for the certificate
altNamesNoAlternative domain names (SAN)

Implementation Reference

  • The MCP tool handler for 'ssl_generate_certificate'. Validates arguments, calls SSLManager.generateServerCertificate(domain, altNames), and returns formatted response with certificate paths.
    case 'ssl_generate_certificate': const certResult = await this.sslManager.generateServerCertificate( args.domain, args.altNames ); return { content: [{ type: "text", text: `šŸ“œ Generated certificate for: ${certResult.domain}\n\nšŸ”‘ Private Key: ${certResult.keyPath}\nšŸ“„ Certificate: ${certResult.certPath}\nšŸ·ļø Alt Names: ${certResult.altNames.join(', ')}` }] };
  • JSON Schema definition for the 'ssl_generate_certificate' tool input, specifying required 'domain' parameter and optional 'altNames' array.
    ssl_generate_certificate: { name: "ssl_generate_certificate", description: "Generate server certificate for specific domain", inputSchema: { type: "object", properties: { domain: { type: "string", description: "Domain name for the certificate" }, altNames: { type: "array", items: { type: "string" }, description: "Alternative domain names (SAN)", default: [] } }, required: ["domain"] } },
  • index.js:66-74 (registration)
    MCP server registration of all tools via ListToolsRequestSchema handler, which exposes 'ssl_generate_certificate' using the TOOLS definitions including name, description, and inputSchema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: Object.entries(TOOLS).map(([name, tool]) => ({ name, description: tool.description, inputSchema: tool.inputSchema })) }; });
  • Core implementation of certificate generation in SSLManager class. Uses OpenSSL commands via execSync to generate private key, CSR with SAN, sign with CA, and return paths. Called by the tool handler.
    async generateServerCertificate(domain, altNames = []) { if (!this.initialized) { await this.initialize(); } const caExists = await this._checkCAExists(); if (!caExists) { throw new Error(`CA '${this.currentCA}' does not exist. Create CA first.`); } console.log(`šŸ” Generating certificate for: ${domain}`); const certDir = path.join(this.caDir, 'certs'); await fs.mkdir(certDir, { recursive: true }); const sanitizedDomain = domain.replace(/[^a-zA-Z0-9.-]/g, '_'); const keyPath = path.join(certDir, `${sanitizedDomain}.key`); const csrPath = path.join(certDir, `${sanitizedDomain}.csr`); const certPath = path.join(certDir, `${sanitizedDomain}.crt`); // Generate server private key const keyGenCmd = `openssl genrsa -out "${keyPath}" 2048`; this._executeSSLCommand(keyGenCmd); // Generate certificate config with SAN const certConfig = this._generateServerCertConfig(domain, altNames); const certConfigPath = path.join(certDir, `${sanitizedDomain}.conf`); await fs.writeFile(certConfigPath, certConfig); // Generate CSR const csrCmd = `openssl req -new -key "${keyPath}" -out "${csrPath}" -config "${certConfigPath}"`; this._executeSSLCommand(csrCmd); // Sign certificate with CA const caKeyPath = path.join(this.caDir, 'ca.key'); const caCertPath = path.join(this.caDir, 'ca.crt'); const signCmd = `openssl x509 -req -in "${csrPath}" -CA "${caCertPath}" -CAkey "${caKeyPath}" -CAcreateserial -out "${certPath}" -days 365 -extensions v3_req -extfile "${certConfigPath}"`; this._executeSSLCommand(signCmd); // Clean up CSR await fs.unlink(csrPath); await fs.unlink(certConfigPath); console.log(`āœ… Certificate generated for ${domain}`); return { domain, keyPath, certPath, altNames }; }

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/mako10k/mcp-web-proxy'

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