Skip to main content
Glama
rosschurchill

Technitium MCP Secure

dns_block_domain

Block a domain on your DNS server to deny all queries to it. Specify the domain name to add it to the blocklist.

Instructions

Block a domain name. Queries to this domain will be denied by the DNS server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain name to block (e.g. ads.example.com)

Implementation Reference

  • Handler function for dns_block_domain. Takes a 'domain' argument, validates it using validateDomain(), calls the Technitium API endpoint '/api/blocked/add' via client.callOrThrow(), and returns a JSON response with success status and the blocked domain.
    handler: async (args) => {
      const domain = validateDomain(args.domain as string);
      const data = await client.callOrThrow("/api/blocked/add", {
        domain,
      });
      return JSON.stringify(
        { success: true, blocked: domain, ...data },
        null,
        2
      );
    },
  • Input schema for dns_block_domain. Defines a required 'domain' string parameter and provides a description. The tool is marked as not readonly (mutates state).
    inputSchema: {
      type: "object",
      properties: {
        domain: {
          type: "string",
          description: "Domain name to block (e.g. ads.example.com)",
        },
      },
      required: ["domain"],
    },
  • The getAllTools function aggregates all tool entries, including blockingTools(client) which contains dns_block_domain. This is called from the main server setup in src/index.ts.
    export function getAllTools(client: TechnitiumClient): ToolEntry[] {
      return [
        ...dashboardTools(client),
        ...dnsClientTools(client),
        ...zoneTools(client),
        ...recordTools(client),
        ...blockingTools(client),
        ...cacheTools(client),
        ...settingsTools(client),
        ...logTools(client),
        ...appTools(client),
        ...dnssecTools(client),
      ];
    }
  • src/index.ts:18-148 (registration)
    Main server entry point that loads tools via getAllTools(), filters by readonly mode, and registers them with the MCP server via CallToolRequestSchema handler which dispatches to the tool's handler.
    async function main(): Promise<void> {
      const config = loadConfig();
      const client = new TechnitiumClient(config);
      const allTools = getAllTools(client);
    
      // Filter out write tools in readonly mode
      const tools = config.readonly
        ? allTools.filter((t) => t.readonly)
        : allTools;
    
      if (config.readonly) {
        audit.logSecurity(
          "readonly_mode",
          `Exposing ${tools.length} of ${allTools.length} tools (write tools hidden)`
        );
      }
    
      const toolMap = new Map(tools.map((t) => [t.definition.name, t]));
      const rateLimiter = new RateLimiter();
    
      const server = new Server(
        { name: "technitium-mcp", version: VERSION },
        { capabilities: { tools: {} } }
      );
    
      server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: tools.map((t) => t.definition),
      }));
    
      server.setRequestHandler(CallToolRequestSchema, async (request) => {
        const { name, arguments: args } = request.params;
        const tool = toolMap.get(name);
    
        if (!tool) {
          return {
            content: [
              { type: "text" as const, text: JSON.stringify({ error: `Unknown tool: ${name}` }) },
            ],
            isError: true,
          };
        }
    
        // Rate limit check
        const rateCheck = rateLimiter.check(name);
        if (!rateCheck.allowed) {
          audit.logSecurity("rate_limited", `Tool ${name} rate limited`);
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({
                  error: "Rate limited",
                  retryAfterMs: rateCheck.retryAfterMs,
                }),
              },
            ],
            isError: true,
          };
        }
    
        const startTime = Date.now();
    
        try {
          const rawResult = await tool.handler((args || {}) as Record<string, unknown>);
    
          // Sanitize the response
          let sanitized: string;
          try {
            const parsed = JSON.parse(rawResult);
            sanitized = JSON.stringify(sanitizeResponse(parsed), null, 2);
          } catch {
            sanitized = rawResult;
          }
    
          audit.logToolCall(
            name,
            (args || {}) as Record<string, unknown>,
            "success",
            Date.now() - startTime
          );
    
          return {
            content: [{ type: "text" as const, text: sanitized }],
          };
        } catch (error) {
          const rawMessage = error instanceof Error ? error.message : String(error);
          const message = sanitizeError(rawMessage);
    
          audit.logToolCall(
            name,
            (args || {}) as Record<string, unknown>,
            "error",
            Date.now() - startTime,
            message
          );
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({ error: message }),
              },
            ],
            isError: true,
          };
        }
      });
    
      let shuttingDown = false;
      const shutdown = async (signal: string) => {
        if (shuttingDown) return;
        shuttingDown = true;
        audit.logShutdown(signal);
        client.clearToken();
        await server.close();
        process.exit(0);
      };
    
      process.on("SIGINT", () => shutdown("SIGINT"));
      process.on("SIGTERM", () => shutdown("SIGTERM"));
    
      const transport = new StdioServerTransport();
      audit.logStartup(VERSION, maskUrl(config.url));
      await server.connect(transport);
    }
    
    main().catch((error) => {
      const message = error instanceof Error ? error.message : String(error);
      audit.logSecurity("fatal_error", sanitizeError(message));
      process.exit(1);
    });
  • The validateDomain function used by the handler to sanitize and validate the domain name argument (trims, lowercases, checks length and regex pattern).
    export function validateDomain(domain: string): string {
      if (!domain || typeof domain !== "string") {
        throw new Error("Domain name is required");
      }
      const trimmed = domain.trim().toLowerCase();
      if (trimmed.length > 253) {
        throw new Error("Domain name exceeds maximum length of 253 characters");
      }
      if (!DOMAIN_RE.test(trimmed)) {
        throw new Error("Invalid domain name format");
      }
      return trimmed;
    }
  • Rate limiting configuration for dns_block_domain. It is grouped with other 'mutate' operations limited to 10 requests per 60-second window.
    for (const tool of [
      "dns_create_zone", "dns_add_record", "dns_update_record",
      "dns_block_domain", "dns_allow_domain",
      "dns_remove_allowed", "dns_remove_blocked", "dns_delete_cached",
      "dns_enable_zone", "dns_disable_zone", "dns_set_zone_options",
      "dns_set_settings", "dns_install_app",
    ]) {
      this.toolLimits.set(tool, mutateLimits);
    }
Behavior2/5

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

No annotations provided, so description carries full burden. It mentions denial of queries but omits persistence, reversibility, or subdomain impact. For a blocking action, key behavioral traits are missing.

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?

Extremely concise: two sentences with no redundant words. Every piece of information is purposeful.

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

Completeness3/5

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

Adequate for a simple single-parameter tool without output schema, but lacks context about the persistence and scope of blocking, especially given the large set of sibling tools.

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?

Schema coverage is 100%, and the description does not add any meaning beyond what the schema already provides for the 'domain' parameter.

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 action ('Block') and the resource ('domain name'), and specifies the effect ('Queries ... denied'). This distinguishes it from sibling tools like dns_allow_domain or dns_remove_blocked.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives such as dns_temp_disable_blocking or dns_flush_blocked. The description assumes the agent knows the context.

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/rosschurchill/technitium-mcp-secure'

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