Skip to main content
Glama

proxy_set_host_upstream

Override the global upstream proxy for a specific hostname. Traffic to that host will be routed through the assigned proxy instead.

Instructions

Set a per-host upstream proxy override. Traffic to this hostname will use the specified proxy instead of the global one.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostnameYesHostname to override (e.g., api.example.com)
proxy_urlYesUpstream proxy URL for this host
no_proxyNoHostnames to bypass this proxy

Implementation Reference

  • setHostUpstream method in ProxyManager — stores per-host proxy config and triggers mockttp rule rebuild if running.
    async setHostUpstream(hostname: string, config: UpstreamProxyConfig): Promise<void> {
      this.hostUpstreams.set(hostname, config);
      if (this._running) await this.rebuildMockttpRules();
    }
  • Tool registration for 'proxy_set_host_upstream' with Zod schema for hostname, proxy_url, and optional no_proxy.
    server.tool(
      "proxy_set_host_upstream",
      "Set a per-host upstream proxy override. Traffic to this hostname will use the specified proxy instead of the global one.",
      {
        hostname: z.string().describe("Hostname to override (e.g., api.example.com)"),
        proxy_url: z.string().describe("Upstream proxy URL for this host"),
        no_proxy: z.array(z.string()).optional().describe("Hostnames to bypass this proxy"),
      },
  • server.tool('proxy_set_host_upstream', ...) registers the tool on the MCP server, defining name, description, input schema, and handler.
    server.tool(
      "proxy_set_host_upstream",
      "Set a per-host upstream proxy override. Traffic to this hostname will use the specified proxy instead of the global one.",
      {
        hostname: z.string().describe("Hostname to override (e.g., api.example.com)"),
        proxy_url: z.string().describe("Upstream proxy URL for this host"),
        no_proxy: z.array(z.string()).optional().describe("Hostnames to bypass this proxy"),
      },
      async ({ hostname, proxy_url, no_proxy }) => {
        try {
          await proxyManager.setHostUpstream(hostname, { proxyUrl: proxy_url, noProxy: no_proxy });
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                status: "success",
                message: `Upstream for '${hostname}' set to ${proxy_url}`,
              }),
            }],
          };
        } catch (e) {
          return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: String(e) }) }] };
        }
      },
    );
  • src/index.ts:63-63 (registration)
    registerUpstreamTools(server) is called from the main entry point to register all upstream proxy tools including proxy_set_host_upstream.
    registerUpstreamTools(server);
  • resolveProxyConfig uses hostUpstreams map to match per-host proxy configs by hostname, falling back to global upstream.
    private resolveProxyConfig(): ProxyConfig {
      if (!this.globalUpstream && this.hostUpstreams.size === 0) return undefined;
    
      return ({ hostname }: { hostname: string }) => {
        const hostConfig = this.hostUpstreams.get(hostname);
        if (hostConfig) {
          return { proxyUrl: hostConfig.proxyUrl, noProxy: hostConfig.noProxy };
        }
        if (this.globalUpstream) {
          return { proxyUrl: this.globalUpstream.proxyUrl, noProxy: this.globalUpstream.noProxy };
        }
        return undefined;
      };
    }
Behavior3/5

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

No annotations are provided, so the description must cover behavioral traits. It explains the core behavior (override for a specific host), but omits details such as whether existing rules are overwritten, persistence, or side effects. The mention of no_proxy provides some context, but overall, the description is minimal for a mutation tool.

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 two sentences, front-loaded with the action, and contains no unnecessary words. Every sentence adds value.

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

Completeness4/5

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

Given the simplicity of the tool (3 params, no output schema, no annotations), the description explains the purpose and core behavior adequately. However, it could mention edge cases like overriding existing rules or how no_proxy interacts, but overall it is sufficient for a straightforward setter.

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?

The input schema has 100% description coverage for all three parameters. The description does not add additional meaning beyond what the schema already provides, so baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the verb 'Set' and the resource 'per-host upstream proxy override'. It differentiates from the global proxy by saying 'instead of the global one', which helps distinguish from sibling tools like 'proxy_set_upstream'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for per-host overrides and mentions the global proxy as an alternative, but does not explicitly state when not to use it or provide exclusion criteria for other sibling tools like 'proxy_remove_host_upstream'.

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

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