Skip to content

feat: add full CRUD for all Netbird API resources#5

Open
ZILosoft wants to merge 1 commit into
aantti:mainfrom
ZILosoft:main
Open

feat: add full CRUD for all Netbird API resources#5
ZILosoft wants to merge 1 commit into
aantti:mainfrom
ZILosoft:main

Conversation

@ZILosoft
Copy link
Copy Markdown

Summary

This PR extends the MCP server from read-only list operations to full CRUD coverage across all major Netbird API resources.

New HTTP methods on NetbirdClient

  • Post(ctx, path, body, v) — for create operations
  • Delete(ctx, path) — for delete operations
  • Patch(ctx, path, body, v) — for partial updates
  • Fixed status check to accept both 200 OK and 204 No Content (DELETE responses)

Extended existing tools (get / create / update / delete added)

Resource New tools
Peers get_netbird_peer, update_netbird_peer, delete_netbird_peer, get_netbird_peer_accessible_peers
Groups get_netbird_group, create_netbird_group, update_netbird_group, delete_netbird_group
Policies get_netbird_policy, create_netbird_policy, update_netbird_policy, delete_netbird_policy
Networks get_netbird_network, create_netbird_network, update_netbird_network, delete_netbird_network
DNS Nameservers get_netbird_nameserver, create_netbird_nameserver, update_netbird_nameserver, delete_netbird_nameserver
Posture Checks get_netbird_posture_check, create_netbird_posture_check, update_netbird_posture_check, delete_netbird_posture_check

New tool files

File Tools
tools/network_resources.go Full CRUD for network resources (/networks/{id}/resources)
tools/network_routers.go Full CRUD for network routers (/networks/{id}/routers)
tools/dns_settings.go get_netbird_dns_settings, update_netbird_dns_settings
tools/setup_keys.go Full CRUD for setup keys
tools/users.go Full CRUD + get_netbird_current_user, invite_netbird_user
tools/accounts.go list_netbird_accounts, update_netbird_account
tools/routes.go Full CRUD for routes
tools/events.go list_netbird_events with page/limit pagination
tools/tokens.go List, get, create, delete for personal access tokens

Test plan

  • go build ./... compiles without errors
  • go test ./... passes all existing tests
  • Verify list tools still work as before (no regression)
  • Test create/delete cycle on a non-production Netbird instance

- Add Post, Delete, Patch methods to NetbirdClient
- Fix status check to accept 200 and 204 (DELETE returns 204)
- Extend peers, groups, policies, networks, nameservers, posture_checks with get/create/update/delete
- Add network_resources and network_routers (full CRUD)
- Add dns_settings, setup_keys, users, accounts, routes, events, tokens

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant