qlogicagent 0.2.1 → 0.4.0
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/README.md +45 -45
- package/package.json +56 -42
- package/dist/agent/agent.d.ts +0 -43
- package/dist/agent/agent.js +0 -113
- package/dist/agent/tool-loop.d.ts +0 -64
- package/dist/agent/tool-loop.js +0 -575
- package/dist/agent/types.d.ts +0 -175
- package/dist/agent/types.js +0 -14
- package/dist/cli/main.d.ts +0 -11
- package/dist/cli/main.js +0 -23
- package/dist/cli/stdio-server.d.ts +0 -45
- package/dist/cli/stdio-server.js +0 -463
- package/dist/config/config.d.ts +0 -17
- package/dist/config/config.js +0 -21
- package/dist/contracts/hooks.d.ts +0 -120
- package/dist/contracts/hooks.js +0 -7
- package/dist/contracts/index.d.ts +0 -10
- package/dist/contracts/index.js +0 -10
- package/dist/contracts/planner.d.ts +0 -35
- package/dist/contracts/planner.js +0 -2
- package/dist/contracts/skill-candidate.d.ts +0 -63
- package/dist/contracts/skill-candidate.js +0 -195
- package/dist/contracts/todo.d.ts +0 -14
- package/dist/contracts/todo.js +0 -9
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -15
- package/dist/llm/builtin-providers.d.ts +0 -10
- package/dist/llm/builtin-providers.js +0 -531
- package/dist/llm/index.d.ts +0 -15
- package/dist/llm/index.js +0 -14
- package/dist/llm/llm-client.d.ts +0 -43
- package/dist/llm/llm-client.js +0 -67
- package/dist/llm/model-catalog.d.ts +0 -53
- package/dist/llm/model-catalog.js +0 -191
- package/dist/llm/provider-def.d.ts +0 -59
- package/dist/llm/provider-def.js +0 -12
- package/dist/llm/provider-registry.d.ts +0 -54
- package/dist/llm/provider-registry.js +0 -147
- package/dist/llm/transport.d.ts +0 -62
- package/dist/llm/transport.js +0 -27
- package/dist/llm/transports/anthropic-messages.d.ts +0 -31
- package/dist/llm/transports/anthropic-messages.js +0 -293
- package/dist/llm/transports/openai-chat.d.ts +0 -36
- package/dist/llm/transports/openai-chat.js +0 -165
- package/dist/orchestration/agent-registry.d.ts +0 -41
- package/dist/orchestration/agent-registry.js +0 -116
- package/dist/orchestration/approval-aware-tool-plan.d.ts +0 -32
- package/dist/orchestration/approval-aware-tool-plan.js +0 -87
- package/dist/orchestration/context-compression.d.ts +0 -220
- package/dist/orchestration/context-compression.js +0 -583
- package/dist/orchestration/conversation-repair.d.ts +0 -61
- package/dist/orchestration/conversation-repair.js +0 -429
- package/dist/orchestration/curator-scheduler.d.ts +0 -119
- package/dist/orchestration/curator-scheduler.js +0 -135
- package/dist/orchestration/embedded-failover-policy.d.ts +0 -110
- package/dist/orchestration/embedded-failover-policy.js +0 -168
- package/dist/orchestration/error-classification.d.ts +0 -12
- package/dist/orchestration/error-classification.js +0 -77
- package/dist/orchestration/failover-classification.d.ts +0 -8
- package/dist/orchestration/failover-classification.js +0 -381
- package/dist/orchestration/failover-error.d.ts +0 -33
- package/dist/orchestration/failover-error.js +0 -198
- package/dist/orchestration/fork-subagent.d.ts +0 -100
- package/dist/orchestration/fork-subagent.js +0 -98
- package/dist/orchestration/index.d.ts +0 -120
- package/dist/orchestration/index.js +0 -267
- package/dist/orchestration/memory-flush-policy.d.ts +0 -57
- package/dist/orchestration/memory-flush-policy.js +0 -85
- package/dist/orchestration/memory-provider.d.ts +0 -14
- package/dist/orchestration/memory-provider.js +0 -2
- package/dist/orchestration/parallel-tool-calls.d.ts +0 -41
- package/dist/orchestration/parallel-tool-calls.js +0 -59
- package/dist/orchestration/prompt-cache-strategy.d.ts +0 -126
- package/dist/orchestration/prompt-cache-strategy.js +0 -228
- package/dist/orchestration/reactive-compact.d.ts +0 -73
- package/dist/orchestration/reactive-compact.js +0 -78
- package/dist/orchestration/retry-loop.d.ts +0 -22
- package/dist/orchestration/retry-loop.js +0 -24
- package/dist/orchestration/skill-candidate.d.ts +0 -52
- package/dist/orchestration/skill-candidate.js +0 -141
- package/dist/orchestration/skill-consolidation.d.ts +0 -123
- package/dist/orchestration/skill-consolidation.js +0 -220
- package/dist/orchestration/skill-improvement.d.ts +0 -59
- package/dist/orchestration/skill-improvement.js +0 -66
- package/dist/orchestration/skill-similarity.d.ts +0 -98
- package/dist/orchestration/skill-similarity.js +0 -131
- package/dist/orchestration/streaming-tool-executor.d.ts +0 -73
- package/dist/orchestration/streaming-tool-executor.js +0 -96
- package/dist/orchestration/team-orchestration.d.ts +0 -195
- package/dist/orchestration/team-orchestration.js +0 -369
- package/dist/orchestration/team-tool-loop-wiring.d.ts +0 -92
- package/dist/orchestration/team-tool-loop-wiring.js +0 -147
- package/dist/orchestration/tool-choice-policy.d.ts +0 -54
- package/dist/orchestration/tool-choice-policy.js +0 -164
- package/dist/orchestration/tool-loop-state.d.ts +0 -50
- package/dist/orchestration/tool-loop-state.js +0 -133
- package/dist/orchestration/tool-schema.d.ts +0 -39
- package/dist/orchestration/tool-schema.js +0 -297
- package/dist/orchestration/transcript-repair.d.ts +0 -42
- package/dist/orchestration/transcript-repair.js +0 -426
- package/dist/orchestration/turn-loop-guard.d.ts +0 -86
- package/dist/orchestration/turn-loop-guard.js +0 -92
- package/dist/orchestration/web-browser-policy.d.ts +0 -17
- package/dist/orchestration/web-browser-policy.js +0 -39
- package/dist/runtime/context-compression.d.ts +0 -61
- package/dist/runtime/context-compression.js +0 -274
- package/dist/runtime/hook-registry.d.ts +0 -12
- package/dist/runtime/hook-registry.js +0 -53
- package/dist/runtime/memory-hooks.d.ts +0 -23
- package/dist/runtime/memory-hooks.js +0 -65
- package/dist/runtime/tool-eligibility.d.ts +0 -59
- package/dist/runtime/tool-eligibility.js +0 -111
- package/dist/skills/index.d.ts +0 -108
- package/dist/skills/index.js +0 -82
- package/dist/skills/memory-extractor.d.ts +0 -64
- package/dist/skills/memory-extractor.js +0 -173
- package/dist/skills/memory-query-tool.d.ts +0 -43
- package/dist/skills/memory-query-tool.js +0 -127
- package/dist/skills/memory-store.d.ts +0 -66
- package/dist/skills/memory-store.js +0 -228
- package/dist/skills/memory-tool.d.ts +0 -67
- package/dist/skills/memory-tool.js +0 -192
- package/dist/skills/portable-tool.d.ts +0 -71
- package/dist/skills/portable-tool.js +0 -14
- package/dist/skills/qmemory-adapter.d.ts +0 -52
- package/dist/skills/qmemory-adapter.js +0 -165
- package/dist/skills/skill-frontmatter.d.ts +0 -19
- package/dist/skills/skill-frontmatter.js +0 -344
- package/dist/skills/skill-guard.d.ts +0 -23
- package/dist/skills/skill-guard.js +0 -229
- package/dist/skills/skill-loader.d.ts +0 -16
- package/dist/skills/skill-loader.js +0 -303
- package/dist/skills/skill-source.d.ts +0 -119
- package/dist/skills/skill-source.js +0 -126
- package/dist/skills/skill-types.d.ts +0 -199
- package/dist/skills/skill-types.js +0 -6
- package/dist/skills/think-tool.d.ts +0 -16
- package/dist/skills/think-tool.js +0 -59
- package/dist/skills/todo-tool.d.ts +0 -63
- package/dist/skills/todo-tool.js +0 -114
- package/dist/skills/tools/agent-tool.d.ts +0 -91
- package/dist/skills/tools/agent-tool.js +0 -142
- package/dist/skills/tools/apply-patch-tool.d.ts +0 -29
- package/dist/skills/tools/apply-patch-tool.js +0 -184
- package/dist/skills/tools/ask-user-tool.d.ts +0 -80
- package/dist/skills/tools/ask-user-tool.js +0 -121
- package/dist/skills/tools/brief-tool.d.ts +0 -74
- package/dist/skills/tools/brief-tool.js +0 -95
- package/dist/skills/tools/browser-tool.d.ts +0 -114
- package/dist/skills/tools/browser-tool.js +0 -155
- package/dist/skills/tools/checkpoint-tool.d.ts +0 -66
- package/dist/skills/tools/checkpoint-tool.js +0 -102
- package/dist/skills/tools/config-tool.d.ts +0 -63
- package/dist/skills/tools/config-tool.js +0 -143
- package/dist/skills/tools/cron-tool.d.ts +0 -116
- package/dist/skills/tools/cron-tool.js +0 -175
- package/dist/skills/tools/edit-tool.d.ts +0 -43
- package/dist/skills/tools/edit-tool.js +0 -70
- package/dist/skills/tools/exec-tool.d.ts +0 -102
- package/dist/skills/tools/exec-tool.js +0 -133
- package/dist/skills/tools/image-generate-tool.d.ts +0 -62
- package/dist/skills/tools/image-generate-tool.js +0 -67
- package/dist/skills/tools/instructions-tool.d.ts +0 -103
- package/dist/skills/tools/instructions-tool.js +0 -187
- package/dist/skills/tools/lsp-tool.d.ts +0 -153
- package/dist/skills/tools/lsp-tool.js +0 -227
- package/dist/skills/tools/mcp-client-types.d.ts +0 -269
- package/dist/skills/tools/mcp-client-types.js +0 -53
- package/dist/skills/tools/mcp-tool.d.ts +0 -249
- package/dist/skills/tools/mcp-tool.js +0 -503
- package/dist/skills/tools/memory-tool.d.ts +0 -74
- package/dist/skills/tools/memory-tool.js +0 -88
- package/dist/skills/tools/monitor-tool.d.ts +0 -113
- package/dist/skills/tools/monitor-tool.js +0 -131
- package/dist/skills/tools/music-generate-tool.d.ts +0 -55
- package/dist/skills/tools/music-generate-tool.js +0 -62
- package/dist/skills/tools/notify-tool.d.ts +0 -53
- package/dist/skills/tools/notify-tool.js +0 -62
- package/dist/skills/tools/patch-tool.d.ts +0 -45
- package/dist/skills/tools/patch-tool.js +0 -505
- package/dist/skills/tools/pdf-tool.d.ts +0 -66
- package/dist/skills/tools/pdf-tool.js +0 -88
- package/dist/skills/tools/plan-mode-tool.d.ts +0 -59
- package/dist/skills/tools/plan-mode-tool.js +0 -122
- package/dist/skills/tools/read-tool.d.ts +0 -51
- package/dist/skills/tools/read-tool.js +0 -84
- package/dist/skills/tools/repl-tool.d.ts +0 -70
- package/dist/skills/tools/repl-tool.js +0 -69
- package/dist/skills/tools/search-tool.d.ts +0 -112
- package/dist/skills/tools/search-tool.js +0 -225
- package/dist/skills/tools/send-message-tool.d.ts +0 -51
- package/dist/skills/tools/send-message-tool.js +0 -76
- package/dist/skills/tools/skill-list-tool.d.ts +0 -33
- package/dist/skills/tools/skill-list-tool.js +0 -54
- package/dist/skills/tools/skill-manage-tool.d.ts +0 -73
- package/dist/skills/tools/skill-manage-tool.js +0 -153
- package/dist/skills/tools/skill-view-tool.d.ts +0 -37
- package/dist/skills/tools/skill-view-tool.js +0 -72
- package/dist/skills/tools/sleep-tool.d.ts +0 -49
- package/dist/skills/tools/sleep-tool.js +0 -81
- package/dist/skills/tools/structured-output-tool.d.ts +0 -116
- package/dist/skills/tools/structured-output-tool.js +0 -176
- package/dist/skills/tools/task-tool.d.ts +0 -104
- package/dist/skills/tools/task-tool.js +0 -161
- package/dist/skills/tools/team-tool.d.ts +0 -89
- package/dist/skills/tools/team-tool.js +0 -105
- package/dist/skills/tools/tool-search-tool.d.ts +0 -51
- package/dist/skills/tools/tool-search-tool.js +0 -110
- package/dist/skills/tools/tts-tool.d.ts +0 -38
- package/dist/skills/tools/tts-tool.js +0 -45
- package/dist/skills/tools/video-edit-tool.d.ts +0 -69
- package/dist/skills/tools/video-edit-tool.js +0 -74
- package/dist/skills/tools/video-generate-tool.d.ts +0 -62
- package/dist/skills/tools/video-generate-tool.js +0 -66
- package/dist/skills/tools/video-merge-tool.d.ts +0 -105
- package/dist/skills/tools/video-merge-tool.js +0 -92
- package/dist/skills/tools/video-upscale-tool.d.ts +0 -45
- package/dist/skills/tools/video-upscale-tool.js +0 -52
- package/dist/skills/tools/web-fetch-tool.d.ts +0 -78
- package/dist/skills/tools/web-fetch-tool.js +0 -92
- package/dist/skills/tools/web-search-tool.d.ts +0 -57
- package/dist/skills/tools/web-search-tool.js +0 -86
- package/dist/skills/tools/worktree-tool.d.ts +0 -69
- package/dist/skills/tools/worktree-tool.js +0 -147
- package/dist/skills/tools/write-tool.d.ts +0 -45
- package/dist/skills/tools/write-tool.js +0 -81
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// MCP Client SDK Types — Full Model Context Protocol client contract.
|
|
3
|
-
//
|
|
4
|
-
// Defines the complete type system for MCP server connections,
|
|
5
|
-
// transports, authentication, dynamic tool injection, prompts,
|
|
6
|
-
// and lifecycle management.
|
|
7
|
-
//
|
|
8
|
-
// Reference: @modelcontextprotocol/sdk + Claude Code services/mcp/
|
|
9
|
-
// ============================================================
|
|
10
|
-
// ── Client Lifecycle Constants ──────────────────────────────
|
|
11
|
-
export const MCP_CONNECTION_TIMEOUT_MS = 30_000;
|
|
12
|
-
export const MCP_REQUEST_TIMEOUT_MS = 60_000;
|
|
13
|
-
export const MCP_TOOL_CALL_TIMEOUT_MS = 100_000;
|
|
14
|
-
export const MCP_MAX_RECONNECT_ATTEMPTS = 5;
|
|
15
|
-
export const MCP_RECONNECT_BASE_DELAY_MS = 1_000;
|
|
16
|
-
export const MCP_RECONNECT_MAX_DELAY_MS = 30_000;
|
|
17
|
-
export const MCP_MAX_DESCRIPTION_LENGTH = 2048;
|
|
18
|
-
export const MCP_AUTH_CACHE_TTL_MS = 15 * 60 * 1000;
|
|
19
|
-
export const MCP_BATCH_SIZE_LOCAL = 3;
|
|
20
|
-
export const MCP_BATCH_SIZE_REMOTE = 20;
|
|
21
|
-
// ── Name Utilities ──────────────────────────────────────────
|
|
22
|
-
const MCP_PREFIX = "mcp__";
|
|
23
|
-
const MCP_SEPARATOR = "__";
|
|
24
|
-
/** Normalize a name for use in the prefixed tool name format */
|
|
25
|
-
export function normalizeNameForMcp(name) {
|
|
26
|
-
return name.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
27
|
-
}
|
|
28
|
-
/** Build a prefixed tool name: mcp__{server}__{tool} */
|
|
29
|
-
export function buildMcpToolName(serverName, toolName) {
|
|
30
|
-
return `${MCP_PREFIX}${normalizeNameForMcp(serverName)}${MCP_SEPARATOR}${normalizeNameForMcp(toolName)}`;
|
|
31
|
-
}
|
|
32
|
-
/** Get the prefix for a server (for batch removal) */
|
|
33
|
-
export function getMcpServerPrefix(serverName) {
|
|
34
|
-
return `${MCP_PREFIX}${normalizeNameForMcp(serverName)}${MCP_SEPARATOR}`;
|
|
35
|
-
}
|
|
36
|
-
/** Parse a prefixed tool name back into server + tool */
|
|
37
|
-
export function parseMcpToolName(prefixedName) {
|
|
38
|
-
if (!prefixedName.startsWith(MCP_PREFIX))
|
|
39
|
-
return null;
|
|
40
|
-
const rest = prefixedName.slice(MCP_PREFIX.length);
|
|
41
|
-
const sepIndex = rest.indexOf(MCP_SEPARATOR);
|
|
42
|
-
if (sepIndex < 0)
|
|
43
|
-
return null;
|
|
44
|
-
return {
|
|
45
|
-
serverName: rest.slice(0, sepIndex),
|
|
46
|
-
toolName: rest.slice(sepIndex + MCP_SEPARATOR.length),
|
|
47
|
-
prefixedName,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
/** Check if a tool name is an MCP-injected tool */
|
|
51
|
-
export function isMcpToolName(name) {
|
|
52
|
-
return name.startsWith(MCP_PREFIX);
|
|
53
|
-
}
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
-
import type { McpServerConfig, McpConnectionStatus, McpServerCapabilities, McpToolAnnotations, McpToolsChangedEvent, McpPromptDefinition, McpPromptMessage, McpElicitResult, McpAuthState, McpLogEntry, McpLogLevel } from "./mcp-client-types.js";
|
|
3
|
-
export type { McpServerConfig, McpStdioConfig, McpSseConfig, McpHttpConfig, McpWsConfig, McpInProcessConfig, McpServerState, McpConnectionStatus, McpServerCapabilities, McpExternalTool, McpToolAnnotations, McpToolIdentifier, McpToolsChangedEvent, McpResourceDefinition, McpResourceTemplate, McpPersistedResourceContent, McpResourceContentItem, McpPromptDefinition, McpPromptArgument, McpPromptMessage, McpPromptContent, McpElicitResult, McpElicitRequest, McpOAuthConfig, McpOAuthTokens, McpAuthState, McpLogEntry, McpLogLevel, McpTransportType, } from "./mcp-client-types.js";
|
|
4
|
-
export { normalizeNameForMcp, buildMcpToolName, getMcpServerPrefix, parseMcpToolName, isMcpToolName, MCP_CONNECTION_TIMEOUT_MS, MCP_REQUEST_TIMEOUT_MS, MCP_TOOL_CALL_TIMEOUT_MS, MCP_MAX_RECONNECT_ATTEMPTS, MCP_MAX_DESCRIPTION_LENGTH, } from "./mcp-client-types.js";
|
|
5
|
-
export declare const MCP_TOOL_NAME: "mcp";
|
|
6
|
-
export type McpAction = "list_servers" | "list_tools" | "call_tool" | "list_resources" | "read_resource" | "list_prompts" | "get_prompt" | "authenticate" | "manage_server";
|
|
7
|
-
export interface McpToolParams {
|
|
8
|
-
action: McpAction;
|
|
9
|
-
/** Server name (required for most actions) */
|
|
10
|
-
server?: string;
|
|
11
|
-
/** Tool name on the MCP server (for call_tool) */
|
|
12
|
-
toolName?: string;
|
|
13
|
-
/** Arguments for the MCP tool call or prompt arguments */
|
|
14
|
-
arguments?: Record<string, unknown>;
|
|
15
|
-
/** Resource URI (for read_resource) */
|
|
16
|
-
uri?: string;
|
|
17
|
-
/** Prompt name (for get_prompt) */
|
|
18
|
-
promptName?: string;
|
|
19
|
-
/** Server management sub-action */
|
|
20
|
-
manageAction?: McpManageAction;
|
|
21
|
-
/** Server config (for manage_server add) */
|
|
22
|
-
config?: McpServerConfig;
|
|
23
|
-
}
|
|
24
|
-
export type McpManageAction = "add" | "remove" | "restart" | "health_check" | "enable" | "disable";
|
|
25
|
-
export declare const MCP_TOOL_SCHEMA: {
|
|
26
|
-
readonly type: "object";
|
|
27
|
-
readonly properties: {
|
|
28
|
-
readonly action: {
|
|
29
|
-
readonly type: "string";
|
|
30
|
-
readonly enum: readonly ["list_servers", "list_tools", "call_tool", "list_resources", "read_resource", "list_prompts", "get_prompt", "authenticate", "manage_server"];
|
|
31
|
-
readonly description: string;
|
|
32
|
-
};
|
|
33
|
-
readonly server: {
|
|
34
|
-
readonly type: "string";
|
|
35
|
-
readonly description: "MCP server name. Required for all actions except list_servers.";
|
|
36
|
-
};
|
|
37
|
-
readonly toolName: {
|
|
38
|
-
readonly type: "string";
|
|
39
|
-
readonly description: "Tool name on the MCP server. Required for call_tool.";
|
|
40
|
-
};
|
|
41
|
-
readonly arguments: {
|
|
42
|
-
readonly type: "object";
|
|
43
|
-
readonly description: "Arguments for the tool call or prompt. Used with call_tool and get_prompt.";
|
|
44
|
-
};
|
|
45
|
-
readonly uri: {
|
|
46
|
-
readonly type: "string";
|
|
47
|
-
readonly description: "Resource URI. Required for read_resource.";
|
|
48
|
-
};
|
|
49
|
-
readonly promptName: {
|
|
50
|
-
readonly type: "string";
|
|
51
|
-
readonly description: "Prompt name. Required for get_prompt.";
|
|
52
|
-
};
|
|
53
|
-
readonly manageAction: {
|
|
54
|
-
readonly type: "string";
|
|
55
|
-
readonly enum: readonly ["add", "remove", "restart", "health_check", "enable", "disable"];
|
|
56
|
-
readonly description: "Sub-action for manage_server.";
|
|
57
|
-
};
|
|
58
|
-
readonly config: {
|
|
59
|
-
readonly type: "object";
|
|
60
|
-
readonly description: "Server configuration. Required for manage_server add.";
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
readonly required: readonly ["action"];
|
|
64
|
-
};
|
|
65
|
-
export interface McpServer {
|
|
66
|
-
name: string;
|
|
67
|
-
status: McpConnectionStatus;
|
|
68
|
-
transport: string;
|
|
69
|
-
toolCount: number;
|
|
70
|
-
resourceCount: number;
|
|
71
|
-
promptCount: number;
|
|
72
|
-
capabilities?: McpServerCapabilities;
|
|
73
|
-
serverVersion?: string;
|
|
74
|
-
error?: string;
|
|
75
|
-
connectedAt?: number;
|
|
76
|
-
}
|
|
77
|
-
export interface McpToolInfo {
|
|
78
|
-
name: string;
|
|
79
|
-
description?: string;
|
|
80
|
-
inputSchema?: Record<string, unknown>;
|
|
81
|
-
annotations?: McpToolAnnotations;
|
|
82
|
-
/** Prefixed name used in tool list */
|
|
83
|
-
prefixedName?: string;
|
|
84
|
-
}
|
|
85
|
-
export interface McpResource {
|
|
86
|
-
uri: string;
|
|
87
|
-
name: string;
|
|
88
|
-
mimeType?: string;
|
|
89
|
-
description?: string;
|
|
90
|
-
server?: string;
|
|
91
|
-
}
|
|
92
|
-
export interface McpResourceContent {
|
|
93
|
-
uri: string;
|
|
94
|
-
mimeType?: string;
|
|
95
|
-
text?: string;
|
|
96
|
-
blobSavedTo?: string;
|
|
97
|
-
blobSize?: number;
|
|
98
|
-
}
|
|
99
|
-
export interface McpCallResult {
|
|
100
|
-
success: boolean;
|
|
101
|
-
content?: string;
|
|
102
|
-
error?: string;
|
|
103
|
-
isError?: boolean;
|
|
104
|
-
/** Structured content blocks (images, resources) */
|
|
105
|
-
contentBlocks?: Array<{
|
|
106
|
-
type: "text" | "image" | "resource";
|
|
107
|
-
text?: string;
|
|
108
|
-
data?: string;
|
|
109
|
-
mimeType?: string;
|
|
110
|
-
}>;
|
|
111
|
-
}
|
|
112
|
-
export interface McpAuthResult {
|
|
113
|
-
status: "auth_url" | "already_authenticated" | "unsupported" | "step_up_required" | "error";
|
|
114
|
-
authUrl?: string;
|
|
115
|
-
message?: string;
|
|
116
|
-
/** Required scopes for step-up auth */
|
|
117
|
-
requiredScopes?: string[];
|
|
118
|
-
}
|
|
119
|
-
export interface McpPromptResult {
|
|
120
|
-
description?: string;
|
|
121
|
-
messages: McpPromptMessage[];
|
|
122
|
-
}
|
|
123
|
-
export interface McpManageResult {
|
|
124
|
-
success: boolean;
|
|
125
|
-
message: string;
|
|
126
|
-
/** Updated server state after the operation */
|
|
127
|
-
serverState?: McpServer;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Host-provided MCP client backend — full lifecycle management.
|
|
131
|
-
*
|
|
132
|
-
* Implements the complete MCP client SDK contract:
|
|
133
|
-
* - Transport abstraction (stdio/SSE/HTTP/WS/in-process)
|
|
134
|
-
* - Connection lifecycle (connect/disconnect/reconnect/health)
|
|
135
|
-
* - OAuth authentication with PKCE + token refresh
|
|
136
|
-
* - Dynamic tool injection (tools/list_changed notification)
|
|
137
|
-
* - Resource management with binary blob persistence
|
|
138
|
-
* - Prompt support
|
|
139
|
-
* - Server configuration CRUD
|
|
140
|
-
*/
|
|
141
|
-
export interface McpToolDeps {
|
|
142
|
-
/** List all configured MCP servers with full state */
|
|
143
|
-
listServers(): Promise<McpServer[]>;
|
|
144
|
-
/**
|
|
145
|
-
* List tools from a specific server.
|
|
146
|
-
* Results are cached; invalidated on tools/list_changed notification.
|
|
147
|
-
*/
|
|
148
|
-
listTools(server: string): Promise<McpToolInfo[]>;
|
|
149
|
-
/**
|
|
150
|
-
* Call a tool on an MCP server.
|
|
151
|
-
* Handles: connection ensure → permission check → execute → parse result.
|
|
152
|
-
*/
|
|
153
|
-
callTool(server: string, toolName: string, args?: Record<string, unknown>, signal?: AbortSignal): Promise<McpCallResult>;
|
|
154
|
-
/**
|
|
155
|
-
* List resources from a server (or all servers if not specified).
|
|
156
|
-
* Uses LRU cache; invalidated on resources/list_changed.
|
|
157
|
-
*/
|
|
158
|
-
listResources(server?: string): Promise<McpResource[]>;
|
|
159
|
-
/**
|
|
160
|
-
* Read a specific resource by URI.
|
|
161
|
-
* Handles binary blob persistence: base64 → disk file → returns path.
|
|
162
|
-
*/
|
|
163
|
-
readResource(server: string, uri: string): Promise<McpResourceContent[]>;
|
|
164
|
-
/**
|
|
165
|
-
* List prompts available from a server.
|
|
166
|
-
* Prompts are reusable templates that servers expose.
|
|
167
|
-
*/
|
|
168
|
-
listPrompts?(server: string): Promise<McpPromptDefinition[]>;
|
|
169
|
-
/**
|
|
170
|
-
* Get a specific prompt with arguments expanded.
|
|
171
|
-
* Returns the prompt messages ready for injection into conversation.
|
|
172
|
-
*/
|
|
173
|
-
getPrompt?(server: string, promptName: string, args?: Record<string, string>): Promise<McpPromptResult>;
|
|
174
|
-
/**
|
|
175
|
-
* Initiate OAuth authentication with a server.
|
|
176
|
-
* Supports: PKCE flow, token refresh, step-up auth.
|
|
177
|
-
*
|
|
178
|
-
* For stdio servers: returns "not_applicable".
|
|
179
|
-
* For SSE/HTTP servers: returns auth_url or triggers silent auth.
|
|
180
|
-
*/
|
|
181
|
-
authenticate(server: string): Promise<McpAuthResult>;
|
|
182
|
-
/**
|
|
183
|
-
* Check current auth state of a server (without initiating a flow).
|
|
184
|
-
* Optional — host may not track auth state for all servers.
|
|
185
|
-
*/
|
|
186
|
-
getAuthState?(server: string): Promise<McpAuthState>;
|
|
187
|
-
/**
|
|
188
|
-
* Add a new MCP server configuration.
|
|
189
|
-
* Optionally auto-connects after adding.
|
|
190
|
-
*/
|
|
191
|
-
addServer?(name: string, config: McpServerConfig): Promise<McpManageResult>;
|
|
192
|
-
/**
|
|
193
|
-
* Remove an MCP server (disconnect + delete config).
|
|
194
|
-
* Also removes all injected tools with the server's prefix.
|
|
195
|
-
*/
|
|
196
|
-
removeServer?(name: string): Promise<McpManageResult>;
|
|
197
|
-
/**
|
|
198
|
-
* Restart (disconnect + reconnect) a server.
|
|
199
|
-
* Clears caches and re-fetches tools/resources/prompts.
|
|
200
|
-
*/
|
|
201
|
-
restartServer?(name: string): Promise<McpManageResult>;
|
|
202
|
-
/**
|
|
203
|
-
* Health check a server's connection.
|
|
204
|
-
* Returns the updated server state with latency info.
|
|
205
|
-
*/
|
|
206
|
-
healthCheck?(server: string): Promise<McpManageResult>;
|
|
207
|
-
/**
|
|
208
|
-
* Enable/disable a server (disabled servers don't auto-connect).
|
|
209
|
-
*/
|
|
210
|
-
setServerEnabled?(name: string, enabled: boolean): Promise<McpManageResult>;
|
|
211
|
-
/**
|
|
212
|
-
* Register a callback for when a server's tool list changes.
|
|
213
|
-
* The host calls this when it receives tools/list_changed notifications.
|
|
214
|
-
*
|
|
215
|
-
* The callback receives the event with previous and current tool lists,
|
|
216
|
-
* enabling the orchestration layer to hot-swap injected tools.
|
|
217
|
-
*/
|
|
218
|
-
onToolsChanged?(callback: (event: McpToolsChangedEvent) => void): void;
|
|
219
|
-
/**
|
|
220
|
-
* Get all currently injected MCP tools across all servers.
|
|
221
|
-
* Returns the flattened list of tools with their prefixed names.
|
|
222
|
-
*/
|
|
223
|
-
getInjectedTools?(): Promise<McpToolInfo[]>;
|
|
224
|
-
/**
|
|
225
|
-
* Handle an elicitation request from an MCP server.
|
|
226
|
-
* The server asks the user for input/consent; the host presents UI.
|
|
227
|
-
* Optional — defaults to deny if not implemented.
|
|
228
|
-
*/
|
|
229
|
-
handleElicitation?(server: string, message: string, schema?: Record<string, unknown>): Promise<McpElicitResult>;
|
|
230
|
-
/**
|
|
231
|
-
* Get recent log entries from MCP servers.
|
|
232
|
-
* Optional — useful for debugging server-side issues.
|
|
233
|
-
*/
|
|
234
|
-
getServerLogs?(server: string, level?: McpLogLevel, limit?: number): Promise<McpLogEntry[]>;
|
|
235
|
-
}
|
|
236
|
-
export declare function createMcpTool(deps: McpToolDeps): PortableTool<McpToolParams>;
|
|
237
|
-
export interface McpAuthProxyDeps {
|
|
238
|
-
/** Initiate OAuth for the specified server */
|
|
239
|
-
authenticate(server: string): Promise<McpAuthResult>;
|
|
240
|
-
/** Optional callback after successful auth — e.g. reconnect, refresh tools */
|
|
241
|
-
onAuthComplete?(server: string): Promise<void>;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Create a dynamic per-server authentication proxy tool.
|
|
245
|
-
* One instance per unauthenticated MCP server.
|
|
246
|
-
*
|
|
247
|
-
* Tool name follows CC convention: `mcp__<normalizedServer>__authenticate`
|
|
248
|
-
*/
|
|
249
|
-
export declare function createMcpAuthProxy(serverName: string, deps: McpAuthProxyDeps): PortableTool<Record<string, never>>;
|