How We Made Stateful MCP Servers Work in One-Shot CLI Calls The Problem: Stateful Servers vs Stateless CLI Context-mode is a powerful MCP (Model Context Protocol) server that maintains a SQLite knowledge base and session history. It reduces AI context window usage by up to 98% by keeping raw tool output out of conversations and only returning relevant snippets. But there was a problem: context-mode is stateful . It needs to stay alive between calls to maintain its knowledge base. Traditional CLI tools are stateless β each invocation is a fresh process. When we tried to integrate context-mode into supercli (a CLI wrapper for external tools), we hit a wall: # Call 1: Index project structure sc mcp call --mcp-server context-mode --tool ctx_index --input-json '{"content":"..."}' # Call 2: Search β but knowledge is gone! New process, new database.β¦