Skip to main content
REST client

MCP Servers

The 8 operations under mcp-servers, as typed calls on the generated REST client.

1 min read
View MarkdownEdit on GitHub

MCP Servers

Available from @codespar/sdk 0.12.0; the version on npm is 0.12.0. Every example on this page is compiled against the installed package when these docs build: a call that does not type-check fails the build.

Every call below is cs.api reaching one operation of the OpenAPI document this page was generated from; the REST client overview explains request, response, the option bag and the errors. The values are placeholders shaped by the document.

import {  } from "@codespar/sdk";

const  = new ({ : .. });

GET /v1/mcp-servers

GET/v1/mcp-servers

List this project's MCP servers

const  = await ..("/v1/mcp-servers");

Parameters, body and every documented response: GET /v1/mcp-servers in the HTTP reference.

POST /v1/mcp-servers

POST/v1/mcp-servers

Register a monetized MCP server and price its tools

const  = await ..("post", "/v1/mcp-servers", {
  : {
    : "example",
    : "Example",
    : "string",
    : "string",
    : "string",
    : "https://example.com/hook",
    : "csm_0000000000000000",
    : {
      : "string",
      : "string"
    },
    : 0,
    : [
      {
        : "Example",
        : "string",
        : "string"
      }
    ]
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/mcp-servers in the HTTP reference.

POST /v1/mcp-servers/platform-fees/sweep

POST/v1/mcp-servers/platform-fees/sweep
Moves money

This moves everything unswept for the calling organization to its provisioned platform wallet

Move accrued platform fees to the organization's wallet now

const  = await ..("post", "/v1/mcp-servers/platform-fees/sweep");
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/mcp-servers/platform-fees/sweep in the HTTP reference.

POST /v1/mcp-servers/validate

POST/v1/mcp-servers/validate

Connect to an upstream MCP server and list its tools

const  = await ..("post", "/v1/mcp-servers/validate", {
  : {
    : "https://example.com/hook",
    : {
      : "string",
      : "string"
    }
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/mcp-servers/validate in the HTTP reference.

GET /v1/mcp-servers/{id}

GET/v1/mcp-servers/{id}

Read one MCP server with its priced tools

const  = await ..("/v1/mcp-servers/{id}", {
  : {
    : "msrv_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/mcp-servers/{id} in the HTTP reference.

PATCH /v1/mcp-servers/{id}

PATCH/v1/mcp-servers/{id}

Update an MCP server's listing metadata or its active flag

const  = await ..("patch", "/v1/mcp-servers/{id}", {
  : {
    : "msrv_0000000000000000"
  },
  : {
    : "Example",
    : "string",
    : "string",
    : "string",
    : true
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: PATCH /v1/mcp-servers/{id} in the HTTP reference.

DELETE /v1/mcp-servers/{id}

DELETE/v1/mcp-servers/{id}

Delete an MCP server and its priced tools

const  = await ..("delete", "/v1/mcp-servers/{id}", {
  : {
    : "msrv_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: DELETE /v1/mcp-servers/{id} in the HTTP reference.

PATCH /v1/mcp-servers/{id}/tools/{tool}

PATCH/v1/mcp-servers/{id}/tools/{tool}

Reprice one tool, or turn it off

const  = await ..("patch", "/v1/mcp-servers/{id}/tools/{tool}", {
  : {
    : "msrv_0000000000000000",
    : "string"
  },
  : {
    : "string",
    : true
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: PATCH /v1/mcp-servers/{id}/tools/{tool} in the HTTP reference.

MCP Servers | CodeSpar