BaseMCPManager
TheBaseMCPManager
is the core class for creating MCP servers in scmcphub. It provides a standardized way to manage multiple MCP modules with built-in filtering capabilities.
For a complete reference documentation, see BaseMCPManager Reference.
Key Features
- Module Management: Automatically handles module registration and organization
- Filtering: Built-in support for including/excluding modules and tools
- Backend Integration: Seamless integration with different backend managers
- Tag-based Filtering: Support for filtering tools based on tags
- Async Support: Proper async/await handling for server lifespan
Basic Usage
Backend Access Functions
Theget_ads
and get_nbm
functions are essential for accessing backend managers within MCP tools. These functions provide access to the appropriate backend based on the execution mode.
For complete documentation, see Backend Functions Reference.
Quick Overview
get_ads()
- Tool Mode Backend
- Purpose: Access
AdataManager
for AnnData operations - Mode: Tool Mode (
tool-mode
) - Returns:
AdataManager
instance
get_nbm()
- Code Mode Backend
- Purpose: Access
NotebookManager
for Jupyter notebook operations - Mode: Code Mode (
code-mode
) - Returns:
NotebookManager
instance
Usage Examples
Tool Mode Example
Code Mode Example
Backend Selection
The choice betweenget_ads
and get_nbm
depends on your server configuration:
- AdataManager Backend: Use
get_ads()
for tool-mode - NotebookManager Backend: Use
get_nbm()
for code-mode
AdataManager
TheAdataManager
is the primary backend manager for handling AnnData objects in tool mode. It provides centralized management of multiple AnnData objects with different data types and sample IDs.
Key Features
- Multi-type Support: Manages different types of AnnData (exp, activity, cnv, splicing)
- Sample ID Management: Tracks and organizes data by sample identifiers
- Active Sample Tracking: Maintains the currently active sample for operations
- Data Consistency: Ensures proper data access and storage patterns
Basic Usage
Data Types
The AdataManager supports these default data types:- exp: Expression data (default)
- activity: Activity scores from pathway analysis
- cnv: Copy number variation data
- splicing: Alternative splicing data
NotebookManager
TheNotebookManager
is the primary backend manager for handling Jupyter notebooks in code mode. It provides centralized management of multiple notebook instances with different kernels, making it essential for interactive analysis workflows.
For complete documentation, see NotebookManager Reference.
Quick Overview
Key Features
- Multiple Notebook Support: Manages multiple Jupyter notebook instances simultaneously
- Kernel Management: Handles different Jupyter kernels (Python, R, etc.)
- Active Notebook Tracking: Maintains the currently active notebook for operations
- Code Execution: Provides a unified interface for code execution across notebooks
- Notebook Lifecycle: Manages creation, deletion, and switching between notebooks