Skip to main content

MCP Server

Wirety embeds a Model Context Protocol (MCP) server directly in the main binary. It exposes Wirety's capabilities as AI-callable tools, letting Claude (or any MCP-compatible assistant) explore and manage your networks.

Endpoint

GET/POST /mcp

Transport: Streamable HTTP (MCP 2025-03-26 spec). The same server binary serves both the REST API and the MCP endpoint — no extra process needed.

Authentication

MCP uses the same API tokens as the REST API. Create one from your profile in the UI (Profile → API Tokens → New Token), then pass it as a header:

Authorization: Bearer wirety_<64-hex-chars>

Permissions are enforced per-token — an admin token can call admin-only tools; a regular user token cannot.

Available Tools

Users

ToolDescriptionAdmin only
get_current_userGet the authenticated user profileNo
list_usersList all usersYes

Networks

ToolDescriptionAdmin only
list_networksList accessible WireGuard networksNo
get_networkGet network details by IDNo
create_networkCreate a new networkYes
update_networkUpdate network name/DNSYes
delete_networkDelete a networkYes

Peers

ToolDescriptionAdmin only
list_peersList peers in a networkNo
get_peerGet peer detailsNo
create_peerCreate a new peerNo
update_peerRename a peerNo
delete_peerDelete a peerNo
get_peer_configGet WireGuard config file for a peerNo

Groups (requires DB)

ToolDescriptionAdmin only
list_groupsList groups in a networkNo
create_groupCreate a new groupYes
update_groupUpdate a group's name, description, or priorityYes

Policies (requires DB)

ToolDescriptionAdmin only
list_policiesList policies in a networkNo
create_policyCreate a new policy with rulesYes
update_policyUpdate a policy's name or descriptionYes

Routes (requires DB)

ToolDescriptionAdmin only
list_routesList routes in a networkNo
create_routeCreate a route (destination CIDR via jump peer)Yes
update_routeUpdate a route's configurationYes

Security Incidents

ToolDescriptionAdmin only
list_incidentsList all security incidentsNo
get_incidentGet incident detailsNo
resolve_incidentMark an incident as resolvedNo

Groups, policies, and routes tools are only registered when the database backend is enabled (DB_ENABLED=true).

Claude Code Setup

Add to ~/.claude/settings.json (user-level, all projects) or .mcp.json (project-level):

{
"mcpServers": {
"wirety": {
"type": "http",
"url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer wirety_<your-token>"
}
}
}
}

Claude Desktop Setup

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
"mcpServers": {
"wirety": {
"type": "http",
"url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer wirety_<your-token>"
}
}
}
}

Restart Claude Desktop after editing the config.

Troubleshooting

ProblemCauseFix
"not valid MCP server configurations" in Claude DesktopMissing "type": "http"Add "type": "http" to the server config
401 UnauthorizedInvalid or expired tokenRe-create the token in the UI
Tools missing (groups, policies, routes)DB not enabledSet DB_ENABLED=true and configure DB_DSN
MCP works via curl but not ClaudeWrong transportEnsure server was rebuilt after the Streamable HTTP migration