@mcp-z/client 2.2.3 → 2.3.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 +12 -1
- package/dist/cjs/auth/capability-discovery.d.cts +3 -1
- package/dist/cjs/auth/capability-discovery.d.ts +3 -1
- package/dist/cjs/auth/capability-discovery.js +46 -32
- package/dist/cjs/auth/capability-discovery.js.map +1 -1
- package/dist/cjs/auth/discovery-fetch.d.cts +2 -0
- package/dist/cjs/auth/discovery-fetch.d.ts +2 -0
- package/dist/cjs/auth/discovery-fetch.js +85 -31
- package/dist/cjs/auth/discovery-fetch.js.map +1 -1
- package/dist/cjs/auth/interactive-oauth-flow.d.cts +1 -1
- package/dist/cjs/auth/interactive-oauth-flow.d.ts +1 -1
- package/dist/cjs/auth/interactive-oauth-flow.js +13 -6
- package/dist/cjs/auth/interactive-oauth-flow.js.map +1 -1
- package/dist/cjs/auth/oauth-callback-listener.d.cts +1 -1
- package/dist/cjs/auth/oauth-callback-listener.d.ts +1 -1
- package/dist/cjs/auth/oauth-callback-listener.js +40 -4
- package/dist/cjs/auth/oauth-callback-listener.js.map +1 -1
- package/dist/cjs/auth/rfc9728-discovery.d.cts +7 -2
- package/dist/cjs/auth/rfc9728-discovery.d.ts +7 -2
- package/dist/cjs/auth/rfc9728-discovery.js +120 -88
- package/dist/cjs/auth/rfc9728-discovery.js.map +1 -1
- package/dist/cjs/auth/types.d.cts +4 -0
- package/dist/cjs/auth/types.d.ts +4 -0
- package/dist/cjs/auth/types.js.map +1 -1
- package/dist/cjs/connection/connect-client.d.cts +9 -1
- package/dist/cjs/connection/connect-client.d.ts +9 -1
- package/dist/cjs/connection/connect-client.js +282 -75
- package/dist/cjs/connection/connect-client.js.map +1 -1
- package/dist/cjs/connection/existing-process-transport.d.cts +18 -18
- package/dist/cjs/connection/existing-process-transport.d.ts +18 -18
- package/dist/cjs/connection/existing-process-transport.js +187 -82
- package/dist/cjs/connection/existing-process-transport.js.map +1 -1
- package/dist/cjs/connection/wait-for-http-ready.d.cts +1 -1
- package/dist/cjs/connection/wait-for-http-ready.d.ts +1 -1
- package/dist/cjs/connection/wait-for-http-ready.js +30 -5
- package/dist/cjs/connection/wait-for-http-ready.js.map +1 -1
- package/dist/cjs/dcr/dcr-authenticator.d.cts +1 -1
- package/dist/cjs/dcr/dcr-authenticator.d.ts +1 -1
- package/dist/cjs/dcr/dcr-authenticator.js +29 -18
- package/dist/cjs/dcr/dcr-authenticator.js.map +1 -1
- package/dist/cjs/dcr/dynamic-client-registrar.js +2 -1
- package/dist/cjs/dcr/dynamic-client-registrar.js.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/spawn/owned-process-tree.d.cts +12 -0
- package/dist/cjs/spawn/owned-process-tree.d.ts +12 -0
- package/dist/cjs/spawn/owned-process-tree.js +93 -0
- package/dist/cjs/spawn/owned-process-tree.js.map +1 -0
- package/dist/cjs/spawn/spawn-server.d.cts +8 -32
- package/dist/cjs/spawn/spawn-server.d.ts +8 -32
- package/dist/cjs/spawn/spawn-server.js +406 -97
- package/dist/cjs/spawn/spawn-server.js.map +1 -1
- package/dist/cjs/spawn/spawn-servers.d.cts +18 -8
- package/dist/cjs/spawn/spawn-servers.d.ts +18 -8
- package/dist/cjs/spawn/spawn-servers.js +342 -113
- package/dist/cjs/spawn/spawn-servers.js.map +1 -1
- package/dist/cjs/types.d.cts +1 -1
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/path-utils.js +7 -4
- package/dist/cjs/utils/path-utils.js.map +1 -1
- package/dist/esm/auth/capability-discovery.d.ts +3 -1
- package/dist/esm/auth/capability-discovery.js +21 -11
- package/dist/esm/auth/capability-discovery.js.map +1 -1
- package/dist/esm/auth/discovery-fetch.d.ts +2 -0
- package/dist/esm/auth/discovery-fetch.js +64 -23
- package/dist/esm/auth/discovery-fetch.js.map +1 -1
- package/dist/esm/auth/interactive-oauth-flow.d.ts +1 -1
- package/dist/esm/auth/interactive-oauth-flow.js +13 -6
- package/dist/esm/auth/interactive-oauth-flow.js.map +1 -1
- package/dist/esm/auth/oauth-callback-listener.d.ts +1 -1
- package/dist/esm/auth/oauth-callback-listener.js +34 -4
- package/dist/esm/auth/oauth-callback-listener.js.map +1 -1
- package/dist/esm/auth/rfc9728-discovery.d.ts +7 -2
- package/dist/esm/auth/rfc9728-discovery.js +40 -16
- package/dist/esm/auth/rfc9728-discovery.js.map +1 -1
- package/dist/esm/auth/types.d.ts +4 -0
- package/dist/esm/auth/types.js.map +1 -1
- package/dist/esm/connection/connect-client.d.ts +9 -1
- package/dist/esm/connection/connect-client.js +97 -35
- package/dist/esm/connection/connect-client.js.map +1 -1
- package/dist/esm/connection/existing-process-transport.d.ts +18 -18
- package/dist/esm/connection/existing-process-transport.js +132 -70
- package/dist/esm/connection/existing-process-transport.js.map +1 -1
- package/dist/esm/connection/wait-for-http-ready.d.ts +1 -1
- package/dist/esm/connection/wait-for-http-ready.js +19 -4
- package/dist/esm/connection/wait-for-http-ready.js.map +1 -1
- package/dist/esm/dcr/dcr-authenticator.d.ts +1 -1
- package/dist/esm/dcr/dcr-authenticator.js +26 -15
- package/dist/esm/dcr/dcr-authenticator.js.map +1 -1
- package/dist/esm/dcr/dynamic-client-registrar.js +2 -1
- package/dist/esm/dcr/dynamic-client-registrar.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/spawn/owned-process-tree.d.ts +12 -0
- package/dist/esm/spawn/owned-process-tree.js +39 -0
- package/dist/esm/spawn/owned-process-tree.js.map +1 -0
- package/dist/esm/spawn/spawn-server.d.ts +8 -32
- package/dist/esm/spawn/spawn-server.js +228 -99
- package/dist/esm/spawn/spawn-server.js.map +1 -1
- package/dist/esm/spawn/spawn-servers.d.ts +18 -8
- package/dist/esm/spawn/spawn-servers.js +180 -55
- package/dist/esm/spawn/spawn-servers.js.map +1 -1
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/path-utils.js +7 -4
- package/dist/esm/utils/path-utils.js.map +1 -1
- package/package.json +8 -3
- package/schemas/servers.d.ts +24 -0
- package/schemas/servers.schema.json +31 -0
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* Supports stdio, http, and ws transports.
|
|
5
5
|
* Implements Claude Code-compatible configuration with start extension support.
|
|
6
6
|
*/
|
|
7
|
+
import type { VersionNegotiationOptions } from '@modelcontextprotocol/client';
|
|
7
8
|
import { type ManagedClient } from '../client-helpers.js';
|
|
8
|
-
import {
|
|
9
|
+
import type { DcrAuthenticatorOptions } from '../dcr/dcr-authenticator.js';
|
|
9
10
|
import { type SearchOptions, type SearchResponse } from '../search/index.js';
|
|
10
11
|
import type { McpServerEntry } from '../types.js';
|
|
12
|
+
import { type Logger } from '../utils/logger.js';
|
|
11
13
|
import { type ServerProcess } from './spawn-server.js';
|
|
12
14
|
/**
|
|
13
15
|
* Servers configuration type - a map of server names to their configurations.
|
|
@@ -45,16 +47,15 @@ export interface CreateServerRegistryOptions {
|
|
|
45
47
|
* Result of closing the registry.
|
|
46
48
|
*/
|
|
47
49
|
export interface CloseResult {
|
|
48
|
-
/** Whether any process
|
|
50
|
+
/** Whether any owned process exceeded its cooperative shutdown timeout */
|
|
49
51
|
timedOut: boolean;
|
|
50
|
-
/** Number of processes that
|
|
52
|
+
/** Number of owned processes that required emergency force termination */
|
|
51
53
|
killedCount: number;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* A registry of spawned MCP servers with connection management.
|
|
55
57
|
* Provides access to individual server handles, connection management, and collection-wide close.
|
|
56
58
|
*/
|
|
57
|
-
type RegistryConnectOptions = Parameters<typeof connectMcpClient>[2];
|
|
58
59
|
export interface ServerRegistry {
|
|
59
60
|
/**
|
|
60
61
|
* The resolved servers configuration that was used.
|
|
@@ -76,16 +77,26 @@ export interface ServerRegistry {
|
|
|
76
77
|
* The connected client is automatically tracked for close.
|
|
77
78
|
*
|
|
78
79
|
* @param name - Server name from configuration
|
|
80
|
+
* @param options - Authentication, logging, and protocol negotiation options
|
|
79
81
|
* @returns Connected MCP SDK Client
|
|
80
82
|
*/
|
|
81
|
-
connect: (name: string, options?:
|
|
83
|
+
connect: (name: string, options?: {
|
|
84
|
+
dcrAuthenticator?: Partial<DcrAuthenticatorOptions>;
|
|
85
|
+
logger?: Logger;
|
|
86
|
+
versionNegotiation?: VersionNegotiationOptions;
|
|
87
|
+
}) => Promise<ManagedClient>;
|
|
82
88
|
/**
|
|
83
89
|
* Close all clients and servers gracefully.
|
|
84
|
-
*
|
|
90
|
+
* Stops new connections, waits for in-flight connections, closes tracked clients, and then
|
|
91
|
+
* stops only processes owned by this registry. Stdio children receive stdin EOF first
|
|
92
|
+
* and the requested signal on POSIX if they remain open; owned HTTP children may use
|
|
93
|
+
* their configured application-specific stop command. POSIX cleanup tracks the detached
|
|
94
|
+
* process group; Windows can terminate only the direct child and cannot verify descendants.
|
|
95
|
+
* Cleanup failures are reported after every owned resource has been attempted.
|
|
85
96
|
*
|
|
86
97
|
* @param signal - Signal to send to processes (default: SIGINT)
|
|
87
98
|
* @param opts - Options including timeout
|
|
88
|
-
* @returns Promise resolving to whether any process timed out and how many
|
|
99
|
+
* @returns Promise resolving to whether any process timed out and how many required emergency force termination
|
|
89
100
|
*/
|
|
90
101
|
close: (signal?: NodeJS.Signals, opts?: {
|
|
91
102
|
timeoutMs?: number;
|
|
@@ -148,4 +159,3 @@ export interface ServerRegistry {
|
|
|
148
159
|
* // Auto-disposed when scope exits
|
|
149
160
|
*/
|
|
150
161
|
export declare function createServerRegistry(serversConfig: ServersConfig, options?: CreateServerRegistryOptions): ServerRegistry;
|
|
151
|
-
export {};
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* Supports stdio, http, and ws transports.
|
|
5
5
|
* Implements Claude Code-compatible configuration with start extension support.
|
|
6
6
|
*/
|
|
7
|
+
import type { VersionNegotiationOptions } from '@modelcontextprotocol/client';
|
|
7
8
|
import { type ManagedClient } from '../client-helpers.js';
|
|
8
|
-
import {
|
|
9
|
+
import type { DcrAuthenticatorOptions } from '../dcr/dcr-authenticator.js';
|
|
9
10
|
import { type SearchOptions, type SearchResponse } from '../search/index.js';
|
|
10
11
|
import type { McpServerEntry } from '../types.js';
|
|
12
|
+
import { type Logger } from '../utils/logger.js';
|
|
11
13
|
import { type ServerProcess } from './spawn-server.js';
|
|
12
14
|
/**
|
|
13
15
|
* Servers configuration type - a map of server names to their configurations.
|
|
@@ -45,16 +47,15 @@ export interface CreateServerRegistryOptions {
|
|
|
45
47
|
* Result of closing the registry.
|
|
46
48
|
*/
|
|
47
49
|
export interface CloseResult {
|
|
48
|
-
/** Whether any process
|
|
50
|
+
/** Whether any owned process exceeded its cooperative shutdown timeout */
|
|
49
51
|
timedOut: boolean;
|
|
50
|
-
/** Number of processes that
|
|
52
|
+
/** Number of owned processes that required emergency force termination */
|
|
51
53
|
killedCount: number;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* A registry of spawned MCP servers with connection management.
|
|
55
57
|
* Provides access to individual server handles, connection management, and collection-wide close.
|
|
56
58
|
*/
|
|
57
|
-
type RegistryConnectOptions = Parameters<typeof connectMcpClient>[2];
|
|
58
59
|
export interface ServerRegistry {
|
|
59
60
|
/**
|
|
60
61
|
* The resolved servers configuration that was used.
|
|
@@ -76,16 +77,26 @@ export interface ServerRegistry {
|
|
|
76
77
|
* The connected client is automatically tracked for close.
|
|
77
78
|
*
|
|
78
79
|
* @param name - Server name from configuration
|
|
80
|
+
* @param options - Authentication, logging, and protocol negotiation options
|
|
79
81
|
* @returns Connected MCP SDK Client
|
|
80
82
|
*/
|
|
81
|
-
connect: (name: string, options?:
|
|
83
|
+
connect: (name: string, options?: {
|
|
84
|
+
dcrAuthenticator?: Partial<DcrAuthenticatorOptions>;
|
|
85
|
+
logger?: Logger;
|
|
86
|
+
versionNegotiation?: VersionNegotiationOptions;
|
|
87
|
+
}) => Promise<ManagedClient>;
|
|
82
88
|
/**
|
|
83
89
|
* Close all clients and servers gracefully.
|
|
84
|
-
*
|
|
90
|
+
* Stops new connections, waits for in-flight connections, closes tracked clients, and then
|
|
91
|
+
* stops only processes owned by this registry. Stdio children receive stdin EOF first
|
|
92
|
+
* and the requested signal on POSIX if they remain open; owned HTTP children may use
|
|
93
|
+
* their configured application-specific stop command. POSIX cleanup tracks the detached
|
|
94
|
+
* process group; Windows can terminate only the direct child and cannot verify descendants.
|
|
95
|
+
* Cleanup failures are reported after every owned resource has been attempted.
|
|
85
96
|
*
|
|
86
97
|
* @param signal - Signal to send to processes (default: SIGINT)
|
|
87
98
|
* @param opts - Options including timeout
|
|
88
|
-
* @returns Promise resolving to whether any process timed out and how many
|
|
99
|
+
* @returns Promise resolving to whether any process timed out and how many required emergency force termination
|
|
89
100
|
*/
|
|
90
101
|
close: (signal?: NodeJS.Signals, opts?: {
|
|
91
102
|
timeoutMs?: number;
|
|
@@ -148,4 +159,3 @@ export interface ServerRegistry {
|
|
|
148
159
|
* // Auto-disposed when scope exits
|
|
149
160
|
*/
|
|
150
161
|
export declare function createServerRegistry(serversConfig: ServersConfig, options?: CreateServerRegistryOptions): ServerRegistry;
|
|
151
|
-
export {};
|