defined-mcp
An MCP server that enables AI agents to manage Defined Networking / Managed Nebula infrastructure, supporting tasks like network topology design, host provisioning, and security auditing through natural language.
README
Defined Networking MCP Server
An MCP (Model Context Protocol) server that lets AI coding and DevOps agents manage Defined Networking / Managed Nebula infrastructure.
Use it with Codex, Claude Code, Copilot CLI, VS Code, and other MCP-compatible development tools.
What This Does
Use this server to let an agent inspect and manage Defined Networking infrastructure without hand-writing API calls. It supports common workflows such as:
- designing a Nebula network topology
- provisioning hosts and enrollment codes
- managing roles, firewall rules, tags, routes, and network settings
- auditing configuration and administrative activity
- troubleshooting host connectivity and dnclient state
Quick Start
Install the server:
nvm use
npm install
npm run build
Add it to your MCP client:
{
"mcpServers": {
"defined-nebula": {
"command": "node",
"args": ["/path/to/defined-mcp/dist/index.js"],
"env": {
"DEFINED_API_KEY": "your-api-key-here"
}
}
}
}
For tools that support managed secrets or environment variables, store DEFINED_API_KEY there instead of writing it directly into a config file.
Ask your agent to inspect the account:
"List my Defined Networking networks and summarize the hosts, roles, routes, and tags."
Setup
Prerequisites
- Node.js 24 LTS (
24.16.0or newer within the Node 24 line) - A Defined Networking account with an API key
This repo includes .nvmrc and .node-version set to Node 24.16.0. npm also uses engine-strict=true, so installs fail on unsupported Node versions instead of silently using an EOL runtime.
Get an API Key
- Go to admin.defined.net/settings/api-keys
- Create a new API key with the scopes you need:
networks:read— List and view networkshosts:create— Create hostshosts:read— List and view hostshosts:update— Update hostshosts:delete— Delete hostshosts:enroll— Generate enrollment codeshosts:block— Block/unblock hostsroles:create,roles:read,roles:update,roles:delete— Manage rolestags:create,tags:read,tags:update,tags:delete— Manage tagsroutes:create,routes:read,routes:delete— Manage routesauditLogs:list— View audit logs
Do not paste API keys directly into shell commands. Prefer an MCP client secret store, a local environment file that is excluded from git, or your shell's secure environment management.
For local development, create an ignored .env.local file:
DEFINED_API_KEY=your-api-key-here
Then load it for the current shell session before running live checks. The command itself does not contain the secret, so it will not be written to shell history:
set -a
. ./.env.local
set +a
npm run test:live
Install From npm
npm install @defined-net/mcp-server
Clone and Build
git clone https://github.com/geoffbelknap/defined-mcp.git
cd defined-mcp
npm install
npm run build
MCP Client Configuration
Use this shape for MCP clients that accept JSON server configuration:
{
"mcpServers": {
"defined-nebula": {
"command": "node",
"args": ["/path/to/defined-mcp/dist/index.js"],
"env": {
"DEFINED_API_KEY": "your-api-key-here"
}
}
}
}
If you installed the package globally, use "command": "defined-mcp" and omit args.
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
DEFINED_API_KEY |
Yes | — | Your Defined Networking API key |
DEFINED_API_URL |
No | https://api.defined.net |
API base URL (for custom deployments) |
Tool Behavior
- Tools return structured results with operation names, resource IDs, side effects, warnings, and API error details.
- Mutating tools execute when called. Pass
dryRun: truewhen you want the server to return a preview plan instead. - Enrollment-code tools can return credential material. Treat their results like secrets.
Capabilities
The MCP targets the current non-deprecated Defined Networking API surface from the official OpenAPI description, including hosts, roles, routes, tags, audit logs, networks, and downloads. Deprecated v1 endpoints are intentionally omitted when a current replacement exists.
Tools
Network Management
list-networks— List all Nebula overlay networksget-network— Get detailed network informationupdate-network— Update network name, description, and lighthouse relay behaviordelete-network— Delete an empty networkadd-network-cidr— Add an IPv4 CIDR to an IPv6-only network
Host Management
list-hosts— List hosts with filtering (by network, role, type, status)get-host— Get host detailscreate-host— Create a new host (lighthouse, relay, or regular)update-host— Update host configurationdelete-host— Remove a host from the networkblock-host— Block a host (revoke network access)unblock-host— Restore a blocked hostdebug-host— Send host debug commands such as log streaming, tunnel inspection, certificate inspection, lighthouse queries, and stack traces
Enrollment
create-host-and-enrollment-code— Create a host + enrollment code in one stepcreate-enrollment-code— Generate enrollment code for existing host
Roles & Firewall
list-roles— List all rolesget-role— Get role details with firewall rulescreate-role— Create a new roleupdate-role— Update role configurationdelete-role— Remove a roleget-firewall-rules— Get inbound firewall rules for a roleupdate-firewall-rules— Replace firewall rules for a role (supports role-based and tag-based rules)
Tags
list-tags— List all tags (key:value pairs for fine-grained access control)get-tag— Get tag detailscreate-tag— Create a new tag (e.g.env:production,region:us-east)update-tag— Update a tagdelete-tag— Remove a tag
Routes (Unsafe Routes)
list-routes— List routes extending access to non-overlay subnetsget-route— Get route detailscreate-route— Create a route through a gateway hostupdate-route— Update route name, router host, routable CIDRs, and firewall rulesdelete-route— Remove a route
Audit & Compliance
list-audit-logs— Search audit logs by target
Downloads
list-downloads— List available DNClient software downloads for all platforms
Resources
nebula://networks/{networkID}— Network configuration datanebula://hosts/{hostID}— Host configuration datanebula://roles/{roleID}— Role and firewall rule data
Prompts
design-network— Interactive network topology designprovision-host— Step-by-step host provisioning guideaudit-security— Security posture audittroubleshoot-connectivity— Debug connectivity between hosts
Usage Examples
Design a Network
"Design a Nebula overlay network for my development team of 15 engineers with separate roles for web servers, databases, and developer endpoints."
The agent will use the design-network prompt to plan the topology, then execute the creation using the tools.
Provision a Host
"Add a new lighthouse named 'us-east-lighthouse' to my network with static address 203.0.113.1:4242"
Security Audit
"Audit the security posture of my Nebula network. Check for overly permissive firewall rules and blocked hosts."
Troubleshoot
"I can't connect from host-ABC to host-XYZ on port 443. Help me figure out why."
Architecture
┌─────────────────────────────────────────────────┐
│ AI Agent (Codex / Claude Code / VS Code / etc.)│
├─────────────────────────────────────────────────┤
│ MCP Protocol (stdio / JSON-RPC 2.0) │
├─────────────────────────────────────────────────┤
│ defined-nebula MCP Server │
│ ┌─────────┐ ┌──────────┐ ┌───────────┐ │
│ │ Tools │ │Resources │ │ Prompts │ │
│ └────┬────┘ └────┬─────┘ └───────────┘ │
│ │ │ │
│ ┌────┴───────────┴────┐ │
│ │ Defined API Client │ │
│ └──────────┬──────────┘ │
├─────────────┼───────────────────────────────────┤
│ HTTPS + Bearer Token │
├─────────────┼───────────────────────────────────┤
│ Defined Networking API (api.defined.net) │
├─────────────┼───────────────────────────────────┤
│ Nebula Overlay Network │
│ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │
│ │ L │ │ H │ │ H │ │ R │ │ H │ │
│ └───┘ └───┘ └───┘ └───┘ └───┘ │
│ L=Lighthouse H=Host R=Relay │
└─────────────────────────────────────────────────┘
Development
nvm use
npm install
npm run dev # Watch mode
npm run build # Production build
npm start # Run the server
Tests and Security Checks
npm test # Build and run non-mutating dry-run smoke tests
npm run test:live # Run read-only live API checks plus dry-run mutation checks
npm run security:audit
npm run test:live requires DEFINED_API_KEY. It performs read-only API calls and explicit dry-run mutation checks only.
The default npm test target is safe for CI environments without real Defined credentials because it uses dry-run mutation plans and a placeholder API key.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。