@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)
| 830 | // @x-apidocgen {"skip": true} |
| 831 | // EXPERIMENTAL: this endpoint is experimental and is subject to change. |
| 832 | func (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} |
no test coverage detected