How We Made Stateful MCP Servers Work in One-Shot CLI Calls
Dev.to AI
•
Generative AI
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.