Gets the execution logger for accessing log data
StaticInstanceGets the singleton instance of MCPClientManager
Adds an event listener
Event type to listen for
Listener function
Calls a tool on an MCP server
The connection ID to use
Name of the tool to call
Tool call options including arguments
Client options
Tool call result
Connects to an MCP server using a configured connection
The connection ID to use
Connection options
Connection info on success
Disconnects from an MCP server
The connection ID to disconnect
Disconnect options
Gets the list of active connection IDs
Array of active connection IDs
Gets information about an active connection
Connection ID
Connection info or null if not connected
The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.
Gets the OAuth connection status for a connection.
MCP Server Connection ID
User context
OAuth connection status or null if not an OAuth2 connection
Initializes the manager. Should be called once at application startup.
User context for initialization
Optionaloptions: { publicUrl?: string }Optional initialization options
Checks if a connection is currently active
Connection ID to check
true if connected
Lists available tools from an MCP server
The connection ID to use
Client options
List of available tools
Notifies listeners that OAuth authorization has completed successfully. Called by OAuth callback handler after code exchange succeeds.
The connection ID that was authorized
Optionaldata: Record<string, unknown>Optional additional data (token info, etc.)
Notifies listeners that an OAuth token was successfully refreshed. Called by TokenManager after successful token refresh.
The connection ID whose token was refreshed
Optionaldata: Record<string, unknown>Optional additional data (new expiration, etc.)
Notifies listeners that OAuth token refresh failed. Called by TokenManager when refresh fails.
The connection ID whose token refresh failed
Error details and whether re-authorization is required
Removes an event listener
Event type
Listener function to remove
Sets the public URL for OAuth callbacks.
The public URL (e.g., https://api.example.com)
Syncs MCP Server Tools to MJ Actions. Creates the category hierarchy System/MCP/{ServerName} and an Action for each tool.
The MCP Server ID to sync actions for
The user context for database operations
Optionalprovider: IMetadataProviderSync result with counts of created/updated actions and params
Syncs tool definitions from the MCP server to the database
The connection ID to use
Client options
Sync result
Tests a connection to an MCP server
The connection ID to test
Client options
Test result
Protected StaticgetReturns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.
OptionalclassName: string
MCPClientManager is a singleton that manages connections to external MCP servers.
Features:
Example