Skip to main content
Glama
mako10k

Web Proxy MCP Server

by mako10k

proxy_get_pac_file

Retrieve the current Proxy Auto-Configuration (PAC) file content to configure browser proxy settings for automated web traffic monitoring and analysis.

Instructions

Get the current PAC (Proxy Auto-Configuration) file content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
proxyHostNoProxy server hostlocalhost
proxyPortNoProxy server port

Implementation Reference

  • The main handler logic for the proxy_get_pac_file tool. It calls targetManager.generatePacFile to generate the PAC content and returns it formatted as a text response with syntax highlighting.
    case 'proxy_get_pac_file':
      const pacContent = this.targetManager.generatePacFile(
        args.proxyHost,
        args.proxyPort
      );
      
      return {
        content: [{
          type: "text",
          text: `📄 PAC File Content:\n\n\`\`\`javascript\n${pacContent}\n\`\`\``
        }]
      };
  • Tool schema definition including name, description, and input validation schema for proxyHost and proxyPort parameters.
    proxy_get_pac_file: {
      name: "proxy_get_pac_file",
      description: "Get the current PAC (Proxy Auto-Configuration) file content",
      inputSchema: {
        type: "object",
        properties: {
          proxyHost: {
            type: "string",
            description: "Proxy server host",
            default: "localhost"
          },
          proxyPort: {
            type: "number",
            description: "Proxy server port",
            default: 8080
          }
        }
      }
    },
  • Supporting utility function that generates the actual PAC file JavaScript content based on currently enabled proxy targets, handling subdomains and formatting the proxy rules.
      generatePacFile(proxyHost = 'localhost', proxyPort = 8080) {
        const enabledTargets = Array.from(this.targets.values())
          .filter(target => target.enabled);
    
        const domainChecks = enabledTargets.map(target => {
          if (target.includeSubdomains) {
            return `    if (host === "${target.domain}" || host.endsWith(".${target.domain}")) return "PROXY ${proxyHost}:${proxyPort}";`;
          } else {
            return `    if (host === "${target.domain}") return "PROXY ${proxyHost}:${proxyPort}";`;
          }
        }).join('\n');
    
        return `function FindProxyForURL(url, host) {
        host = host.toLowerCase();
        
        // Proxy specific domains through our proxy server
    ${domainChecks}
        
        // All other traffic goes direct
        return "DIRECT";
    }
    
    // Generated by Web Proxy MCP Server
    // Last updated: ${new Date().toISOString()}
    // Active targets: ${enabledTargets.length}`;
      }

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