UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

127 lines • 4.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Servers = exports.BaseServers = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../../../core/resource.js"); const pagination_1 = require("../../../../../core/pagination.js"); const path_1 = require("../../../../../internal/utils/path.js"); var BaseServers = /* @__PURE__ */ (() => { class BaseServers extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/access/ai-controls/mcp/servers`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.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; })(); exports.BaseServers = BaseServers; class Servers extends BaseServers { } exports.Servers = Servers; //# sourceMappingURL=servers.js.map