@cloudbase/cloudbase-mcp 2.34.8 → 2.35.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import CloudBase from '@cloudbase/manager-node';
2
+ import type { IncomingMessage } from 'node:http';
2
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
4
  import { RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { ServerResponse } from 'node:http';
4
6
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
7
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
6
8
  import type { ToolAnnotations as ToolAnnotations_2 } from '@modelcontextprotocol/sdk/types.js';
@@ -72,6 +74,20 @@ export declare type CloudBaseRegisterToolConfig = {
72
74
  _meta?: Record<string, unknown>;
73
75
  };
74
76
 
77
+ export declare type CloudBaseServerOptions = {
78
+ name?: string;
79
+ version?: string;
80
+ enableTelemetry?: boolean;
81
+ cloudBaseOptions?: HostedCloudBaseOptions;
82
+ cloudMode?: boolean;
83
+ ide?: string;
84
+ client?: string;
85
+ clientInfo?: HostedClientInfoRecord;
86
+ lang?: string;
87
+ pluginsEnabled?: string[];
88
+ pluginsDisabled?: string[];
89
+ };
90
+
75
91
  /**
76
92
  * Create a manager with the provided CloudBase options, without using cache
77
93
  * @param cloudBaseOptions Provided CloudBase options
@@ -108,6 +124,14 @@ export declare function createCloudBaseMcpServer(options?: {
108
124
  cloudMode?: boolean;
109
125
  ide?: string;
110
126
  client?: string;
127
+ /**
128
+ * Client name/version to report when the MCP handshake clientInfo is empty.
129
+ * Metadata only. Hosted requests pass the value remembered for this credential.
130
+ */
131
+ clientInfo?: {
132
+ name: string;
133
+ version?: string;
134
+ };
111
135
  logger?: Logger;
112
136
  pluginsEnabled?: string[];
113
137
  pluginsDisabled?: string[];
@@ -210,6 +234,14 @@ export declare interface ExtendedMcpServer extends McpServer {
210
234
  ide?: string;
211
235
  /** MCP client 来源标识(hosted 场景由上游解析注入,如 cursor / claude-code) */
212
236
  client?: string;
237
+ /**
238
+ * Metadata-only client identity used when this request has no handshake.
239
+ * `{ name, version }` only. Not a protocol object.
240
+ */
241
+ clientInfo?: {
242
+ name: string;
243
+ version?: string;
244
+ };
213
245
  logger?: Logger;
214
246
  enabledPlugins?: string[];
215
247
  pluginOptions?: PluginOptions;
@@ -297,6 +329,59 @@ declare interface GetManagerOptions {
297
329
  authStrategy?: 'fail_fast' | 'ensure';
298
330
  }
299
331
 
332
+ /**
333
+ * One stateless JSON MCP request: a new server and SDK 1.30 transport, then close both.
334
+ * Protocol versions are not rewritten. SDK 1.30 accepts `2025-11-25`. Later or
335
+ * malformed `mcp-protocol-version` headers are passed through and rejected by the transport.
336
+ */
337
+ export declare function handleHostedMcpRequest(input: HostedMcpRequestInput): Promise<void>;
338
+
339
+ /**
340
+ * Bounded memory of MCP client name/version, keyed by a credential hash.
341
+ *
342
+ * Process-level mutable state: one Map. Each value is `{ name, version, writtenAt }`.
343
+ * The map does not store servers, transports, or raw credentials.
344
+ */
345
+ export declare const HOSTED_CLIENT_INFO_CACHE_CAPACITY = 256;
346
+
347
+ export declare const HOSTED_CLIENT_INFO_CACHE_TTL_MS: number;
348
+
349
+ export declare type HostedClientInfoRecord = {
350
+ name: string;
351
+ version?: string;
352
+ };
353
+
354
+ /**
355
+ * Plain options for a hosted request. No SDK types, so a TypeScript 4.9 host
356
+ * can pass this object without compiling against the MCP SDK.
357
+ */
358
+ export declare type HostedCloudBaseOptions = {
359
+ envId?: string;
360
+ secretId?: string;
361
+ secretKey?: string;
362
+ token?: string;
363
+ useInternalEndpoint?: boolean;
364
+ region?: string;
365
+ site?: string;
366
+ credentialScope?: "env" | "account";
367
+ uin?: string;
368
+ };
369
+
370
+ export declare type HostedMcpLogEvent = {
371
+ type: string;
372
+ message?: string;
373
+ timeCost?: number;
374
+ };
375
+
376
+ export declare type HostedMcpRequestInput = {
377
+ req: IncomingMessage;
378
+ res: ServerResponse;
379
+ body: unknown;
380
+ serverOptions: CloudBaseServerOptions;
381
+ clientInfoHint?: HostedClientInfoRecord;
382
+ logger?: (event: HostedMcpLogEvent) => void;
383
+ };
384
+
300
385
  declare interface IdeFileDescriptor {
301
386
  path: string;
302
387
  isMcpConfig?: boolean;
@@ -400,15 +485,33 @@ declare interface LoginState {
400
485
  /**
401
486
  * 主账号 uin。本地凭证(`~/.config/.cloudbase/auth.json`)自带,
402
487
  * 由 `@cloudbase/toolbox` 的 `resolveCredential()` 透传。
403
- * 注意:临时密钥续期响应里没有 uin,须由调用方保留旧值(见 resolveSiteLoginState)。
488
+ * 注意:临时密钥续期响应里没有 uin,须由调用方保留旧值(见 resolveFlatLoginState)。
404
489
  */
405
490
  uin?: string | number;
406
491
  }
407
492
 
408
- export declare function logout(options?: {
493
+ export declare function logout(_options?: {
409
494
  site?: string;
410
495
  }): Promise<void>;
411
496
 
497
+ /**
498
+ * 归一化后的客户端能力(字段名保持语义,报表侧再映射到列)。
499
+ * `undefined` = 握手未完成,与「握手完成但什么都没声明」必须分开:
500
+ * 后者是客户端事实,前者只是我们还没拿到。
501
+ */
502
+ declare type McpClientCapabilities = {
503
+ /** 表单模式 elicitation(客户端声明 `elicitation:{}` 或 `elicitation.form`) */
504
+ elicitationForm: boolean;
505
+ /** URL 模式 elicitation(凭据跳转用;本期不做,只记录) */
506
+ elicitationUrl: boolean;
507
+ /** 声明了 MCP Apps 扩展 */
508
+ ui: boolean;
509
+ roots: boolean;
510
+ sampling: boolean;
511
+ /** 报表友好摘要:`none` 或稳定排序的逗号串(elicitation:form / elicitation:url / ui / roots / sampling) */
512
+ summary: string;
513
+ };
514
+
412
515
  /** MCP initialize clientInfo fields available after handshake via Server.getClientVersion(). */
413
516
  declare type McpClientInfo = {
414
517
  name?: string;
@@ -488,6 +591,7 @@ export declare const reportToolCall: (params: {
488
591
  ide?: string;
489
592
  client?: string;
490
593
  mcpClientInfo?: McpClientInfo;
594
+ mcpClientCapabilities?: McpClientCapabilities;
491
595
  }) => Promise<void>;
492
596
 
493
597
  export declare const reportToolkitLifecycle: (params: {
@@ -673,6 +777,12 @@ export declare interface UploadFileParams {
673
777
 
674
778
  export declare function validateTimerCron(config: string): string;
675
779
 
780
+ /**
781
+ * Startup warmup for a hosted process: finish the resource download and build
782
+ * the skill index before the first request pays for it.
783
+ */
784
+ export declare function warmupHostedResources(): Promise<void>;
785
+
676
786
  export declare const warn: (message: string, data?: object | Error) => void;
677
787
 
678
788
  export { }