Skip to content

MCP stdio servers load duplicate embedding models across AI clients #314

Description

@Lauritz-Timm

Summary

When ICM is configured as an MCP stdio server in multiple AI clients, each client launches its own icm serve process. Each process loads the embedding model independently, so RAM scales with the number of clients even though they share the same SQLite memory DB.

Observed locally

  • ICM version: 0.10.57
  • OS: Windows
  • Config: default ICM config, embeddings model intfloat/multilingual-e5-base
  • Cached model file: %LOCALAPPDATA%\icm\icm\cache\...\model.onnx is about 1058.6 MB
  • OpenCode Desktop spawned: icm.exe serve --compact
    • RSS about 1771.8 MB, private about 1987.3 MB
  • OpenAI Codex spawned: icm.exe serve
    • RSS about 1758.6 MB, private about 1980.7 MB
  • DB is small: %APPDATA%\icm\icm\data\memories.db about 3.9 MB, 23 memories

This means two idle MCP clients can cost about 3.5 GB RAM before doing meaningful work.

Why this looks upstream, not client-specific

The client configuration is just standard MCP stdio:

icm serve
icm serve --compact

No client-specific embedding model is selected. ICM already has icm serve --http 127.0.0.1:<port>, and the README says the HTTP mode keeps the embedding model warm once. The missing piece seems to be an MCP-friendly way for multiple clients to share that one warm process, or for stdio mode to avoid keeping the full embedder resident when idle.

Requested improvement

Please consider one or more of these:

  1. Provide an official lightweight MCP stdio proxy that forwards to a shared local icm serve --http daemon.
  2. Add an idle timeout / lazy-load mode for icm serve so the embedding model can be unloaded after inactivity.
  3. Add a config/install option for multi-client setups that uses a shared daemon instead of one warm model per MCP client.
  4. Document the RAM tradeoff and recommend --no-embeddings, smaller embedding models, or HTTP daemon mode for memory-constrained machines.

Related but not identical: #134 tracks smaller embedding model support. Smaller models would help, but duplicate per-client model loads still remain when several MCP clients run at once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions