Skip to main content
Glama
NOTE

Not made by or affiliated with NextDNS. It uses the publicNextDNS API with your own API key.

Ask your AI app about your DNS in plain words. It looks at your stats and logs, and changes your blocklists, parental control and settings for you. Every change can be undone, and deleting things always asks you twice.

You: What got blocked on my phone today, and why?
AI:  Reads your NextDNS log: 214 blocked, mostly trackers from OISD, and one site
     from your denylist. Shows a chart.

You: My son's game doesn't load. Find out why and fix it.
AI:  Watches the live log while he opens it, sees roblox.com blocked by the
     "gaming" category, and asks if it should allow it on weekends only.

You: Block TikTok on the Kids profile, except Friday 6 to 9 pm.
AI:  Blocks TikTok and sets recreation time. Says how to undo it.

How it works

The server is a small program you run yourself. Your AI app talks to it through MCP (Model Context Protocol), the standard way AI apps use outside tools. The server talks to NextDNS through its official API, with your API key. Nobody else is in between: no account, no cloud service of ours, no tracking.

flowchart LR
    A["Your AI app<br/>(Claude, ChatGPT, Codex,<br/>Cursor, Gemini, ...)"] -->|MCP| S["NextDNS-Agent-MCP<br/>(on your computer or server)"]
    S -->|"API key"| N["NextDNS"]

More in docs/how-it-works.md.

Related MCP server: next-dns-mcp

Words you'll see

Word

What it means here

Profile

A NextDNS configuration (its lists, protections and settings). Devices use a profile through its address.

API key

The key that lets this server read and change your NextDNS account. It's at the bottom of my.nextdns.io/account.

Mode

What the AI may do with a profile: full (read and change), read (read only) or hidden.

Passphrase

A password you make up for the web version. It locks the settings page, and you type it once when you connect an AI app over the internet.

MCP

How AI apps plug into tools like this one.

Settings file

~/.config/nextdns-agent-mcp/.env on a computer. Hosting companies use their own "Variables" page instead.

Data folder

Where the server keeps its own files (change log, logins, backups): ~/.config/nextdns-agent-mcp/state on a computer, /data in Docker and on hosting companies.

Choose how to run it

Where it runs

Works on your phone

Cost

Guide

Claude Desktop extension

Your computer, inside Claude Desktop

No

Free

claude-desktop-extension.md

1. Your computer

Mac, Windows or Linux, for any AI app on it

Only with a tunnel

Free

setup-computer.md

2. A hosting company

Railway, Render or any host that runs Docker

Always

A few dollars a month

setup-hosting.md

3. Your own server

Any server with Docker

Always

Free to cheap

setup-own-server.md

TIP

Not sure? Start with1, free, on your computer. Move to 2 when you want it on your phone all the time.

Using an AI coding agent like Claude Code, Codex or Cursor? Ask it to set this up for you: AGENTS.md gives it a checklist.

What it can do

Look. Your profiles and every setting in plain words. Analytics: allowed and blocked, top domains, block reasons, devices, IPs, protocols, query types, DNSSEC, encryption, countries and big tech companies, for any time span and also over time. Charts as pictures. The query log, searched and filtered, or downloaded.

Find out why. check_domain makes a real DNS query through the profile and tells you if a domain is blocked, and by what: the denylist, a blocklist, a category. watch_logs watches queries live while you open an app.

Change. The denylist and allowlist (many at once), privacy blocklists and native tracker protection, every security protection and blocked TLDs, parental control (services, categories, safe search, YouTube restricted mode, recreation time), DNS rewrites, logs, block page and performance settings. Everything the NextDNS API allows.

Profiles. Create a profile (with NextDNS's usual protections, empty, or as a copy of another), compare two profiles, rename them.

Undo. Every change is saved with how things were before. Ask "undo that", or press Undo on the settings page.

Backups. Save a full copy of a profile, download it as a file, and put it back later, or make a new profile from it.

Ask twice. Deleting a profile, clearing logs and overwriting a profile from a backup need a double confirmation: the AI must ask you and get a yes first.

Updates, if you want them. Get told when there's a new release, or let it update itself, official releases only. See docs/updates.md.

A settings page. On the web version, open /settings to paste your API key, choose what the AI may do with each profile, see and disconnect AI apps, undo changes, and manage backups.

All 23 tools: docs/tools.md. Ideas for what to ask: docs/examples.md.

Safety and privacy

  • Your choice, per profile: full, read only or hidden. Hidden profiles are never shown to the AI.

  • Your choice, per app: each AI app connected over the internet gets only the profiles you tick, with or without changes.

  • Undo for every change, and a double confirmation for anything that deletes or overwrites.

  • A brake: at most 30 changes a minute, and a read-only switch for everything.

  • Your key stays yours: it goes only to NextDNS, and is stored encrypted when you paste it on the settings page.

More in docs/safety.md and docs/privacy.md.

Quick start (about 5 minutes)

  1. Install uv, a small free tool that installs Python programs.

  2. Install the server:

    uv tool install git+https://github.com/Self-hosted-MCP/NextDNS-Agent-MCP
  3. Get your API key: sign in at my.nextdns.io/account, scroll to the bottom (API), show the key and copy it.

  4. Save it in the settings file:

    mkdir -p ~/.config/nextdns-agent-mcp
    echo "NEXTDNS_API_KEY=paste-your-key-here" > ~/.config/nextdns-agent-mcp/.env
  5. Check it. It lists your profiles and changes nothing:

    nextdns-agent-mcp check
  6. Connect your AI app. For example Claude Code:

    claude mcp add -s user nextdns -- nextdns-agent-mcp stdio

    For Claude Desktop, ChatGPT, Codex, Cursor, VS Code, Gemini CLI, OpenClaw, Hermes Agent, Goose, Cline, Roo Code, Continue, Windsurf, Zed, LM Studio, OpenCode, Kiro, GitHub Copilot CLI, Amp, Warp, JetBrains AI Assistant, Qwen Code, Crush, Augment Code and any other MCP app, see docs/connect-your-ai.md.

  7. Ask your AI: "Use the NextDNS tools: what got blocked today?"

All the guides

Guide

Read it when

Claude Desktop extension

You use Claude Desktop and want one click

Setup on your computer

You want to try it, free, with any AI app

Setup on a hosting company

You want it on your phone, always on

Setup on your own server

You have a server with Docker

Connect your AI app

The server runs and you want to use it

Profiles and apps

You want to choose what the AI may see and change

Every tool

You want to know what it can do

Things to ask

You want ideas

Undo and backups

Something changed and you want it back

Every setting

You want to change modes, limits or ports

Safety

Before you let an AI change your DNS

Privacy

You want to know what is kept and where

How it works

You want to know how it works inside

Languages

You want the pages in your language

Updates

You want the newest version

Questions people ask

You have a quick question

Troubleshooting

Something doesn't work

Roadmap

You want to know what's planned

CHANGELOG.md

You want to know what changed in each version

CONTRIBUTING.md

You want to report a bug or send a fix

AGENTS.md

You (or your AI coding agent) want to change the code or set it up

Help and feedback

You want to

Go to

Fix a problem yourself

Troubleshooting

Report a bug

Something doesn't work

Ask a question or share an idea

Question

Report a security problem, privately

Private report (SECURITY.md)

Issues are public, so leave out your API key, profile IDs and anything from your logs.

Credits

NextDNS-Agent-MCP was made by Self-hosted MCP. NextDNS is a trademark of its owners; this project isn't made by or affiliated with them.

You're welcome to use, fork, change and build on it, also for money, under the Apache License 2.0 and the notices in NOTICE. In short:

  • Keep LICENSE, NOTICE and the copyright lines with every copy you share.

  • Mark the files you changed as changed.

  • Keeping the credit in the page footers ("NextDNS-Agent-MCP by Self-hosted MCP") is appreciated.

GitHub's "Cite this repository" button uses CITATION.cff.

License

Apache License 2.0, with the notices in NOTICE. Copyright 2026 s17sh70x2jfl031ag and NextDNS-Agent-MCP contributors.

Available Tools

23 tools
analyticsA
Read-only

Count a profile's DNS queries over a time span, one report at a time: allowed or blocked, top domains, block reasons, devices, IPs, protocols and more. Use chart for the same numbers as a picture, logs for single queries and watch_logs for queries happening now. Changes nothing. Returns one line per row with its count (counts over time with series), and a cursor line when there are more rows.

Inputs: root, limit, cursor, device, +9 more. Returns: result

backupA
Idempotent

Save a full copy of a profile (security, privacy, parental control, lists, rewrites and settings, not the logs) on this server, to put back later with restore_backup. Use it before big changes; single changes can already be undone with undo. Changes nothing in NextDNS, only writes the copy. Returns the backup ID and how many list entries it holds; backups lists all copies.

Inputs: note, profile. Returns: result

backupsA
Read-only

List the profile backups saved on this server, newest first: backup ID, time, profile and note. Use it to find the backup_id that restore_backup takes; use backup to make a new one and changes for the change log. Changes nothing, and says so when there are no backups yet.

Inputs: profile. Returns: result

catalogA
Read-only

List what NextDNS offers to pick from (privacy blocklists, native tracking protection, parental control services and categories, or top-level domains), with the IDs that privacy, security and parental_control take. Use it to find the right ID before a change; use profile to see what a profile already has on. Changes nothing. Returns how many matched and one line per item (blocklists also with size, update date and description).

Inputs: kind (required), limit, search. Returns: result

changesA
Read-only

List the changes made through this app, newest first: change ID, time, app, profile, what changed, and whether it was undone. Use it to find the ID undo takes, or to tell the user what was changed; changes made in the NextDNS dashboard don't show. Changes nothing. Only the newest 300 changes are kept.

Inputs: limit, profile. Returns: result

chartA
Read-only

Draw a profile's analytics as a PNG picture: lines over time (up to 6) or bars of the top rows (up to 20), for the same reports as analytics. Use it when the user wants to see a trend or a ranking; use analytics for exact numbers and more rows. Changes nothing. Returns a short text with the totals plus the image, or only a note when there were no queries in that time.

Inputs: limit, device, report, status, +6 more.

check_domainA
Read-only

Check whether a domain is blocked by a profile, and why: BLOCKED (with the reason), ALLOWED (with its addresses) or no such domain, plus any matching denylist or allowlist entry and the list_entries call that would change it. Use it when a site doesn't load or should be blocked; use logs or watch_logs for what devices really did. Changes no settings, but makes a real DNS query through the profile, which shows in its log and analytics, and takes a few seconds; a change made a moment ago may not show yet.

Inputs: domain (required), profile. Returns: result

clear_logsA
Destructive

DELETES every entry in a profile's query log, for good (no undo). Only when the user asked. Needs a double confirmation: the first call deletes nothing and gives a code; ask the user, and only after they say yes, call again with confirm_code.

Inputs: profile (required), confirm_code. Returns: result

compare_profilesA
Read-only

Compare two profiles and list every difference in security, privacy, parental control, denylist, allowlist, rewrites and settings (not the names), one line each. Use it to see how two profiles differ or to check a copy made with create_profile; use profile to read one profile in full. Changes nothing. Says so when both have the same settings and lists.

Inputs: first (required), second (required). Returns: result

create_profileA

Make a new NextDNS profile (for another device, a child, a guest network, ...). This app may change the profiles it makes. copy_from: an existing profile (ID or name) to copy every setting and list from. start (without copy_from): recommended (the usual protections and NextDNS's recommended blocklist) or empty (everything off).

Inputs: name (required), start, copy_from. Returns: result

delete_profileA
Destructive

DELETES a whole profile and its logs. Devices using it stop being filtered. Only when the user asked. Needs a double confirmation: the first call deletes nothing and gives a code; ask the user, and only after they say yes, call again with confirm_code. undo can make a new profile with the same settings and lists, but with a new ID (devices must be set up again), and the logs are gone for good.

Inputs: profile (required), confirm_code. Returns: result

list_entriesA
Idempotent

Add, remove, turn on or turn off domains in a profile's denylist (always blocked) or allowlist (never blocked); a domain also covers its subdomains. Use it for single domains; use parental_control for whole apps or categories, privacy for blocklists, and check_domain first to see why a domain is blocked. Changes the profile within seconds and records it, so undo can put it back. Returns what was done, what was skipped (already there, not there) or failed (not a domain), and the change ID.

Inputs: action (required), domains (required), list_name (required), profile. Returns: result

logsA
Read-only

Search a profile's query log: single DNS queries, newest first, one line each with time (UTC), status, domain, device and block reason. Use it to see what a device looked up or why something was blocked earlier; use watch_logs for queries happening now, analytics for totals and check_domain to test one domain. Changes nothing. Returns a cursor line when there is more, or a private link to download the whole log with download_link; empty when logs are off for the profile.

Inputs: raw, limit, cursor, device, +7 more. Returns: result

parental_controlA
Idempotent

Change a profile's parental control: block, unblock, pause or resume apps and sites (services) and categories, set recreation time (the hours when chosen ones are allowed), and switch safe search, YouTube restricted mode and bypass blocking. Take the IDs from catalog (kind services or categories); use list_entries for single domains. Changes the profile and records it, so undo can put it back; unknown IDs or times are refused, and anything already set is skipped. Returns what changed, the change ID and the parental control settings after.

Inputs: pause, resume, profile, safe_search, +10 more. Returns: result

privacyA
Idempotent

Turn a profile's privacy blocklists and native tracking protection on or off, and set its disguised trackers and affiliate links switches. Take the IDs from catalog (kind blocklists or natives); use security for threat protection, parental_control for apps and categories, list_entries for single domains. Changes the profile and records it, so undo can put it back; unknown IDs are refused with close matches, and ones already on or off are skipped. Returns what changed, the change ID and the privacy settings after.

Inputs: profile, add_natives, add_blocklists, remove_natives, +3 more. Returns: result

profileA
Read-only

Show one profile's configuration as text: security, privacy, parental control, denylist, allowlist, rewrites, settings and setup (the DNS addresses devices use). Use it to see how a profile is set up before changing it; use compare_profiles to set two side by side and check_domain to know if one domain is blocked. Changes nothing. Without section, long lists are cut short; an unknown section is refused with the valid ones.

Inputs: profile, section. Returns: result

profilesA
Read-only

List the NextDNS profiles this app may use: each one's name, ID and mode (read and change, or read only), and which is the default. Call it first, to learn the names or IDs the other tools take; hidden profiles never show. Changes nothing: use profile to see one profile's settings.

Inputs: no named parameters. Returns: result

profile_settingsA
Idempotent

Change a profile's general settings: its name, query logs (on or off, how long, where, what to leave out), the block page, performance (ECS, cache boost, CNAME flattening) and Web3 domains. Use profile(section='settings') to see them first; protections are in security, privacy and parental_control. Changes only the inputs given and records it, so undo can put it back; an unknown retention or location is refused. Returns the settings after the change, or says nothing changed.

Inputs: ecs, logs, web3, rename, +8 more. Returns: result

restore_backupA
Destructive

Put a saved backup back, either as a new profile (new_profile_name, overwrites nothing) or over an existing one (by default the profile it was taken from); take the ID from backups. Overwriting asks twice: the first call changes nothing and gives a code; ask the user, and only after they say yes, call again with confirm_code. Either way it's recorded, so undo can reverse it (undoing a new profile deletes it). Returns what was restored, any parts that didn't come back, and the change ID.

Inputs: backup_id (required), profile, confirm_code, new_profile_name. Returns: result

rewritesA
Idempotent

Add or remove a DNS rewrite on a profile: a domain that answers with your own IP address or another domain, like nas.home for a home server. Use profile(section='rewrites') to see the current ones; use list_entries to block or allow a domain instead. Changes the profile and records it, so undo can put it back; adding one that exists or removing one that doesn't changes nothing, and removing without content removes every rewrite for that name. Returns what was done and the change ID.

Inputs: name (required), action (required), content, profile. Returns: result

securityA
Idempotent

Turn a profile's security protections on or off (threat feeds, AI threat detection, Google Safe Browsing, cryptojacking, typosquatting, newly registered domains and more) and block or unblock whole top-level domains. profile(section='security') shows the switches with their keys and catalog(kind='tlds') the TLD IDs; use privacy for blocklists and list_entries for single domains. Changes the profile and records it, so undo can put it back; unknown keys or TLDs are refused, and ones already set are skipped. Returns what changed and the change ID.

Inputs: profile, turn_on, turn_off, block_tlds, +1 more. Returns: result

undoA
Destructive

Put a profile back the way it was before one change (IDs from changes). Only when the user asked. If the profile was changed again since (in the NextDNS dashboard or by a later change), undo stops and says what differs; force=true puts the old state back anyway, which also drops those later changes. Undoing the creation of a profile deletes it, so it needs a double confirmation like delete_profile: the first call gives a code, and only after the user says yes, call again with confirm_code.

Inputs: change_id (required), force, confirm_code. Returns: result

watch_logsA
Read-only

Watch a profile's DNS queries live for 5 to 120 seconds, for example while the user opens an app ("open TikTok now"), then list what came in, one line each with time, status, domain, device and reason, and how many were blocked. Use logs for past queries and analytics for totals. Changes nothing, but the call waits the whole time; logs must be on for the profile, or nothing comes in.

Inputs: raw, device, search, status, +2 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 23 tools

    Disambiguation5/5

    Descriptions draw explicit boundaries between overlapping areas: profile/profiles/compare_profiles for inspection, analytics/chart/logs/watch_logs for reporting, and section-specific mutation tools such as privacy, security, parental_control, list_entries, rewrites, and profile_settings. Despite the large set, an agent can select correctly from the stated purpose and cross-references.

    Naming Consistency4/5

    All names use snake_case, and read tools generally use nouns while actions use verb_noun; singular/plural pairs such as profile/profiles and backup/backups are consistent. However, section mutation tools are noun-only rather than verb_noun, so the pattern is mostly rather than fully uniform.

    Tool Count3/5

    23 tools is above the ideal 3-15 range and feels heavy, even though most tools cover genuinely distinct NextDNS operations. Some consolidation or grouping, such as backup/backups, profile/profiles, or multiple reporting tools, would improve scoping.

    Completeness5/5

    The surface covers profile lifecycle, all major configuration sections, domain checks, analytics, logs, live logs, charts, audit/undo, and backup/restore. Only peripheral gaps such as backup deletion or default-profile management are apparent, not core workflow dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      B
      maintenance
      Enables AI assistants to manage NextDNS profiles, settings, logs, analytics, and security configurations through 70+ operations via the Model Context Protocol.
      8
      15
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables Claude to read and manage a DNS server on the user's own machine through its HTTP API, covering stats, settings, zones, logs, users, ad blocking, cache flushing, and DNS records. Every call carries a safety level, so read actions run immediately while changes and destructive operations require explicit confirmation, with credentials kept local and downloads written to disk rather than chat.
      12
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI assistants to manage DNS filtering accounts by blocking or allowing domains, checking policies, reviewing blocked queries, and managing filter categories, schedules, and devices through natural language.
      16
      50 npm
      1
      MIT