MCPcopy Index your code
hub / github.com/coder/coder / TestMCPServerConfigsOAuth2Disconnect

Function TestMCPServerConfigsOAuth2Disconnect

coderd/mcp_test.go:520–547  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

518}
519
520func TestMCPServerConfigsOAuth2Disconnect(t *testing.T) {
521 t.Parallel()
522
523 ctx := testutil.Context(t, testutil.WaitLong)
524 adminClient := newMCPClient(t)
525 firstUser := coderdtest.CreateFirstUser(t, adminClient)
526 memberClient, _ := coderdtest.CreateAnotherUser(t, adminClient, firstUser.OrganizationID)
527
528 created, err := adminClient.CreateMCPServerConfig(ctx, codersdk.CreateMCPServerConfigRequest{
529 DisplayName: "OAuth Disconnect Test",
530 Slug: "oauth-disconnect",
531 Transport: "streamable_http",
532 URL: "https://mcp.example.com/oauth-disc",
533 AuthType: "oauth2",
534 OAuth2ClientID: "cid",
535 OAuth2AuthURL: "https://auth.example.com/authorize",
536 OAuth2TokenURL: "https://auth.example.com/token",
537 Availability: "default_on",
538 Enabled: true,
539 ToolAllowList: []string{},
540 ToolDenyList: []string{},
541 })
542 require.NoError(t, err)
543
544 // Disconnect should succeed even when no token exists (idempotent).
545 err = memberClient.MCPServerOAuth2Disconnect(ctx, created.ID)
546 require.NoError(t, err)
547}
548
549func TestMCPServerConfigsOAuth2AutoDiscovery(t *testing.T) {
550 t.Parallel()

Callers

nothing calls this directly

Calls 6

ContextFunction · 0.92
CreateFirstUserFunction · 0.92
CreateAnotherUserFunction · 0.92
newMCPClientFunction · 0.85
CreateMCPServerConfigMethod · 0.80

Tested by

no test coverage detected