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
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.