nextdns-mcp

nextdns-mcp

Enables AI assistants to manage NextDNS profiles, settings, logs, analytics, and security configurations through 70+ operations via the Model Context Protocol.

Category
访问服务器

README

NextDNS MCP Server

A Model Context Protocol (MCP) server for the NextDNS API, built with FastMCP and generated from OpenAPI specifications.

Overview

This project provides an MCP server that exposes NextDNS API operations as tools that can be used by AI assistants and other MCP clients. The server is automatically generated from a comprehensive OpenAPI specification using the FastMCP library.

Features

  • 70+ NextDNS operations exposed as MCP tools
  • Profile Management: Full CRUD operations - create, read, update, and delete profiles
  • Profile Access Control: Fine-grained read/write restrictions per profile, with read-only mode support
  • DNS-over-HTTPS Testing: Perform DoH lookups to test DNS resolution through profiles
  • Settings Configuration: Comprehensive settings management including logs, block page, and performance
  • Logs: Query log retrieval and clearing
  • Analytics: Comprehensive DNS query analytics and statistics (11 endpoints)
  • Content Lists: Manage denylist, allowlist, and parental control
  • Security: Complete security settings and TLD blocking configuration
  • Privacy: Privacy settings, blocklists, and native tracking protection management
  • Parental Control: Settings management with safe search and YouTube restrictions
  • OpenAPI-Generated: Server automatically generated from nextdns-openapi.yaml
  • Docker MCP Gateway: Full integration with Docker's MCP Gateway for secure, isolated deployment
  • Docker Support: Containerized deployment with proper OCI labels
  • Safety Mechanisms: Write operation protections and validation

Documentation

Complete documentation can be found in docs/index.md.

Quick Start

Prerequisites

  • Python 3.12+
  • uv (for development)
  • Docker (for containerized deployment)
  • NextDNS API key (get one here)

Configuration

  1. Copy the .env.example file to .env:

    cp .env.example .env
    
  2. Edit .env and set your NextDNS API key:

    NEXTDNS_API_KEY=your_api_key_here
    NEXTDNS_DEFAULT_PROFILE=your_profile_id  # Optional
    NEXTDNS_TEST_PROFILE=test_profile_id     # For write operation tests
    
    # Optional: Profile access control (see Profile Access Control section)
    # NEXTDNS_READABLE_PROFILES=profile1,profile2
    # NEXTDNS_WRITABLE_PROFILES=test_profile
    # NEXTDNS_READ_ONLY=false
    

Running with Docker

  1. Build the Docker image:

    docker build -t nextdns-mcp:latest .
    
  2. Run the container with environment variables:

    Option A: Direct environment variables (simple)

    docker run -i --rm \
      -e NEXTDNS_API_KEY=your_api_key_here \
      -e NEXTDNS_DEFAULT_PROFILE=your_profile_id \
      nextdns-mcp:latest
    

    Option B: Docker secrets (recommended for production)

    # Create secret
    echo "your_api_key_here" | docker secret create nextdns_api_key -
    
    # Run with Docker Swarm
    docker service create \
      --name nextdns-mcp \
      --secret nextdns_api_key \
      -e NEXTDNS_API_KEY_FILE=/run/secrets/nextdns_api_key \
      nextdns-mcp:latest
    

    Or for non-swarm (using mounted file):

    # Create a secret file
    echo "your_api_key_here" > /tmp/api_key.txt
    chmod 600 /tmp/api_key.txt
    
    # Run with mounted secret
    docker run -i --rm \
      -v /tmp/api_key.txt:/run/secrets/nextdns_api_key:ro \
      -e NEXTDNS_API_KEY_FILE=/run/secrets/nextdns_api_key \
      nextdns-mcp:latest
    

    Option C: Environment file (development)

    docker run -i --rm \
      --env-file .env \
      nextdns-mcp:latest
    

    Note: MCP servers use stdio (standard input/output) for communication, not HTTP ports.

Running Locally (Development)

  1. Install dependencies:

    uv sync
    
  2. Run the server:

    uv run python -m nextdns_mcp.server
    

Architecture

This server uses a modern, declarative approach:

  1. OpenAPI Specification (nextdns-openapi.yaml): Complete NextDNS API documentation
  2. FastMCP Generation: Server automatically generated using FastMCP.from_openapi()
  3. HTTP Client: Authenticated httpx.AsyncClient for NextDNS API calls
  4. MCP Protocol: Tools, resources, and prompts exposed via Model Context Protocol

Key Components

  • src/nextdns_mcp/nextdns-openapi.yaml: OpenAPI 3.0 specification for NextDNS API
  • src/nextdns_mcp/server.py: FastMCP server implementation
  • catalog.yaml: Docker MCP Gateway catalog entry with server metadata
  • Dockerfile: Container definition with OCI labels for MCP Gateway
  • AGENT.md: Development guidelines and safety rules

Docker Tags

This project publishes official Docker images with a standardized tagging policy:

  • :latest: Floating tag that tracks the most recent successful build from the main branch. This tag is rebuilt on changes to main and via scheduled rebuilds.
  • :<major>: Floating tag for the most recent build in a given major series (e.g., :2). This tag is updated whenever a new image for that major line is published and may include unreleased changes if the corresponding build comes from a branch head.
  • :<major>.<minor>: Floating tag for the most recent build in a given minor series (e.g., :2.0). Like :<major>, it is updated when new images are built for that series and may include unreleased changes.
  • :<major>.<minor>.<patch>: Tags for specific application releases (e.g., :2.0.3). These are intended to be immutable once published via the release workflow.

All floating tags (:latest, :<major>, :<major>.<minor>) are rebuilt regularly to include the latest OS security updates and any application changes present in the source commit used for that build. Consumers who require strict version pinning should use the full :<major>.<minor>.<patch> tags.

License

This project is released under the MIT License.

Contributing

  1. See AGENT.md for guidelines and architecture
  2. Note that NextDNS does not provide an OpenAPI specification. This is based on their documentation and may not reflect the current state of the API.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选