@voltagent/server-core 1.0.34 → 1.0.36
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.mts +26 -7
- package/dist/index.d.ts +26 -7
- package/dist/index.js +225 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +220 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1795,10 +1795,14 @@ interface AuthProvider<TRequest = any> {
|
|
|
1795
1795
|
* Default route configurations for authentication
|
|
1796
1796
|
*/
|
|
1797
1797
|
/**
|
|
1798
|
-
* Routes that don't require authentication by default
|
|
1799
|
-
* These are typically used by VoltOps and management tools
|
|
1798
|
+
* Routes that don't require authentication by default (legacy auth)
|
|
1800
1799
|
*/
|
|
1800
|
+
declare const DEFAULT_LEGACY_PUBLIC_ROUTES: string[];
|
|
1801
1801
|
declare const DEFAULT_PUBLIC_ROUTES: string[];
|
|
1802
|
+
/**
|
|
1803
|
+
* Routes that require console access when authNext is enabled
|
|
1804
|
+
*/
|
|
1805
|
+
declare const DEFAULT_CONSOLE_ROUTES: string[];
|
|
1802
1806
|
/**
|
|
1803
1807
|
* Routes that require authentication by default
|
|
1804
1808
|
* These endpoints execute operations, modify state, or access sensitive data
|
|
@@ -1833,6 +1837,18 @@ declare function pathMatches(path: string, pattern: string): boolean;
|
|
|
1833
1837
|
*/
|
|
1834
1838
|
declare function requiresAuth(method: string, path: string, publicRoutes?: string[], defaultPrivate?: boolean): boolean;
|
|
1835
1839
|
|
|
1840
|
+
type AuthNextAccess = "public" | "console" | "user";
|
|
1841
|
+
interface AuthNextRoutesConfig {
|
|
1842
|
+
publicRoutes?: string[];
|
|
1843
|
+
consoleRoutes?: string[];
|
|
1844
|
+
}
|
|
1845
|
+
interface AuthNextConfig<TRequest = any> extends AuthNextRoutesConfig {
|
|
1846
|
+
provider: AuthProvider<TRequest>;
|
|
1847
|
+
}
|
|
1848
|
+
declare function isAuthNextConfig<TRequest>(value: AuthProvider<TRequest> | AuthNextConfig<TRequest>): value is AuthNextConfig<TRequest>;
|
|
1849
|
+
declare function normalizeAuthNextConfig<TRequest>(value: AuthProvider<TRequest> | AuthNextConfig<TRequest>): AuthNextConfig<TRequest>;
|
|
1850
|
+
declare function resolveAuthNextAccess<TRequest>(method: string, path: string, authNext: AuthNextConfig<TRequest> | AuthProvider<TRequest>): AuthNextAccess;
|
|
1851
|
+
|
|
1836
1852
|
/**
|
|
1837
1853
|
* Authentication utility functions
|
|
1838
1854
|
*/
|
|
@@ -1879,6 +1895,9 @@ declare function isDevRequest(req: Request): boolean;
|
|
|
1879
1895
|
* // Production with console key
|
|
1880
1896
|
* NODE_ENV=production + x-console-access-key=valid-key → true
|
|
1881
1897
|
*
|
|
1898
|
+
* // Production with console key in query param
|
|
1899
|
+
* NODE_ENV=production + ?key=valid-key → true
|
|
1900
|
+
*
|
|
1882
1901
|
* // Production without key
|
|
1883
1902
|
* NODE_ENV=production + no key → false
|
|
1884
1903
|
*
|
|
@@ -2243,19 +2262,19 @@ declare function createWebSocketRouter(): WebSocketRouter;
|
|
|
2243
2262
|
* Create and configure a WebSocket server
|
|
2244
2263
|
* @param deps Server provider dependencies
|
|
2245
2264
|
* @param logger Logger instance
|
|
2246
|
-
* @param auth Optional authentication provider
|
|
2265
|
+
* @param auth Optional authentication provider or authNext config
|
|
2247
2266
|
* @returns Configured WebSocket server
|
|
2248
2267
|
*/
|
|
2249
|
-
declare function createWebSocketServer(deps: ServerProviderDeps, logger: Logger, _auth?: AuthProvider<any>): WebSocketServer;
|
|
2268
|
+
declare function createWebSocketServer(deps: ServerProviderDeps, logger: Logger, _auth?: AuthProvider<any> | AuthNextConfig<any>): WebSocketServer;
|
|
2250
2269
|
/**
|
|
2251
2270
|
* Setup WebSocket upgrade handler for HTTP server
|
|
2252
2271
|
* @param server HTTP server instance
|
|
2253
2272
|
* @param wss WebSocket server instance
|
|
2254
2273
|
* @param pathPrefix Path prefix for WebSocket connections (default: "/ws")
|
|
2255
|
-
* @param auth Optional authentication provider
|
|
2274
|
+
* @param auth Optional authentication provider or authNext config
|
|
2256
2275
|
* @param logger Logger instance
|
|
2257
2276
|
*/
|
|
2258
|
-
declare function setupWebSocketUpgrade(server: any, wss: WebSocketServer, pathPrefix?: string, auth?: AuthProvider<any>, logger?: Logger): void;
|
|
2277
|
+
declare function setupWebSocketUpgrade(server: any, wss: WebSocketServer, pathPrefix?: string, auth?: AuthProvider<any> | AuthNextConfig<any>, logger?: Logger): void;
|
|
2259
2278
|
|
|
2260
2279
|
/**
|
|
2261
2280
|
* WebSocket handler for Observability events
|
|
@@ -2354,4 +2373,4 @@ declare abstract class BaseServerProvider implements IServerProvider {
|
|
|
2354
2373
|
private collectFeatureEndpoints;
|
|
2355
2374
|
}
|
|
2356
2375
|
|
|
2357
|
-
export { A2AServerLikeWithHandlers, type A2AServerLookupResult, AgentListSchema, AgentParamsSchema, AgentResponseSchema, ApiResponse, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, type CLIAnnouncement, type CapabilityRecord, CustomEndpointError, type CustomEndpointHandler, DEFAULT_A2A_ROUTE_PREFIX, DEFAULT_A2A_WELL_KNOWN_PREFIX, DEFAULT_MCP_HTTP_SEGMENT, DEFAULT_MCP_MESSAGES_SEGMENT, DEFAULT_MCP_ROUTE_PREFIX, DEFAULT_MCP_SSE_SEGMENT, DEFAULT_PUBLIC_ROUTES, ErrorSchema, type FilterContext, GenerateOptionsSchema, HttpMethod, type IWebSocket, type JWTAuthOptions, type LogStreamClient, LogStreamManager, type MCPAgentMetadata, type MCPListedTool, type MCPServerCapabilitiesConfig, type MCPServerLike, type MCPServerMetadata, type MCPServerPackageInfo, type MCPServerRemoteInfo, type MCPToolMetadata, type MCPToolOrigin, type MCPWorkflowSummary, MCP_SESSION_QUERY_PARAM, type McpInvokeToolRequest, type McpInvokeToolResponse, type McpPromptDetailResponse, type McpPromptListResponse, type McpResourceDetailResponse, type McpResourceListResponse, type McpResourceTemplateListResponse, type McpRouteOptions, type McpRoutePaths, type McpServerDetailResponse, type McpServerListResponse, type McpServerLookupResult, McpSessionStore, type McpSetLogLevelRequest, type McpSetLogLevelResponse, type McpToolListResponse, ObjectRequestSchema, ObjectResponseSchema, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ProtocolConfig, type ProtocolRecord, type ServerEndpointSummary, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, StreamTextEventSchema, SubAgentResponseSchema, TextRequestSchema, TextResponseSchema, type TriggerHandlerHttpResponse, type TriggerHttpRequestContext, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowCancelRequestSchema, WorkflowCancelResponseSchema, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, buildA2AEndpointPath, buildAgentCardPath, buildMcpRoutePaths, cleanupWebSockets, closeAllObservabilityConnections, colors, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createWebSocketRouter, createWebSocketServer, executeTriggerHandler, fetchAnnouncements, formatSSE, getLandingPageHTML, getLogsBySpanIdHandler, getLogsByTraceIdHandler, getObservabilityStatusHandler, getPortsToTry, getSpanByIdHandler, getTraceByIdHandler, getTracesHandler, handleCheckUpdates, handleExecuteTool, handleGetMcpPrompt, handleGetMcpResource, handleGetMcpServer, handleInstallUpdates, handleInvokeMcpServerTool, handleListMcpPrompts, handleListMcpResourceTemplates, handleListMcpResources, handleListMcpServerTools, handleListMcpServers, handleListTools, handleObservabilityConnection, handleSetMcpLogLevel, handleWebSocketConnection, hasConsoleAccess, isDevRequest, jwtAuth, listA2AServers, listMcpServers, lookupA2AServer, lookupMcpServer, pathMatches, portManager, preferredPorts, printAnnouncements, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, setupObservabilityHandler, setupObservabilityListeners, setupWebSocketUpgrade, showAnnouncements, transformToSSE, validateBaseCustomEndpoint, validateEndpointMethod, validateEndpointPath };
|
|
2376
|
+
export { A2AServerLikeWithHandlers, type A2AServerLookupResult, AgentListSchema, AgentParamsSchema, AgentResponseSchema, ApiResponse, type AuthNextAccess, type AuthNextConfig, type AuthNextRoutesConfig, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, type CLIAnnouncement, type CapabilityRecord, CustomEndpointError, type CustomEndpointHandler, DEFAULT_A2A_ROUTE_PREFIX, DEFAULT_A2A_WELL_KNOWN_PREFIX, DEFAULT_CONSOLE_ROUTES, DEFAULT_LEGACY_PUBLIC_ROUTES, DEFAULT_MCP_HTTP_SEGMENT, DEFAULT_MCP_MESSAGES_SEGMENT, DEFAULT_MCP_ROUTE_PREFIX, DEFAULT_MCP_SSE_SEGMENT, DEFAULT_PUBLIC_ROUTES, ErrorSchema, type FilterContext, GenerateOptionsSchema, HttpMethod, type IWebSocket, type JWTAuthOptions, type LogStreamClient, LogStreamManager, type MCPAgentMetadata, type MCPListedTool, type MCPServerCapabilitiesConfig, type MCPServerLike, type MCPServerMetadata, type MCPServerPackageInfo, type MCPServerRemoteInfo, type MCPToolMetadata, type MCPToolOrigin, type MCPWorkflowSummary, MCP_SESSION_QUERY_PARAM, type McpInvokeToolRequest, type McpInvokeToolResponse, type McpPromptDetailResponse, type McpPromptListResponse, type McpResourceDetailResponse, type McpResourceListResponse, type McpResourceTemplateListResponse, type McpRouteOptions, type McpRoutePaths, type McpServerDetailResponse, type McpServerListResponse, type McpServerLookupResult, McpSessionStore, type McpSetLogLevelRequest, type McpSetLogLevelResponse, type McpToolListResponse, ObjectRequestSchema, ObjectResponseSchema, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ProtocolConfig, type ProtocolRecord, type ServerEndpointSummary, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, StreamTextEventSchema, SubAgentResponseSchema, TextRequestSchema, TextResponseSchema, type TriggerHandlerHttpResponse, type TriggerHttpRequestContext, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowCancelRequestSchema, WorkflowCancelResponseSchema, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, buildA2AEndpointPath, buildAgentCardPath, buildMcpRoutePaths, cleanupWebSockets, closeAllObservabilityConnections, colors, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createWebSocketRouter, createWebSocketServer, executeTriggerHandler, fetchAnnouncements, formatSSE, getLandingPageHTML, getLogsBySpanIdHandler, getLogsByTraceIdHandler, getObservabilityStatusHandler, getPortsToTry, getSpanByIdHandler, getTraceByIdHandler, getTracesHandler, handleCheckUpdates, handleExecuteTool, handleGetMcpPrompt, handleGetMcpResource, handleGetMcpServer, handleInstallUpdates, handleInvokeMcpServerTool, handleListMcpPrompts, handleListMcpResourceTemplates, handleListMcpResources, handleListMcpServerTools, handleListMcpServers, handleListTools, handleObservabilityConnection, handleSetMcpLogLevel, handleWebSocketConnection, hasConsoleAccess, isAuthNextConfig, isDevRequest, jwtAuth, listA2AServers, listMcpServers, lookupA2AServer, lookupMcpServer, normalizeAuthNextConfig, pathMatches, portManager, preferredPorts, printAnnouncements, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, resolveAuthNextAccess, setupObservabilityHandler, setupObservabilityListeners, setupWebSocketUpgrade, showAnnouncements, transformToSSE, validateBaseCustomEndpoint, validateEndpointMethod, validateEndpointPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -1795,10 +1795,14 @@ interface AuthProvider<TRequest = any> {
|
|
|
1795
1795
|
* Default route configurations for authentication
|
|
1796
1796
|
*/
|
|
1797
1797
|
/**
|
|
1798
|
-
* Routes that don't require authentication by default
|
|
1799
|
-
* These are typically used by VoltOps and management tools
|
|
1798
|
+
* Routes that don't require authentication by default (legacy auth)
|
|
1800
1799
|
*/
|
|
1800
|
+
declare const DEFAULT_LEGACY_PUBLIC_ROUTES: string[];
|
|
1801
1801
|
declare const DEFAULT_PUBLIC_ROUTES: string[];
|
|
1802
|
+
/**
|
|
1803
|
+
* Routes that require console access when authNext is enabled
|
|
1804
|
+
*/
|
|
1805
|
+
declare const DEFAULT_CONSOLE_ROUTES: string[];
|
|
1802
1806
|
/**
|
|
1803
1807
|
* Routes that require authentication by default
|
|
1804
1808
|
* These endpoints execute operations, modify state, or access sensitive data
|
|
@@ -1833,6 +1837,18 @@ declare function pathMatches(path: string, pattern: string): boolean;
|
|
|
1833
1837
|
*/
|
|
1834
1838
|
declare function requiresAuth(method: string, path: string, publicRoutes?: string[], defaultPrivate?: boolean): boolean;
|
|
1835
1839
|
|
|
1840
|
+
type AuthNextAccess = "public" | "console" | "user";
|
|
1841
|
+
interface AuthNextRoutesConfig {
|
|
1842
|
+
publicRoutes?: string[];
|
|
1843
|
+
consoleRoutes?: string[];
|
|
1844
|
+
}
|
|
1845
|
+
interface AuthNextConfig<TRequest = any> extends AuthNextRoutesConfig {
|
|
1846
|
+
provider: AuthProvider<TRequest>;
|
|
1847
|
+
}
|
|
1848
|
+
declare function isAuthNextConfig<TRequest>(value: AuthProvider<TRequest> | AuthNextConfig<TRequest>): value is AuthNextConfig<TRequest>;
|
|
1849
|
+
declare function normalizeAuthNextConfig<TRequest>(value: AuthProvider<TRequest> | AuthNextConfig<TRequest>): AuthNextConfig<TRequest>;
|
|
1850
|
+
declare function resolveAuthNextAccess<TRequest>(method: string, path: string, authNext: AuthNextConfig<TRequest> | AuthProvider<TRequest>): AuthNextAccess;
|
|
1851
|
+
|
|
1836
1852
|
/**
|
|
1837
1853
|
* Authentication utility functions
|
|
1838
1854
|
*/
|
|
@@ -1879,6 +1895,9 @@ declare function isDevRequest(req: Request): boolean;
|
|
|
1879
1895
|
* // Production with console key
|
|
1880
1896
|
* NODE_ENV=production + x-console-access-key=valid-key → true
|
|
1881
1897
|
*
|
|
1898
|
+
* // Production with console key in query param
|
|
1899
|
+
* NODE_ENV=production + ?key=valid-key → true
|
|
1900
|
+
*
|
|
1882
1901
|
* // Production without key
|
|
1883
1902
|
* NODE_ENV=production + no key → false
|
|
1884
1903
|
*
|
|
@@ -2243,19 +2262,19 @@ declare function createWebSocketRouter(): WebSocketRouter;
|
|
|
2243
2262
|
* Create and configure a WebSocket server
|
|
2244
2263
|
* @param deps Server provider dependencies
|
|
2245
2264
|
* @param logger Logger instance
|
|
2246
|
-
* @param auth Optional authentication provider
|
|
2265
|
+
* @param auth Optional authentication provider or authNext config
|
|
2247
2266
|
* @returns Configured WebSocket server
|
|
2248
2267
|
*/
|
|
2249
|
-
declare function createWebSocketServer(deps: ServerProviderDeps, logger: Logger, _auth?: AuthProvider<any>): WebSocketServer;
|
|
2268
|
+
declare function createWebSocketServer(deps: ServerProviderDeps, logger: Logger, _auth?: AuthProvider<any> | AuthNextConfig<any>): WebSocketServer;
|
|
2250
2269
|
/**
|
|
2251
2270
|
* Setup WebSocket upgrade handler for HTTP server
|
|
2252
2271
|
* @param server HTTP server instance
|
|
2253
2272
|
* @param wss WebSocket server instance
|
|
2254
2273
|
* @param pathPrefix Path prefix for WebSocket connections (default: "/ws")
|
|
2255
|
-
* @param auth Optional authentication provider
|
|
2274
|
+
* @param auth Optional authentication provider or authNext config
|
|
2256
2275
|
* @param logger Logger instance
|
|
2257
2276
|
*/
|
|
2258
|
-
declare function setupWebSocketUpgrade(server: any, wss: WebSocketServer, pathPrefix?: string, auth?: AuthProvider<any>, logger?: Logger): void;
|
|
2277
|
+
declare function setupWebSocketUpgrade(server: any, wss: WebSocketServer, pathPrefix?: string, auth?: AuthProvider<any> | AuthNextConfig<any>, logger?: Logger): void;
|
|
2259
2278
|
|
|
2260
2279
|
/**
|
|
2261
2280
|
* WebSocket handler for Observability events
|
|
@@ -2354,4 +2373,4 @@ declare abstract class BaseServerProvider implements IServerProvider {
|
|
|
2354
2373
|
private collectFeatureEndpoints;
|
|
2355
2374
|
}
|
|
2356
2375
|
|
|
2357
|
-
export { A2AServerLikeWithHandlers, type A2AServerLookupResult, AgentListSchema, AgentParamsSchema, AgentResponseSchema, ApiResponse, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, type CLIAnnouncement, type CapabilityRecord, CustomEndpointError, type CustomEndpointHandler, DEFAULT_A2A_ROUTE_PREFIX, DEFAULT_A2A_WELL_KNOWN_PREFIX, DEFAULT_MCP_HTTP_SEGMENT, DEFAULT_MCP_MESSAGES_SEGMENT, DEFAULT_MCP_ROUTE_PREFIX, DEFAULT_MCP_SSE_SEGMENT, DEFAULT_PUBLIC_ROUTES, ErrorSchema, type FilterContext, GenerateOptionsSchema, HttpMethod, type IWebSocket, type JWTAuthOptions, type LogStreamClient, LogStreamManager, type MCPAgentMetadata, type MCPListedTool, type MCPServerCapabilitiesConfig, type MCPServerLike, type MCPServerMetadata, type MCPServerPackageInfo, type MCPServerRemoteInfo, type MCPToolMetadata, type MCPToolOrigin, type MCPWorkflowSummary, MCP_SESSION_QUERY_PARAM, type McpInvokeToolRequest, type McpInvokeToolResponse, type McpPromptDetailResponse, type McpPromptListResponse, type McpResourceDetailResponse, type McpResourceListResponse, type McpResourceTemplateListResponse, type McpRouteOptions, type McpRoutePaths, type McpServerDetailResponse, type McpServerListResponse, type McpServerLookupResult, McpSessionStore, type McpSetLogLevelRequest, type McpSetLogLevelResponse, type McpToolListResponse, ObjectRequestSchema, ObjectResponseSchema, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ProtocolConfig, type ProtocolRecord, type ServerEndpointSummary, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, StreamTextEventSchema, SubAgentResponseSchema, TextRequestSchema, TextResponseSchema, type TriggerHandlerHttpResponse, type TriggerHttpRequestContext, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowCancelRequestSchema, WorkflowCancelResponseSchema, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, buildA2AEndpointPath, buildAgentCardPath, buildMcpRoutePaths, cleanupWebSockets, closeAllObservabilityConnections, colors, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createWebSocketRouter, createWebSocketServer, executeTriggerHandler, fetchAnnouncements, formatSSE, getLandingPageHTML, getLogsBySpanIdHandler, getLogsByTraceIdHandler, getObservabilityStatusHandler, getPortsToTry, getSpanByIdHandler, getTraceByIdHandler, getTracesHandler, handleCheckUpdates, handleExecuteTool, handleGetMcpPrompt, handleGetMcpResource, handleGetMcpServer, handleInstallUpdates, handleInvokeMcpServerTool, handleListMcpPrompts, handleListMcpResourceTemplates, handleListMcpResources, handleListMcpServerTools, handleListMcpServers, handleListTools, handleObservabilityConnection, handleSetMcpLogLevel, handleWebSocketConnection, hasConsoleAccess, isDevRequest, jwtAuth, listA2AServers, listMcpServers, lookupA2AServer, lookupMcpServer, pathMatches, portManager, preferredPorts, printAnnouncements, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, setupObservabilityHandler, setupObservabilityListeners, setupWebSocketUpgrade, showAnnouncements, transformToSSE, validateBaseCustomEndpoint, validateEndpointMethod, validateEndpointPath };
|
|
2376
|
+
export { A2AServerLikeWithHandlers, type A2AServerLookupResult, AgentListSchema, AgentParamsSchema, AgentResponseSchema, ApiResponse, type AuthNextAccess, type AuthNextConfig, type AuthNextRoutesConfig, type AuthProvider, type BaseCustomEndpointDefinition, type BaseServerConfig, BaseServerProvider, BasicJsonSchema, type CLIAnnouncement, type CapabilityRecord, CustomEndpointError, type CustomEndpointHandler, DEFAULT_A2A_ROUTE_PREFIX, DEFAULT_A2A_WELL_KNOWN_PREFIX, DEFAULT_CONSOLE_ROUTES, DEFAULT_LEGACY_PUBLIC_ROUTES, DEFAULT_MCP_HTTP_SEGMENT, DEFAULT_MCP_MESSAGES_SEGMENT, DEFAULT_MCP_ROUTE_PREFIX, DEFAULT_MCP_SSE_SEGMENT, DEFAULT_PUBLIC_ROUTES, ErrorSchema, type FilterContext, GenerateOptionsSchema, HttpMethod, type IWebSocket, type JWTAuthOptions, type LogStreamClient, LogStreamManager, type MCPAgentMetadata, type MCPListedTool, type MCPServerCapabilitiesConfig, type MCPServerLike, type MCPServerMetadata, type MCPServerPackageInfo, type MCPServerRemoteInfo, type MCPToolMetadata, type MCPToolOrigin, type MCPWorkflowSummary, MCP_SESSION_QUERY_PARAM, type McpInvokeToolRequest, type McpInvokeToolResponse, type McpPromptDetailResponse, type McpPromptListResponse, type McpResourceDetailResponse, type McpResourceListResponse, type McpResourceTemplateListResponse, type McpRouteOptions, type McpRoutePaths, type McpServerDetailResponse, type McpServerListResponse, type McpServerLookupResult, McpSessionStore, type McpSetLogLevelRequest, type McpSetLogLevelResponse, type McpToolListResponse, ObjectRequestSchema, ObjectResponseSchema, PROTECTED_ROUTES, ParamsSchema, type PortConfig, type ProcessedAgentOptions, type ProtocolConfig, type ProtocolRecord, type ServerEndpointSummary, type ServerProviderConfig, type ServerStartupOptions, StreamObjectEventSchema, StreamTextEventSchema, SubAgentResponseSchema, TextRequestSchema, TextResponseSchema, type TriggerHandlerHttpResponse, type TriggerHttpRequestContext, type WebSocketAdapter, type WebSocketConnectionHandler, type WebSocketConnectionInfo, type WebSocketEventHandlers, type WebSocketMessage, WebSocketRouter, WorkflowCancelRequestSchema, WorkflowCancelResponseSchema, WorkflowExecutionParamsSchema, WorkflowExecutionRequestSchema, WorkflowExecutionResponseSchema, WorkflowListSchema, WorkflowParamsSchema, WorkflowResponseSchema, WorkflowResumeRequestSchema, WorkflowResumeResponseSchema, WorkflowStreamEventSchema, WorkflowSuspendRequestSchema, WorkflowSuspendResponseSchema, buildA2AEndpointPath, buildAgentCardPath, buildMcpRoutePaths, cleanupWebSockets, closeAllObservabilityConnections, colors, createJWT, createSSEHeaders, createSSEResponse, createSSEStream, createWebSocketRouter, createWebSocketServer, executeTriggerHandler, fetchAnnouncements, formatSSE, getLandingPageHTML, getLogsBySpanIdHandler, getLogsByTraceIdHandler, getObservabilityStatusHandler, getPortsToTry, getSpanByIdHandler, getTraceByIdHandler, getTracesHandler, handleCheckUpdates, handleExecuteTool, handleGetMcpPrompt, handleGetMcpResource, handleGetMcpServer, handleInstallUpdates, handleInvokeMcpServerTool, handleListMcpPrompts, handleListMcpResourceTemplates, handleListMcpResources, handleListMcpServerTools, handleListMcpServers, handleListTools, handleObservabilityConnection, handleSetMcpLogLevel, handleWebSocketConnection, hasConsoleAccess, isAuthNextConfig, isDevRequest, jwtAuth, listA2AServers, listMcpServers, lookupA2AServer, lookupMcpServer, normalizeAuthNextConfig, pathMatches, portManager, preferredPorts, printAnnouncements, printServerStartup, processAgentOptions, processWorkflowOptions, queryLogsHandler, requiresAuth, resolveAuthNextAccess, setupObservabilityHandler, setupObservabilityListeners, setupWebSocketUpgrade, showAnnouncements, transformToSSE, validateBaseCustomEndpoint, validateEndpointMethod, validateEndpointPath };
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,9 @@ __export(index_exports, {
|
|
|
43
43
|
CustomEndpointError: () => CustomEndpointError,
|
|
44
44
|
DEFAULT_A2A_ROUTE_PREFIX: () => DEFAULT_A2A_ROUTE_PREFIX,
|
|
45
45
|
DEFAULT_A2A_WELL_KNOWN_PREFIX: () => DEFAULT_A2A_WELL_KNOWN_PREFIX,
|
|
46
|
+
DEFAULT_CONSOLE_ROUTES: () => DEFAULT_CONSOLE_ROUTES,
|
|
46
47
|
DEFAULT_CORS_OPTIONS: () => DEFAULT_CORS_OPTIONS,
|
|
48
|
+
DEFAULT_LEGACY_PUBLIC_ROUTES: () => DEFAULT_LEGACY_PUBLIC_ROUTES,
|
|
47
49
|
DEFAULT_MCP_HTTP_SEGMENT: () => DEFAULT_MCP_HTTP_SEGMENT,
|
|
48
50
|
DEFAULT_MCP_MESSAGES_SEGMENT: () => DEFAULT_MCP_MESSAGES_SEGMENT,
|
|
49
51
|
DEFAULT_MCP_ROUTE_PREFIX: () => DEFAULT_MCP_ROUTE_PREFIX,
|
|
@@ -152,6 +154,7 @@ __export(index_exports, {
|
|
|
152
154
|
handleSuspendWorkflow: () => handleSuspendWorkflow,
|
|
153
155
|
handleWebSocketConnection: () => handleWebSocketConnection,
|
|
154
156
|
hasConsoleAccess: () => hasConsoleAccess,
|
|
157
|
+
isAuthNextConfig: () => isAuthNextConfig,
|
|
155
158
|
isDevRequest: () => isDevRequest,
|
|
156
159
|
isErrorResponse: () => isErrorResponse,
|
|
157
160
|
isJsonRpcRequest: () => isJsonRpcRequest,
|
|
@@ -165,6 +168,7 @@ __export(index_exports, {
|
|
|
165
168
|
lookupMcpServer: () => lookupMcpServer,
|
|
166
169
|
mapHandlerResponse: () => mapHandlerResponse,
|
|
167
170
|
mapLogResponse: () => mapLogResponse,
|
|
171
|
+
normalizeAuthNextConfig: () => normalizeAuthNextConfig,
|
|
168
172
|
normalizeError: () => normalizeError,
|
|
169
173
|
parseJsonRpcRequest: () => parseJsonRpcRequest,
|
|
170
174
|
pathMatches: () => pathMatches,
|
|
@@ -177,6 +181,7 @@ __export(index_exports, {
|
|
|
177
181
|
queryLogsHandler: () => queryLogsHandler,
|
|
178
182
|
requiresAuth: () => requiresAuth,
|
|
179
183
|
resolveAgentCard: () => resolveAgentCard,
|
|
184
|
+
resolveAuthNextAccess: () => resolveAuthNextAccess,
|
|
180
185
|
setupObservabilityHandler: () => setupObservabilityHandler,
|
|
181
186
|
setupObservabilityListeners: () => setupObservabilityListeners,
|
|
182
187
|
setupWebSocketUpgrade: () => setupWebSocketUpgrade,
|
|
@@ -4066,7 +4071,7 @@ VOLTAGENT_SECRET_KEY=${secretKey}
|
|
|
4066
4071
|
__name(setupObservabilityHandler, "setupObservabilityHandler");
|
|
4067
4072
|
|
|
4068
4073
|
// src/auth/defaults.ts
|
|
4069
|
-
var
|
|
4074
|
+
var DEFAULT_LEGACY_PUBLIC_ROUTES = [
|
|
4070
4075
|
// Agent management endpoints (VoltOps uses these)
|
|
4071
4076
|
"GET /agents",
|
|
4072
4077
|
// List all agents
|
|
@@ -4094,6 +4099,47 @@ var DEFAULT_PUBLIC_ROUTES = [
|
|
|
4094
4099
|
// A2A (agent-to-agent discovery)
|
|
4095
4100
|
"GET /agents/:id/card"
|
|
4096
4101
|
];
|
|
4102
|
+
var DEFAULT_PUBLIC_ROUTES = DEFAULT_LEGACY_PUBLIC_ROUTES;
|
|
4103
|
+
var DEFAULT_CONSOLE_ROUTES = [
|
|
4104
|
+
// Agent management endpoints (VoltOps uses these)
|
|
4105
|
+
"GET /agents",
|
|
4106
|
+
// List all agents
|
|
4107
|
+
"GET /agents/:id",
|
|
4108
|
+
// Get agent details
|
|
4109
|
+
// Workflow management endpoints
|
|
4110
|
+
"GET /workflows",
|
|
4111
|
+
// List all workflows
|
|
4112
|
+
"GET /workflows/:id",
|
|
4113
|
+
// Get workflow details
|
|
4114
|
+
// Tool management endpoints
|
|
4115
|
+
"GET /tools",
|
|
4116
|
+
// List all tools
|
|
4117
|
+
// API documentation
|
|
4118
|
+
"GET /doc",
|
|
4119
|
+
// OpenAPI spec
|
|
4120
|
+
"GET /ui",
|
|
4121
|
+
// Swagger UI
|
|
4122
|
+
"GET /",
|
|
4123
|
+
// Landing page
|
|
4124
|
+
// MCP (public discovery)
|
|
4125
|
+
"GET /mcp/servers",
|
|
4126
|
+
"GET /mcp/servers/:serverId",
|
|
4127
|
+
"GET /mcp/servers/:serverId/tools",
|
|
4128
|
+
// A2A (agent-to-agent discovery)
|
|
4129
|
+
"GET /agents/:id/card",
|
|
4130
|
+
"GET /agents/:id/history",
|
|
4131
|
+
"GET /workflows/executions",
|
|
4132
|
+
"GET /workflows/:id/executions/:executionId/state",
|
|
4133
|
+
"GET /api/logs",
|
|
4134
|
+
"POST /setup-observability",
|
|
4135
|
+
"/observability/*",
|
|
4136
|
+
"GET /updates",
|
|
4137
|
+
"POST /updates",
|
|
4138
|
+
"POST /updates/:packageName",
|
|
4139
|
+
"WS /ws",
|
|
4140
|
+
"WS /ws/logs",
|
|
4141
|
+
"WS /ws/observability/**"
|
|
4142
|
+
];
|
|
4097
4143
|
var PROTECTED_ROUTES = [
|
|
4098
4144
|
// ========================================
|
|
4099
4145
|
// AGENT EXECUTION (User Data)
|
|
@@ -4183,7 +4229,7 @@ function pathMatches(path2, pattern) {
|
|
|
4183
4229
|
}
|
|
4184
4230
|
__name(pathMatches, "pathMatches");
|
|
4185
4231
|
function requiresAuth(method, path2, publicRoutes, defaultPrivate) {
|
|
4186
|
-
for (const publicRoute of
|
|
4232
|
+
for (const publicRoute of DEFAULT_LEGACY_PUBLIC_ROUTES) {
|
|
4187
4233
|
if (publicRoute.includes(" ")) {
|
|
4188
4234
|
const [routeMethod, routePath] = publicRoute.split(" ");
|
|
4189
4235
|
if (method.toUpperCase() === routeMethod && pathMatches(path2, routePath)) {
|
|
@@ -4226,6 +4272,48 @@ function requiresAuth(method, path2, publicRoutes, defaultPrivate) {
|
|
|
4226
4272
|
}
|
|
4227
4273
|
__name(requiresAuth, "requiresAuth");
|
|
4228
4274
|
|
|
4275
|
+
// src/auth/next.ts
|
|
4276
|
+
function isAuthNextConfig(value) {
|
|
4277
|
+
return typeof value.provider !== "undefined";
|
|
4278
|
+
}
|
|
4279
|
+
__name(isAuthNextConfig, "isAuthNextConfig");
|
|
4280
|
+
function normalizeAuthNextConfig(value) {
|
|
4281
|
+
return isAuthNextConfig(value) ? value : { provider: value };
|
|
4282
|
+
}
|
|
4283
|
+
__name(normalizeAuthNextConfig, "normalizeAuthNextConfig");
|
|
4284
|
+
function routeMatches(method, path2, routePattern) {
|
|
4285
|
+
const parts = routePattern.split(" ");
|
|
4286
|
+
if (parts.length === 2) {
|
|
4287
|
+
const [routeMethod, routePath] = parts;
|
|
4288
|
+
if (method.toUpperCase() !== routeMethod.toUpperCase()) {
|
|
4289
|
+
return false;
|
|
4290
|
+
}
|
|
4291
|
+
return pathMatches(path2, routePath);
|
|
4292
|
+
}
|
|
4293
|
+
return pathMatches(path2, routePattern);
|
|
4294
|
+
}
|
|
4295
|
+
__name(routeMatches, "routeMatches");
|
|
4296
|
+
function matchesAnyRoute(method, path2, routes) {
|
|
4297
|
+
if (!routes || routes.length === 0) {
|
|
4298
|
+
return false;
|
|
4299
|
+
}
|
|
4300
|
+
return routes.some((route) => routeMatches(method, path2, route));
|
|
4301
|
+
}
|
|
4302
|
+
__name(matchesAnyRoute, "matchesAnyRoute");
|
|
4303
|
+
function resolveAuthNextAccess(method, path2, authNext) {
|
|
4304
|
+
const config = normalizeAuthNextConfig(authNext);
|
|
4305
|
+
const publicRoutes = [...config.publicRoutes ?? [], ...config.provider.publicRoutes ?? []];
|
|
4306
|
+
if (matchesAnyRoute(method, path2, publicRoutes)) {
|
|
4307
|
+
return "public";
|
|
4308
|
+
}
|
|
4309
|
+
const consoleRoutes = config.consoleRoutes ?? DEFAULT_CONSOLE_ROUTES;
|
|
4310
|
+
if (matchesAnyRoute(method, path2, consoleRoutes)) {
|
|
4311
|
+
return "console";
|
|
4312
|
+
}
|
|
4313
|
+
return "user";
|
|
4314
|
+
}
|
|
4315
|
+
__name(resolveAuthNextAccess, "resolveAuthNextAccess");
|
|
4316
|
+
|
|
4229
4317
|
// src/auth/utils.ts
|
|
4230
4318
|
function isDevRequest(req) {
|
|
4231
4319
|
const hasDevHeader = req.headers.get("x-voltagent-dev") === "true";
|
|
@@ -4238,8 +4326,10 @@ function hasConsoleAccess(req) {
|
|
|
4238
4326
|
return true;
|
|
4239
4327
|
}
|
|
4240
4328
|
const consoleKey = req.headers.get("x-console-access-key");
|
|
4329
|
+
const url = new URL(req.url, "http://localhost");
|
|
4330
|
+
const queryKey = url.searchParams.get("key");
|
|
4241
4331
|
const configuredKey = process.env.VOLTAGENT_CONSOLE_ACCESS_KEY;
|
|
4242
|
-
if (configuredKey && consoleKey === configuredKey) {
|
|
4332
|
+
if (configuredKey && (consoleKey === configuredKey || queryKey === configuredKey)) {
|
|
4243
4333
|
return true;
|
|
4244
4334
|
}
|
|
4245
4335
|
return false;
|
|
@@ -4511,7 +4601,7 @@ function printServerStartup(port, options = {}) {
|
|
|
4511
4601
|
}
|
|
4512
4602
|
groupMap.get(groupLabel)?.push(endpoint);
|
|
4513
4603
|
});
|
|
4514
|
-
const methodOrder = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
|
4604
|
+
const methodOrder = ["STDIO", "GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
|
4515
4605
|
groupMap.forEach((endpoints, groupLabel) => {
|
|
4516
4606
|
console.log();
|
|
4517
4607
|
console.log(
|
|
@@ -4529,12 +4619,14 @@ function printServerStartup(port, options = {}) {
|
|
|
4529
4619
|
methodOrder.forEach((method) => {
|
|
4530
4620
|
if (methodGroups[method]) {
|
|
4531
4621
|
methodGroups[method].forEach((endpoint) => {
|
|
4532
|
-
const
|
|
4533
|
-
const
|
|
4622
|
+
const isMcpStdio = groupLabel === "MCP Transport" && method === "STDIO";
|
|
4623
|
+
const displayPath = isMcpStdio ? 'uses stdin/stdout. Example client: { type: "stdio", command: "node", args: ["dist/index.js"] }' : endpoint.path;
|
|
4624
|
+
const pathText = `${colors.white}${displayPath}${colors.reset}`;
|
|
4625
|
+
const nameText = endpoint.name && !isMcpStdio ? `${colors.dim} (${endpoint.name})${colors.reset}` : "";
|
|
4534
4626
|
console.log(
|
|
4535
4627
|
`${colors.dim} ${method.padEnd(6)} ${colors.reset}${pathText}${nameText}`
|
|
4536
4628
|
);
|
|
4537
|
-
if (endpoint.description) {
|
|
4629
|
+
if (endpoint.description && !isMcpStdio) {
|
|
4538
4630
|
console.log(`${colors.dim} ${endpoint.description}${colors.reset}`);
|
|
4539
4631
|
}
|
|
4540
4632
|
});
|
|
@@ -5196,13 +5288,16 @@ function isDevWebSocketRequest(req) {
|
|
|
5196
5288
|
return hasDevHeader && isDevEnv;
|
|
5197
5289
|
}
|
|
5198
5290
|
__name(isDevWebSocketRequest, "isDevWebSocketRequest");
|
|
5199
|
-
function
|
|
5200
|
-
const url = new URL(req.url || "", `http://${req.headers.host || "localhost"}`);
|
|
5291
|
+
function isWebSocketDevBypass(req, url) {
|
|
5201
5292
|
if (isDevWebSocketRequest(req)) {
|
|
5202
5293
|
return true;
|
|
5203
5294
|
}
|
|
5204
5295
|
const devParam = url.searchParams.get("dev");
|
|
5205
|
-
|
|
5296
|
+
return devParam === "true" && process.env.NODE_ENV !== "production";
|
|
5297
|
+
}
|
|
5298
|
+
__name(isWebSocketDevBypass, "isWebSocketDevBypass");
|
|
5299
|
+
function hasWebSocketConsoleAccess(req, url) {
|
|
5300
|
+
if (isWebSocketDevBypass(req, url)) {
|
|
5206
5301
|
return true;
|
|
5207
5302
|
}
|
|
5208
5303
|
const configuredKey = process.env.VOLTAGENT_CONSOLE_ACCESS_KEY;
|
|
@@ -5235,26 +5330,34 @@ function setupWebSocketUpgrade(server, wss, pathPrefix = "/ws", auth, logger) {
|
|
|
5235
5330
|
let user = null;
|
|
5236
5331
|
if (auth) {
|
|
5237
5332
|
try {
|
|
5238
|
-
if (
|
|
5239
|
-
const
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5333
|
+
if (isAuthNextConfig(auth)) {
|
|
5334
|
+
const config = normalizeAuthNextConfig(auth);
|
|
5335
|
+
const provider = config.provider;
|
|
5336
|
+
const access = resolveAuthNextAccess("WS", path2, config);
|
|
5337
|
+
if (access === "public") {
|
|
5338
|
+
const token = url.searchParams.get("token");
|
|
5339
|
+
if (token) {
|
|
5340
|
+
try {
|
|
5341
|
+
user = await provider.verifyToken(token);
|
|
5342
|
+
} catch {
|
|
5343
|
+
}
|
|
5344
|
+
}
|
|
5345
|
+
} else if (access === "console") {
|
|
5346
|
+
const hasAccess = hasWebSocketConsoleAccess(req, url);
|
|
5347
|
+
if (!hasAccess) {
|
|
5348
|
+
logger?.debug("[WebSocket] Unauthorized console connection attempt");
|
|
5349
|
+
socket.write("HTTP/1.1 401 Unauthorized\r\n\r\n");
|
|
5350
|
+
socket.destroy();
|
|
5351
|
+
return;
|
|
5352
|
+
}
|
|
5250
5353
|
user = { id: "console", type: "console-access" };
|
|
5251
5354
|
} else {
|
|
5252
|
-
|
|
5253
|
-
|
|
5355
|
+
if (isWebSocketDevBypass(req, url)) {
|
|
5356
|
+
} else {
|
|
5254
5357
|
const token = url.searchParams.get("token");
|
|
5255
5358
|
if (token) {
|
|
5256
5359
|
try {
|
|
5257
|
-
user = await
|
|
5360
|
+
user = await provider.verifyToken(token);
|
|
5258
5361
|
} catch (error) {
|
|
5259
5362
|
logger?.debug("[WebSocket] Token verification failed:", { error });
|
|
5260
5363
|
socket.write("HTTP/1.1 401 Unauthorized\r\n\r\n");
|
|
@@ -5267,12 +5370,48 @@ function setupWebSocketUpgrade(server, wss, pathPrefix = "/ws", auth, logger) {
|
|
|
5267
5370
|
socket.destroy();
|
|
5268
5371
|
return;
|
|
5269
5372
|
}
|
|
5373
|
+
}
|
|
5374
|
+
}
|
|
5375
|
+
} else {
|
|
5376
|
+
if (path2.includes("/observability")) {
|
|
5377
|
+
const hasAccess = hasWebSocketConsoleAccess(req, url);
|
|
5378
|
+
if (!hasAccess) {
|
|
5379
|
+
logger?.debug("[WebSocket] Unauthorized observability connection attempt");
|
|
5380
|
+
socket.write("HTTP/1.1 401 Unauthorized\r\n\r\n");
|
|
5381
|
+
socket.destroy();
|
|
5382
|
+
return;
|
|
5383
|
+
}
|
|
5384
|
+
user = { id: "console", type: "console-access" };
|
|
5385
|
+
} else {
|
|
5386
|
+
const hasConsoleAccess2 = hasWebSocketConsoleAccess(req, url);
|
|
5387
|
+
if (hasConsoleAccess2) {
|
|
5388
|
+
user = { id: "console", type: "console-access" };
|
|
5270
5389
|
} else {
|
|
5271
|
-
const
|
|
5272
|
-
if (
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5390
|
+
const needsAuth = requiresAuth("WS", path2, auth.publicRoutes, auth.defaultPrivate);
|
|
5391
|
+
if (needsAuth) {
|
|
5392
|
+
const token = url.searchParams.get("token");
|
|
5393
|
+
if (token) {
|
|
5394
|
+
try {
|
|
5395
|
+
user = await auth.verifyToken(token);
|
|
5396
|
+
} catch (error) {
|
|
5397
|
+
logger?.debug("[WebSocket] Token verification failed:", { error });
|
|
5398
|
+
socket.write("HTTP/1.1 401 Unauthorized\r\n\r\n");
|
|
5399
|
+
socket.destroy();
|
|
5400
|
+
return;
|
|
5401
|
+
}
|
|
5402
|
+
} else {
|
|
5403
|
+
logger?.debug("[WebSocket] No token provided for protected WebSocket");
|
|
5404
|
+
socket.write("HTTP/1.1 401 Unauthorized\r\n\r\n");
|
|
5405
|
+
socket.destroy();
|
|
5406
|
+
return;
|
|
5407
|
+
}
|
|
5408
|
+
} else {
|
|
5409
|
+
const token = url.searchParams.get("token");
|
|
5410
|
+
if (token) {
|
|
5411
|
+
try {
|
|
5412
|
+
user = await auth.verifyToken(token);
|
|
5413
|
+
} catch {
|
|
5414
|
+
}
|
|
5276
5415
|
}
|
|
5277
5416
|
}
|
|
5278
5417
|
}
|
|
@@ -5409,9 +5548,59 @@ var BaseServerProvider = class {
|
|
|
5409
5548
|
});
|
|
5410
5549
|
}, "addRoutes");
|
|
5411
5550
|
const mcpRegistry = this.deps.mcp?.registry;
|
|
5412
|
-
const registeredMcpServers = mcpRegistry && typeof mcpRegistry.
|
|
5551
|
+
const registeredMcpServers = mcpRegistry && typeof mcpRegistry.listMetadata === "function" ? mcpRegistry.listMetadata() : [];
|
|
5413
5552
|
if (registeredMcpServers.length > 0) {
|
|
5414
5553
|
addRoutes(MCP_ROUTES, "MCP Endpoints");
|
|
5554
|
+
registeredMcpServers.forEach((server) => {
|
|
5555
|
+
const protocols = server.protocols ?? {};
|
|
5556
|
+
const httpEnabled = protocols.http ?? true;
|
|
5557
|
+
const sseEnabled = protocols.sse ?? true;
|
|
5558
|
+
const stdioEnabled = protocols.stdio ?? true;
|
|
5559
|
+
const { httpPath, ssePath, messagePath } = buildMcpRoutePaths(server.id);
|
|
5560
|
+
if (httpEnabled) {
|
|
5561
|
+
const key = `POST ${httpPath}`;
|
|
5562
|
+
if (!seen.has(key)) {
|
|
5563
|
+
seen.add(key);
|
|
5564
|
+
endpoints.push({
|
|
5565
|
+
method: "POST",
|
|
5566
|
+
path: httpPath,
|
|
5567
|
+
group: "MCP Transport"
|
|
5568
|
+
});
|
|
5569
|
+
}
|
|
5570
|
+
}
|
|
5571
|
+
if (stdioEnabled) {
|
|
5572
|
+
const stdioPath = `stdio://${server.id}`;
|
|
5573
|
+
const stdioKey = `STDIO ${stdioPath}`;
|
|
5574
|
+
if (!seen.has(stdioKey)) {
|
|
5575
|
+
seen.add(stdioKey);
|
|
5576
|
+
endpoints.push({
|
|
5577
|
+
method: "STDIO",
|
|
5578
|
+
path: stdioPath,
|
|
5579
|
+
group: "MCP Transport"
|
|
5580
|
+
});
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5583
|
+
if (sseEnabled) {
|
|
5584
|
+
const sseKey = `GET ${ssePath}`;
|
|
5585
|
+
if (!seen.has(sseKey)) {
|
|
5586
|
+
seen.add(sseKey);
|
|
5587
|
+
endpoints.push({
|
|
5588
|
+
method: "GET",
|
|
5589
|
+
path: ssePath,
|
|
5590
|
+
group: "MCP Transport"
|
|
5591
|
+
});
|
|
5592
|
+
}
|
|
5593
|
+
const messageKey = `POST ${messagePath}`;
|
|
5594
|
+
if (!seen.has(messageKey)) {
|
|
5595
|
+
seen.add(messageKey);
|
|
5596
|
+
endpoints.push({
|
|
5597
|
+
method: "POST",
|
|
5598
|
+
path: messagePath,
|
|
5599
|
+
group: "MCP Transport"
|
|
5600
|
+
});
|
|
5601
|
+
}
|
|
5602
|
+
}
|
|
5603
|
+
});
|
|
5415
5604
|
}
|
|
5416
5605
|
const a2aRegistry = this.deps.a2a?.registry;
|
|
5417
5606
|
const registeredA2AServers = a2aRegistry && typeof a2aRegistry.list === "function" ? a2aRegistry.list() : [];
|
|
@@ -5482,7 +5671,9 @@ var DEFAULT_CORS_OPTIONS = {
|
|
|
5482
5671
|
CustomEndpointError,
|
|
5483
5672
|
DEFAULT_A2A_ROUTE_PREFIX,
|
|
5484
5673
|
DEFAULT_A2A_WELL_KNOWN_PREFIX,
|
|
5674
|
+
DEFAULT_CONSOLE_ROUTES,
|
|
5485
5675
|
DEFAULT_CORS_OPTIONS,
|
|
5676
|
+
DEFAULT_LEGACY_PUBLIC_ROUTES,
|
|
5486
5677
|
DEFAULT_MCP_HTTP_SEGMENT,
|
|
5487
5678
|
DEFAULT_MCP_MESSAGES_SEGMENT,
|
|
5488
5679
|
DEFAULT_MCP_ROUTE_PREFIX,
|
|
@@ -5591,6 +5782,7 @@ var DEFAULT_CORS_OPTIONS = {
|
|
|
5591
5782
|
handleSuspendWorkflow,
|
|
5592
5783
|
handleWebSocketConnection,
|
|
5593
5784
|
hasConsoleAccess,
|
|
5785
|
+
isAuthNextConfig,
|
|
5594
5786
|
isDevRequest,
|
|
5595
5787
|
isErrorResponse,
|
|
5596
5788
|
isJsonRpcRequest,
|
|
@@ -5604,6 +5796,7 @@ var DEFAULT_CORS_OPTIONS = {
|
|
|
5604
5796
|
lookupMcpServer,
|
|
5605
5797
|
mapHandlerResponse,
|
|
5606
5798
|
mapLogResponse,
|
|
5799
|
+
normalizeAuthNextConfig,
|
|
5607
5800
|
normalizeError,
|
|
5608
5801
|
parseJsonRpcRequest,
|
|
5609
5802
|
pathMatches,
|
|
@@ -5616,6 +5809,7 @@ var DEFAULT_CORS_OPTIONS = {
|
|
|
5616
5809
|
queryLogsHandler,
|
|
5617
5810
|
requiresAuth,
|
|
5618
5811
|
resolveAgentCard,
|
|
5812
|
+
resolveAuthNextAccess,
|
|
5619
5813
|
setupObservabilityHandler,
|
|
5620
5814
|
setupObservabilityListeners,
|
|
5621
5815
|
setupWebSocketUpgrade,
|