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

Method MCPServerConfigByID

codersdk/mcp.go:163–174  ·  view source on GitHub ↗
(ctx context.Context, id uuid.UUID)

Source from the content-addressed store, hash-verified

161}
162
163func (c *Client) MCPServerConfigByID(ctx context.Context, id uuid.UUID) (MCPServerConfig, error) {
164 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/experimental/mcp/servers/%s", id), nil)
165 if err != nil {
166 return MCPServerConfig{}, err
167 }
168 defer res.Body.Close()
169 if res.StatusCode != http.StatusOK {
170 return MCPServerConfig{}, ReadBodyAsError(res)
171 }
172 var config MCPServerConfig
173 return config, json.NewDecoder(res.Body).Decode(&config)
174}
175
176func (c *Client) CreateMCPServerConfig(ctx context.Context, req CreateMCPServerConfigRequest) (MCPServerConfig, error) {
177 res, err := c.Request(ctx, http.MethodPost, "/api/experimental/mcp/servers", req)

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 2

TestMCPServerConfigsCRUDFunction · 0.64