MCP Server¶
The NetBird Python Client includes a built-in Model Context Protocol (MCP) server that exposes 25 NetBird management tools to AI assistants like Claude Code and Claude Desktop.
This lets you manage your NetBird network through natural language — no scripting required.
Installation¶
The MCP server requires the optional mcp dependency:
pip install "netbird[mcp]"
Configuration¶
The server reads credentials from environment variables:
Variable |
Description |
|---|---|
|
NetBird API host (e.g. |
|
Personal Access Token from the NetBird dashboard |
Get your token from: NetBird Dashboard → Settings → API Tokens
Claude Code (CLI) Setup¶
Register the MCP server with claude mcp add:
claude mcp add netbird \
-e NETBIRD_HOST=api.netbird.io \
-e NETBIRD_API_TOKEN=your-api-token \
-- netbird-mcp
Restart Claude Code, then verify the server is connected:
claude mcp list
# Should show: netbird: netbird-mcp - ✓ Connected
For self-hosted NetBird:
claude mcp add netbird \
-e NETBIRD_HOST=netbird.yourcompany.com \
-e NETBIRD_API_TOKEN=your-api-token \
-- netbird-mcp
To remove:
claude mcp remove netbird
Claude Desktop Setup¶
Add the following to your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"netbird": {
"command": "netbird-mcp",
"env": {
"NETBIRD_HOST": "api.netbird.io",
"NETBIRD_API_TOKEN": "your-api-token"
}
}
}
}
Restart Claude Desktop after saving. You should see the hammer icon in the chat input confirming tools are loaded.
Self-Hosted NetBird¶
{
"mcpServers": {
"netbird": {
"command": "netbird-mcp",
"env": {
"NETBIRD_HOST": "netbird.yourcompany.com",
"NETBIRD_API_TOKEN": "your-api-token"
}
}
}
}
Running the Server Manually¶
NETBIRD_HOST=api.netbird.io NETBIRD_API_TOKEN=your-token netbird-mcp
Or using python -m:
python -m netbird.mcp.server
Available Tools¶
The server exposes 25 tools organized by resource:
Account¶
Tool |
Description |
|---|---|
|
Get the current NetBird account settings and configuration |
Users¶
Tool |
Description |
|---|---|
|
Get the currently authenticated user’s profile and permissions |
|
List all users in the NetBird account |
Peers¶
Tool |
Description |
|---|---|
|
List all peers with connection status and IP addresses |
|
Get details of a specific peer by ID |
|
Update a peer’s name, SSH access, or login expiration |
|
Remove a peer from the network |
|
List all peers a given peer can access based on current policies |
Groups¶
Tool |
Description |
|---|---|
|
List all peer groups with member counts |
|
Get details of a specific group including its members |
|
Create a new peer group with optional initial members |
|
Update a group’s name or member list |
|
Delete a peer group |
Policies¶
Tool |
Description |
|---|---|
|
List all access control policies with their rules |
|
Create a new policy with protocol, port, and direction control |
|
Delete an access control policy |
Networks¶
Tool |
Description |
|---|---|
|
List all networks with their resources and routers |
|
Get a network with its resources and routers included |
Setup Keys¶
Tool |
Description |
|---|---|
|
List all setup keys with validity and usage stats |
|
Create a setup key for enrolling new peers |
DNS¶
Tool |
Description |
|---|---|
|
List all DNS nameserver groups |
|
Get the global DNS settings for the account |
Posture Checks & Audit¶
Tool |
Description |
|---|---|
|
List all device posture checks (compliance policies) |
|
Get recent audit log events showing account activity |
Diagrams¶
Tool |
Description |
|---|---|
|
Generate a network topology diagram (Mermaid, Graphviz, or Diagrams) |
Example Conversations¶
Once connected to Claude Desktop, you can ask questions like:
"List all peers and show which ones are currently connected"
"Create a policy called 'SSH Access' allowing the DevOps group
to reach port 22 on the Servers group"
"Generate a Mermaid diagram of the current network topology"
"Create a reusable setup key called 'Office-Onboarding' that expires
in 7 days and auto-assigns peers to the Office group"
"Show me all audit events from the last 24 hours"
"Which peers can the peer named 'laptop-01' access?"