Skip to content

[mcp] Surface OAuth at add time so netclaw mcp auth precedes permissions - #1773

Merged
Aaronontheweb merged 3 commits into
devfrom
inspect/mcp-add-auth-hint
Aug 6, 2026
Merged

[mcp] Surface OAuth at add time so netclaw mcp auth precedes permissions#1773
Aaronontheweb merged 3 commits into
devfrom
inspect/mcp-add-auth-hint

Conversation

@Aaronontheweb

@Aaronontheweb Aaronontheweb commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What

netclaw mcp add now surfaces the netclaw mcp auth step before netclaw mcp permissions for an HTTP/SSE server. A user authorizes an OAuth-protected server first, because the permissions step needs a connected server.

The daemon owns RFC 9728 OAuth discovery (McpOAuthClientRegistrar). An earlier revision of this PR added a second discovery path in the CLI (McpOAuthProbe). A second implementation drifts from the daemon's, so this revision removes it. The CLI prints an unconditional hint instead of a probe.

Closes #1772.

Changes

  • mcp add prints an unconditional next-step hint for an HTTP/SSE server without an explicit Authorization header:
    • authorize first: netclaw mcp auth <name>
    • then grant tools: netclaw mcp permissions
  • A stdio server, or an HTTP/SSE server with an explicit Authorization header, keeps the permissions-only guidance.
  • --auth runs the OAuth flow right after the add. It delegates to the daemon (netclaw mcp auth). A stdio server ignores it. The command prints a fallback hint when the daemon is not available.
  • Removes the client-side probe (McpOAuthProbe) and its RFC 9728 / RFC 8414 discovery. The daemon stays the single owner of OAuth discovery.

Tests

  • Removes the probe-detection tests.
  • Keeps the --auth tests.
  • Adds coverage for the hint: an HTTP/SSE server without a header prints the hint; a stdio server and a header-auth server do not.
  • 86 MCP tests pass. The solution builds with 0 warnings. Slopwatch reports 0 issues.

Notes

  • No new daemon endpoint. No spec change. The daemon already owns discovery per the merged mcp-oauth capability, so this is a conformance fix.

Comment thread src/Netclaw.Cli/Mcp/McpOAuthProbe.cs Fixed
Comment thread src/Netclaw.Cli/Mcp/McpCommand.cs Fixed
… add

The daemon owns RFC 9728/8414 OAuth discovery through McpOAuthClientRegistrar.
The CLI must not run a second, client-side discovery. This commit removes
McpOAuthProbe and the add-time probe call in McpCommand.

netclaw mcp add no longer probes the endpoint. It now prints an unconditional
hint for HTTP/SSE servers added without an Authorization header: run
netclaw mcp auth first if the server needs OAuth. stdio servers and servers
with an explicit Authorization header keep the permissions-only guidance.

The --auth flag keeps its behavior. It still starts the OAuth flow through
the daemon after add.

Deletes:
- src/Netclaw.Cli/Mcp/McpOAuthProbe.cs
- src/Netclaw.Cli.Tests/Mcp/McpOAuthProbeTests.cs

Refs #1772, #1773.
@Aaronontheweb
Aaronontheweb merged commit d50fc7c into dev Aug 6, 2026
21 checks passed
@Aaronontheweb
Aaronontheweb deleted the inspect/mcp-add-auth-hint branch August 6, 2026 14:40
@Aaronontheweb Aaronontheweb mentioned this pull request Aug 26, 2026
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.

netclaw mcp add never surfaces OAuth-required servers; permissions hint is a dead end until auth runs

1 participant