Skip to main content
Glama
glucn

MCP DNS

dns-query

Query DNS records for domain names to retrieve information like IP addresses, mail servers, and text records using the MCP DNS server.

Instructions

Make a DNS query for a given name and type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe domain name to query
typeYesThe DNS record type (A, AAAA, MX, TXT, CNAME, NS, etc.)

Implementation Reference

  • The handler function that performs the DNS query using Node.js dns/promises Resolver, resolves the records for the given name and type, and returns a structured text response with JSON-formatted results.
    async ({ name, type }) => {
      if (!name || !type) {
        // TODO: Validate inputs
      }
      const resolver = new dns.Resolver();
    
      const records = await resolver.resolve(name, type);
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              domain: name,
              type: type,
              records: records,
            }),
          },
        ],
      };
    }
  • Zod schema defining the input parameters: 'name' (domain) and 'type' (DNS record type).
    {
      name: z.string().describe("The domain name to query"),
      type: z
        .string()
        .describe("The DNS record type (A, AAAA, MX, TXT, CNAME, NS, etc.)"),
    },
  • src/server.ts:16-46 (registration)
    Registration of the 'dns-query' tool using McpServer.tool(), including description, input schema, and inline handler function.
    server.tool(
      "dns-query",
      "Make a DNS query for a given name and type",
      {
        name: z.string().describe("The domain name to query"),
        type: z
          .string()
          .describe("The DNS record type (A, AAAA, MX, TXT, CNAME, NS, etc.)"),
      },
      async ({ name, type }) => {
        if (!name || !type) {
          // TODO: Validate inputs
        }
        const resolver = new dns.Resolver();
    
        const records = await resolver.resolve(name, type);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                domain: name,
                type: type,
                records: records,
              }),
            },
          ],
        };
      }
    );
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/glucn/mcp-dns'

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