Skip to main content
Glama
mako10k

Web Proxy MCP Server

by mako10k

proxy_add_target

Add a new domain to monitor through the proxy server for traffic analysis, with options to capture headers and body data.

Instructions

Add a new target domain for proxy monitoring

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to monitor (e.g., example.com)
descriptionNoOptional description of the target
enabledNoWhether the target is active
captureHeadersNoCapture request/response headers
captureBodyNoCapture request/response body

Implementation Reference

  • Input schema definition for the proxy_add_target tool including domain (required), description, enabled, captureHeaders, and captureBody parameters.
    proxy_add_target: {
      name: "proxy_add_target",
      description: "Add a new target domain for proxy monitoring",
      inputSchema: {
        type: "object",
        properties: {
          domain: {
            type: "string",
            description: "Domain to monitor (e.g., example.com)"
          },
          description: {
            type: "string",
            description: "Optional description of the target"
          },
          enabled: {
            type: "boolean",
            description: "Whether the target is active",
            default: true
          },
          captureHeaders: {
            type: "boolean",
            description: "Capture request/response headers",
            default: true
          },
          captureBody: {
            type: "boolean",
            description: "Capture request/response body",
            default: false
          }
        },
        required: ["domain"]
      }
    },
  • Tool handler case statement that validates arguments, calls targetManager.addTarget, and formats success response with target stats.
    case 'proxy_add_target':
      const added = this.targetManager.addTarget(
        args.domain,
        args.description,
        {
          enabled: args.enabled,
          captureHeaders: args.captureHeaders,
          captureBody: args.captureBody
        }
      );
      return {
        content: [{
          type: "text",
          text: `Target added: ${args.domain}\nStatus: ${added ? 'success' : 'already exists'}\nMonitored domains: ${this.targetManager.getStats().enabled}`
        }]
      };
  • Core addTarget method in TargetManager: normalizes domain, applies defaults for config options, stores in Map, updates PAC file, logs, returns true.
    addTarget(domain, config = {}) {
      // Pre-conditions
      if (!domain || typeof domain !== 'string') {
        throw new Error('Domain is required and must be a string');
      }
    
      const targetConfig = {
        domain: domain.toLowerCase(),
        enabled: config.enabled !== false,
        includeSubdomains: config.includeSubdomains !== false,
        description: config.description || '',
        captureHeaders: config.captureHeaders !== false,  // Default to true
        captureBody: config.captureBody !== false,        // Default to true
        addedAt: new Date(),
        ...config
      };
    
      // Post-conditions: validate critical fields
      console.assert(typeof targetConfig.captureHeaders === 'boolean', 'captureHeaders must be boolean');
      console.assert(typeof targetConfig.captureBody === 'boolean', 'captureBody must be boolean');
      console.assert(typeof targetConfig.enabled === 'boolean', 'enabled must be boolean');
      
      this.targets.set(domain.toLowerCase(), targetConfig);
      this._updatePacFile();
      
      console.log(`✅ Target added: ${domain} (captureHeaders=${targetConfig.captureHeaders}, captureBody=${targetConfig.captureBody})`);
      
      return true;
    }
  • index.js:66-74 (registration)
    MCP ListToolsRequestHandler registration that dynamically exposes proxy_add_target schema from TOOLS object.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: Object.entries(TOOLS).map(([name, tool]) => ({
          name,
          description: tool.description,
          inputSchema: tool.inputSchema
        }))
      };
    });
  • index.js:77-99 (registration)
    MCP CallToolRequestHandler registration that routes tool calls by name to ToolHandlers.handleTool, enabling proxy_add_target execution.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      try {
        const result = await this.toolHandlers.handleTool(name, args || {});
    
        if (result.isError) {
          throw new McpError(
            ErrorCode.InternalError,
            result.error
          );
        }
    
        return result;
    
      } catch (error) {
        console.error(`Tool error [${name}]:`, error.message);
        throw new McpError(
          ErrorCode.InternalError,
          `Tool execution failed: ${error.message}`
        );
      }
    });

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