Back to feed
Dev.to
Dev.to
7/9/2026
How We Use MCP and CLI Together for Dynamic AI Agent Workflows

How We Use MCP and CLI Together for Dynamic AI Agent Workflows

Short summary

The author details a production architecture that runs six focused MCP servers as independent systemd-managed processes alongside a CLI bridge (server-commands-rtk) for ad-hoc commands, achieving lifecycle independence where agent restarts don't kill tool servers. The key decision rule: use MCP tools for structured query/search/read operations with known schemas, and raw CLI for execute/write actions with small output, yielding up to 12x token savings. Total schema overhead across all six servers (~8-10K tokens) is less than a single monolithic GitHub MCP server (~14K), proving that narrow independent servers beat one general-purpose server on both resilience and cost.

  • Run MCP servers as independent systemd processes so agent restarts don't kill tool servers or lose state
  • Use MCP for structured operations (query/read/search) and CLI bridge for ad-hoc commands (execute/write) with audit logging
  • Six focused MCP servers at ~8-10K total schema tokens outperform one monolithic server at ~14K on both resilience and cost

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more