Skip to main content
Glama
anhhung04

DNSDumpster MCP Server

by anhhung04

get_mx_records

Retrieve MX records for a domain to identify mail server configurations and verify email delivery infrastructure.

Instructions

Get MX (mail) records for a domain.

Args: domain: The domain name to query (e.g., example.com) ctx: Request context

Returns: Formatted string containing MX records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes

Implementation Reference

  • The handler function decorated with @mcp.tool() implements the get_mx_records tool. It validates the domain, uses DNSDumpsterClient to fetch DNS records, extracts MX records with IP details, and formats them into a readable string.
    @mcp.tool() async def get_mx_records(domain: str, ctx: Context) -> str: """Get MX (mail) records for a domain. Args: domain: The domain name to query (e.g., example.com) ctx: Request context Returns: Formatted string containing MX records """ if not domain: return "Error: Domain is required" # Validate domain if not is_valid_domain(domain): return "Error: Invalid domain name format" try: api_key = os.environ.get("DNSDUMPSTER_API_KEY") if not api_key: return "Error: API key not configured. Set DNSDUMPSTER_API_KEY environment variable." client = DNSDumpsterClient(api_key) try: ctx.info(f"Querying MX records for {domain}") result = await client.get_dns_records(domain) if "mx" not in result or not result["mx"]: return f"No MX records found for {domain}" output_lines = [f"MX Records for {domain}:"] for record in result["mx"]: host = record.get("host", "") priority = record.get("priority", "") priority_str = f" (Priority: {priority})" if priority else "" output_lines.append(f"\nHost: {host}{priority_str}") for ip_info in record.get("ips", []): ip = ip_info.get("ip", "") country = ip_info.get("country", "Unknown") asn = ip_info.get("asn", "") asn_name = ip_info.get("asn_name", "") output_lines.append(f" IP: {ip}") output_lines.append(f" Country: {country}") if asn: output_lines.append(f" ASN: {asn}") if asn_name: output_lines.append(f" ASN Name: {asn_name}") return "\n".join(output_lines) finally: await client.close() except Exception as e: return f"Error: {str(e)}"

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/anhhung04/mcp-dnsdumpster'

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