UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

122 lines • 4.69 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../../core/resource.mjs"; import { V4PagePaginationArray, } from "../../../../../core/pagination.mjs"; import { path } from "../../../../../internal/utils/path.mjs"; export var BaseServers = /* @__PURE__ */ (() => { class BaseServers extends APIResource { /** * Creates a new MCP server for connecting to an upstream MCP endpoint. * * @example * ```ts * const server = * await client.zeroTrust.access.aiControls.mcp.servers.create( * { * account_id: 'a86a8f5c339544d7bdc89926de14fb8c', * id: 'my-mcp-server', * auth_type: 'unauthenticated', * hostname: 'https://example.com/mcp', * name: 'My MCP Server', * }, * ); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/access/ai-controls/mcp/servers`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Updates an MCP server's configuration and credentials. * * @example * ```ts * const server = * await client.zeroTrust.access.aiControls.mcp.servers.update( * 'my-mcp-server', * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * ); * ``` */ update(id, params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/access/ai-controls/mcp/servers/${id}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists all MCP servers configured for the account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const serverListResponse of client.zeroTrust.access.aiControls.mcp.servers.list( * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/access/ai-controls/mcp/servers`, (V4PagePaginationArray), { query, ...options }); } /** * Deletes an MCP server from the account. * * @example * ```ts * const server = * await client.zeroTrust.access.aiControls.mcp.servers.delete( * 'my-mcp-server', * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * ); * ``` */ delete(id, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/access/ai-controls/mcp/servers/${id}`, options)._thenUnwrap((obj) => obj.result); } /** * Retrieves an MCP server's configuration and capability sync state. * * @example * ```ts * const response = * await client.zeroTrust.access.aiControls.mcp.servers.read( * 'my-mcp-server', * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * ); * ``` */ read(id, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/access/ai-controls/mcp/servers/${id}`, options)._thenUnwrap((obj) => obj.result); } /** * Syncs an MCP server's capabilities and returns the updated server state, * including any connection errors. * * @example * ```ts * const response = * await client.zeroTrust.access.aiControls.mcp.servers.sync( * 'my-mcp-server', * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * ); * ``` */ sync(id, params, options) { const { account_id } = params; return this._client.post(path `/accounts/${account_id}/access/ai-controls/mcp/servers/${id}/sync`, options)._thenUnwrap((obj) => obj.result); } } BaseServers._key = Object.freeze(['zeroTrust', 'access', 'aiControls', 'mcp', 'servers']); return BaseServers; })(); export class Servers extends BaseServers { } //# sourceMappingURL=servers.mjs.map