Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI Shell Team Aish McpManager start

From Leeroopedia
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);
}

Related Pages

Implements Principle

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment