Skip to main content
Glama

proxy_add_rule

Add interception rules to capture, modify, or mock HTTP/HTTPS traffic based on URL, method, headers, or body patterns.

Instructions

Add an interception rule with a matcher and handler. Rules are evaluated by priority (ascending), first match wins.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesHuman-readable description of this rule
priorityNoPriority (lower = higher priority, default: 100)
matcherYesConditions to match requests
handlerYesWhat to do with matched requests

Implementation Reference

  • The handler implementation for the proxy_add_rule tool, which calls proxyManager.addRule to add the interception rule.
    async ({ description, priority, matcher, handler }) => {
      try {
        const rule = await proxyManager.addRule({
          priority,
          enabled: true,
          description,
          matcher: matcher as RuleMatcher,
          handler: handler as RuleHandler,
        });
        return {
          content: [{
            type: "text",
            text: JSON.stringify({ status: "success", rule }),
          }],
        };
      } catch (e) {
        return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: String(e) }) }] };
      }
    },
  • The registration of the proxy_add_rule tool within the McpServer using server.tool.
    server.tool(
      "proxy_add_rule",
      "Add an interception rule with a matcher and handler. Rules are evaluated by priority (ascending), first match wins.",
      {
        description: z.string().describe("Human-readable description of this rule"),
        priority: z.number().optional().default(100).describe("Priority (lower = higher priority, default: 100)"),
        matcher: matcherSchema.describe("Conditions to match requests"),
        handler: handlerSchema.describe("What to do with matched requests"),
      },
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/yfe404/proxy-mcp'

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