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

Method mcpServerOAuth2Disconnect

coderd/mcp.go:1145–1168  ·  view source on GitHub ↗

@Summary Disconnect MCP server OAuth2 token @x-apidocgen {"skip": true} EXPERIMENTAL: this endpoint is experimental and is subject to change. Removes the user's stored OAuth2 token for an MCP server.

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

1143// EXPERIMENTAL: this endpoint is experimental and is subject to change.
1144// Removes the user's stored OAuth2 token for an MCP server.
1145func (api *API) mcpServerOAuth2Disconnect(rw http.ResponseWriter, r *http.Request) {
1146 ctx := r.Context()
1147 apiKey := httpmw.APIKey(r)
1148
1149 mcpServerID, ok := parseMCPServerConfigID(rw, r)
1150 if !ok {
1151 return
1152 }
1153
1154 //nolint:gocritic // Users manage their own tokens.
1155 err := api.Database.DeleteMCPServerUserToken(dbauthz.AsSystemRestricted(ctx), database.DeleteMCPServerUserTokenParams{
1156 MCPServerConfigID: mcpServerID,
1157 UserID: apiKey.UserID,
1158 })
1159 if err != nil {
1160 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
1161 Message: "Failed to disconnect OAuth2 token.",
1162 Detail: err.Error(),
1163 })
1164 return
1165 }
1166
1167 rw.WriteHeader(http.StatusNoContent)
1168}
1169
1170// parseMCPServerConfigID extracts the MCP server config UUID from the
1171// "mcpServer" path parameter.

Callers

nothing calls this directly

Calls 8

APIKeyFunction · 0.92
AsSystemRestrictedFunction · 0.92
WriteFunction · 0.92
parseMCPServerConfigIDFunction · 0.85
ContextMethod · 0.65
ErrorMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected