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

Method deleteMCPServerConfig

coderd/mcp.go:832–865  ·  view source on GitHub ↗

@Summary Delete MCP server config @x-apidocgen {"skip": true} EXPERIMENTAL: this endpoint is experimental and is subject to change.

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

Source from the content-addressed store, hash-verified

830// @x-apidocgen {"skip": true}
831// EXPERIMENTAL: this endpoint is experimental and is subject to change.
832func (api *API) deleteMCPServerConfig(rw http.ResponseWriter, r *http.Request) {
833 ctx := r.Context()
834 if !api.Authorize(r, policy.ActionUpdate, rbac.ResourceDeploymentConfig) {
835 httpapi.Forbidden(rw)
836 return
837 }
838
839 mcpServerID, ok := parseMCPServerConfigID(rw, r)
840 if !ok {
841 return
842 }
843
844 if _, err := api.Database.GetMCPServerConfigByID(ctx, mcpServerID); err != nil {
845 if httpapi.Is404Error(err) {
846 httpapi.ResourceNotFound(rw)
847 return
848 }
849 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
850 Message: "Failed to get MCP server config.",
851 Detail: err.Error(),
852 })
853 return
854 }
855
856 if err := api.Database.DeleteMCPServerConfigByID(ctx, mcpServerID); err != nil {
857 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
858 Message: "Failed to delete MCP server config.",
859 Detail: err.Error(),
860 })
861 return
862 }
863
864 rw.WriteHeader(http.StatusNoContent)
865}
866
867// @Summary Initiate MCP server OAuth2 connect
868// @x-apidocgen {"skip": true}

Callers 1

deleteMCPServerConfigFunction · 0.80

Calls 11

AuthorizeMethod · 0.95
ForbiddenFunction · 0.92
Is404ErrorFunction · 0.92
ResourceNotFoundFunction · 0.92
WriteFunction · 0.92
parseMCPServerConfigIDFunction · 0.85
ContextMethod · 0.65
ErrorMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected