pub struct McpIntegration<C: ConnectionManager + 'static> { /* private fields */ }Expand description
MCP Integration Manager
Provides a unified interface for integrating MCP components with the existing ExtensionManager and tool registry systems.
Requirements: 7.1, 7.2, 7.3, 7.4, 7.5
Implementations§
Source§impl McpIntegration<McpConnectionManager>
impl McpIntegration<McpConnectionManager>
Sourcepub fn with_components(
connection_manager: Arc<McpConnectionManager>,
lifecycle_manager: Arc<McpLifecycleManager>,
config_manager: Arc<McpConfigManager>,
) -> Self
pub fn with_components( connection_manager: Arc<McpConnectionManager>, lifecycle_manager: Arc<McpLifecycleManager>, config_manager: Arc<McpConfigManager>, ) -> Self
Create a new MCP integration with custom components
Source§impl<C: ConnectionManager + 'static> McpIntegration<C>
impl<C: ConnectionManager + 'static> McpIntegration<C>
Sourcepub fn set_permission_manager(
&mut self,
manager: Arc<RwLock<ToolPermissionManager>>,
)
pub fn set_permission_manager( &mut self, manager: Arc<RwLock<ToolPermissionManager>>, )
Set the permission manager for tool permission checks
Requirements: 7.5
Sourcepub fn connection_manager(&self) -> &Arc<C>
pub fn connection_manager(&self) -> &Arc<C>
Get the connection manager
Requirements: 7.1
Sourcepub fn lifecycle_manager(&self) -> &Arc<McpLifecycleManager>
pub fn lifecycle_manager(&self) -> &Arc<McpLifecycleManager>
Get the lifecycle manager
Requirements: 7.2, 7.3
Sourcepub fn config_manager(&self) -> &Arc<McpConfigManager>
pub fn config_manager(&self) -> &Arc<McpConfigManager>
Get the config manager
Sourcepub fn tool_manager(&self) -> &Arc<McpToolManager<C>>
pub fn tool_manager(&self) -> &Arc<McpToolManager<C>>
Get the tool manager
Requirements: 7.4
Sourcepub async fn enable_extension(
&self,
extension_name: &str,
config: McpServerConfig,
) -> McpResult<()>
pub async fn enable_extension( &self, extension_name: &str, config: McpServerConfig, ) -> McpResult<()>
Enable an MCP extension (start server and connect)
This method:
- Registers the server with the lifecycle manager
- Starts the server process
- Establishes a connection via the connection manager
Requirements: 7.2
Sourcepub async fn disable_extension(&self, extension_name: &str) -> McpResult<()>
pub async fn disable_extension(&self, extension_name: &str) -> McpResult<()>
Disable an MCP extension (disconnect and stop server)
This method:
- Disconnects from the server
- Stops the server process
- Unregisters the server from the lifecycle manager
Requirements: 7.3
Sourcepub async fn is_extension_enabled(&self, extension_name: &str) -> bool
pub async fn is_extension_enabled(&self, extension_name: &str) -> bool
Check if an extension is enabled
Sourcepub fn get_enabled_extensions(&self) -> Vec<String>
pub fn get_enabled_extensions(&self) -> Vec<String>
Get all enabled extensions
Sourcepub async fn list_tools(&self) -> McpResult<Vec<McpTool>>
pub async fn list_tools(&self) -> McpResult<Vec<McpTool>>
List all available MCP tools
Returns tools from all connected servers, suitable for registration with the tool registry.
Requirements: 7.4
Sourcepub async fn list_tools_from_server(
&self,
server_name: &str,
) -> McpResult<Vec<McpTool>>
pub async fn list_tools_from_server( &self, server_name: &str, ) -> McpResult<Vec<McpTool>>
List tools from a specific server
Sourcepub async fn get_tool(
&self,
server_name: &str,
tool_name: &str,
) -> McpResult<Option<McpTool>>
pub async fn get_tool( &self, server_name: &str, tool_name: &str, ) -> McpResult<Option<McpTool>>
Get a specific tool
Sourcepub async fn get_tool_wrappers(&self) -> McpResult<Vec<McpToolWrapper>>
pub async fn get_tool_wrappers(&self) -> McpResult<Vec<McpToolWrapper>>
Convert MCP tools to tool registry wrappers
This method converts MCP tools to McpToolWrapper instances that can be registered with the ToolRegistry.
Requirements: 7.4
Sourcepub async fn register_tools_with_registry(
&self,
registry: &mut ToolRegistry,
) -> McpResult<usize>
pub async fn register_tools_with_registry( &self, registry: &mut ToolRegistry, ) -> McpResult<usize>
Register all MCP tools with a tool registry
This method discovers all tools from connected MCP servers and registers them with the provided tool registry.
Requirements: 7.4
Sourcepub fn unregister_tools_from_registry(
&self,
registry: &mut ToolRegistry,
server_name: Option<&str>,
)
pub fn unregister_tools_from_registry( &self, registry: &mut ToolRegistry, server_name: Option<&str>, )
Unregister all MCP tools from a tool registry
This method removes all MCP tools that were previously registered from the provided tool registry.
Sourcepub async fn call_tool(
&self,
server_name: &str,
tool_name: &str,
args: JsonObject,
context: &PermissionContext,
) -> McpResult<ToolCallResult>
pub async fn call_tool( &self, server_name: &str, tool_name: &str, args: JsonObject, context: &PermissionContext, ) -> McpResult<ToolCallResult>
Call an MCP tool with permission checking
This method:
- Checks permissions using the permission manager
- Calls the tool if permitted
- Returns the result
Requirements: 7.4, 7.5
Sourcepub async fn call_tool_unchecked(
&self,
server_name: &str,
tool_name: &str,
args: JsonObject,
) -> McpResult<ToolCallResult>
pub async fn call_tool_unchecked( &self, server_name: &str, tool_name: &str, args: JsonObject, ) -> McpResult<ToolCallResult>
Call an MCP tool without permission checking
Use this method when permission checking is handled externally.
Sourcepub async fn check_tool_permission(
&self,
server_name: &str,
tool_name: &str,
args: &JsonObject,
context: &PermissionContext,
) -> PermissionResult
pub async fn check_tool_permission( &self, server_name: &str, tool_name: &str, args: &JsonObject, context: &PermissionContext, ) -> PermissionResult
Check if a tool call is permitted
This method applies the same permission rules as built-in tools to MCP tool calls.
Requirements: 7.5
Sourcepub async fn check_tools_permissions(
&self,
tools: &[(String, String, JsonObject)],
context: &PermissionContext,
) -> Vec<(String, PermissionResult)>
pub async fn check_tools_permissions( &self, tools: &[(String, String, JsonObject)], context: &PermissionContext, ) -> Vec<(String, PermissionResult)>
Check permissions for multiple tools
Requirements: 7.5
Sourcepub async fn is_tool_allowed(
&self,
server_name: &str,
tool_name: &str,
context: &PermissionContext,
) -> bool
pub async fn is_tool_allowed( &self, server_name: &str, tool_name: &str, context: &PermissionContext, ) -> bool
Check if a tool is allowed without arguments
This is useful for checking if a tool is generally allowed before attempting to call it.
Requirements: 7.5
Sourcepub async fn get_denied_tools(&self, context: &PermissionContext) -> Vec<String>
pub async fn get_denied_tools(&self, context: &PermissionContext) -> Vec<String>
Get all denied tools for a context
Returns a list of tool names that are explicitly denied for the given context.
Requirements: 7.5
Sourcepub async fn filter_allowed_tools(
&self,
tools: Vec<McpTool>,
context: &PermissionContext,
) -> Vec<McpTool>
pub async fn filter_allowed_tools( &self, tools: Vec<McpTool>, context: &PermissionContext, ) -> Vec<McpTool>
Filter tools by permission
Returns only the tools that are allowed for the given context.
Requirements: 7.5
Sourcepub async fn list_allowed_tools(
&self,
context: &PermissionContext,
) -> McpResult<Vec<McpTool>>
pub async fn list_allowed_tools( &self, context: &PermissionContext, ) -> McpResult<Vec<McpTool>>
List only allowed tools from all servers
This combines tool discovery with permission filtering.
Requirements: 7.4, 7.5
Trait Implementations§
Source§impl Default for McpIntegration<McpConnectionManager>
impl Default for McpIntegration<McpConnectionManager>
Auto Trait Implementations§
impl<C> Freeze for McpIntegration<C>
impl<C> !RefUnwindSafe for McpIntegration<C>
impl<C> Send for McpIntegration<C>
impl<C> Sync for McpIntegration<C>
impl<C> Unpin for McpIntegration<C>
impl<C> UnsafeUnpin for McpIntegration<C>
impl<C> !UnwindSafe for McpIntegration<C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.