Implementation:AI Shell Team Aish McpManager start
| Knowledge Sources | |
|---|---|
| Domains | MCP, Concurrency |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete tool for starting background driver tasks per enabled MCP server provided by the aish-mcp crate.
Description
The McpManager::start method launches one background tokio task per enabled server. It reads the enabled server names and calls spawn_driver for each. The method returns immediately — progress is observed through snapshots.
The spawn_driver method is the per-server launch: it checks that the server is not already attempting, not already connected and alive, and the shutdown signal has not fired. It increments the server's epoch and spawns a driver task identified by (generation, epoch). The driver owns the complete connect-session-reconnect cycle.
Usage
Call start after creating the manager and when the tokio runtime is available. Call snapshots to observe connection progress.
Code Reference
Source Location
- Repository: aish
- File: crates/aish-mcp/src/manager.rs
Signature
impl McpManager {
pub fn start(self: &Arc<Self>, handle: &tokio::runtime::Handle)
fn spawn_driver(&self, name: &str, handle: &tokio::runtime::Handle) -> bool
}
Import
use aish_mcp::McpManager;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| handle | &tokio::runtime::Handle | Yes | Async runtime handle for spawning driver tasks |
Outputs
| Name | Type | Description |
|---|---|---|
| (side effect) | — | Background tokio task per enabled server; returns immediately |
Usage Examples
Starting All Servers
use aish_mcp::McpManager;
let manager = McpManager::new(settings);
manager.start(&tokio::runtime::Handle::current());
// Observe progress
for snapshot in manager.snapshots() {
println!("{}: {:?}", snapshot.name, snapshot.status);
}