DNSPod MCP on Cloudflare Workers

DNSPod MCP on Cloudflare Workers

Enables remote MCP access to Tencent Cloud DNSPod DNS management through Cloudflare Workers, with OAuth authorization and support for domain and record operations.

Category
Visit Server

README

DNSPod MCP on Cloudflare Workers

License: MIT MCP Cloudflare Workers

腾讯云 DNSPod 变成可在线访问的 MCP(Model Context Protocol) 服务,跑在 Cloudflare Workers 上。

一条 Worker 同时提供:

  • Streamable HTTP / SSE MCP 端点(给 Grok、Claude、Cursor 等远程连接)
  • OAuth 2.1 + PKCE 授权(动态客户端注册、登录页、JWT Access Token)
  • 调用 DNSPod OpenAPI(域名 / 记录 / 解析量统计)

官方 mcp-server-dnspod 只支持本地 stdio。本项目把它变成 公网 HTTPS MCP,适合 Grok Connectors 等网页端。


为什么需要它?

方式 问题
官方 pip mcp-server-dnspod 仅 stdio,本地进程;网页端 Grok 连不上
直接把 Secret 塞进客户端 密钥泄露风险高,且很多客户端不支持 Bearer 字段
本项目 Workers 托管 + OAuth 弹窗登录 + 密钥只存在 Cloudflare Secrets

架构

Grok / Claude / Cursor
        │  HTTPS  MCP Streamable HTTP
        ▼
Cloudflare Worker  (dnspod-mcp)
  ├── /.well-known/oauth-authorization-server
  ├── /register          动态客户端注册
  ├── /authorize         登录页(OAUTH_PASSWORD)
  ├── /token             code + PKCE → JWT
  └── /mcp               需 Bearer access_token
            │
            │  TC3-HMAC-SHA256
            ▼
     DNSPod OpenAPI (dnspod.tencentcloudapi.com)

功能 / Tools

Tool 对应 API 说明
describe_domain_list DescribeDomainList 域名列表
create_domain CreateDomain 添加域名
describe_domain DescribeDomain 域名详情
describe_record_list DescribeRecordList 解析记录列表
create_record CreateRecord 新增记录(官方 MCP 没有)
modify_record ModifyRecord 修改记录
delete_record DeleteRecord 删除记录
describe_domain_analytics DescribeDomainAnalytics 域名解析量
describe_subdomain_analytics DescribeSubdomainAnalytics 子域名解析量

与官方 mcp-server-dnspod 对比:覆盖其主要查询能力,并额外支持记录增删改;官方的线路查询接口(DescribeRecordLineList 等)尚未接入。


快速部署

1. 准备

  • Cloudflare 账号
  • 腾讯云 API 密钥(SecretId / SecretKey)
  • Node.js ≥ 18

2. 克隆 & 安装

git clone https://github.com/zfx-t/dnspod-mcp-workers.git
cd dnspod-mcp-workers
npm install

3. 创建 KV(OAuth 存储)

npx wrangler kv namespace create dnspod-mcp-oauth

把返回的 id 填进 wrangler.toml[[kv_namespaces]]

4. 配置 Secrets

npx wrangler secret put TENCENTCLOUD_SECRET_ID
npx wrangler secret put TENCENTCLOUD_SECRET_KEY
npx wrangler secret put OAUTH_PASSWORD          # 授权页访问密码
npx wrangler secret put OAUTH_JWT_SECRET        # 随机长字符串

可选:TENCENTCLOUD_REGION(默认 ap-guangzhou,已在 wrangler.toml vars)。

5. 部署

npx wrangler deploy

得到类似:

https://dnspod-mcp.<your-subdomain>.workers.dev

自定义域名(可选):

# 在 Cloudflare Dashboard → Workers → dnspod-mcp → Triggers → Custom Domains
# 或使用 wrangler domains / 路由绑定

6. 本地开发

cp .env.example .dev.vars   # 填入真实密钥(勿提交)
npx wrangler dev

接入 Grok Connectors

  1. 打开 Grok → Connectors → Custom
  2. URL 只填:
https://<your-worker-host>/mcp
  1. 保存后触发连接 → 浏览器打开授权页
  2. 输入 OAUTH_PASSWORD → 授权
  3. 回到 Grok,即可调用 DNS 工具

Grok 不支持手填 Bearer 时,本项目的 OAuth 弹窗就是为此设计的。

其它客户端

任何支持 Remote MCP + OAuth 2.1(PKCE) 的客户端都可连接同一 URL。

手动调试:

# 元数据
curl https://<host>/.well-known/oauth-authorization-server

# 未授权应 401 + WWW-Authenticate
curl -i -X POST https://<host>/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

HTTP 路由一览

路径 说明
GET / 说明页
GET /health 健康检查
GET /.well-known/oauth-authorization-server OAuth AS 元数据
GET /.well-known/oauth-protected-resource Protected Resource 元数据
POST /register 动态客户端注册(RFC 7591)
GET/POST /authorize 授权码 + 密码登录
POST /token code / refresh → access_token
POST /mcp MCP Streamable HTTP(需 Bearer)
GET /sse 兼容 SSE 传输(需 Bearer)

安全说明

  • 腾讯云密钥 只存在 Cloudflare Secrets,不会出现在客户端配置里
  • OAuth 访问密码 仅在浏览器授权页输入,不写进 Connector
  • Access Token 默认 1 小时,Refresh Token 30 天
  • 建议:生产环境使用强随机 OAUTH_PASSWORD / OAUTH_JWT_SECRET,并限制腾讯云子账号仅 DNSPod 权限
  • 不要.dev.vars、真实 Secret 提交到 Git

与官方 DNSPod MCP 的关系

  • 官方包:pip install mcp-server-dnspod(stdio,适合 Claude Desktop 本地)
  • 本仓库:Cloudflare Workers 远程 MCP,OAuth 网关 + 部分写操作增强
  • API 签名:TC3-HMAC-SHA256,与腾讯云 OpenAPI 一致

开发

单文件 Worker,无运行时依赖:

src/index.js      # MCP + OAuth + DNSPod 客户端
wrangler.toml     # 部署配置

欢迎 PR:补齐线路查询工具、支持更多 DNSPod API、接入 Cloudflare Access 等。


License

MIT


致谢

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured