Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,25 @@ jobs:
needs: lint-and-typecheck
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-path:
- tests/adapters
- tests/apps
- tests/auth
- tests/chat
- tests/cli
- tests/commands
- tests/config
- tests/context
- tests/core
- tests/display
- tests/interactive
- tests/llm
- tests/memory
- tests/model_management
- tests/tools
- tests/ui
- tests/utils
- tests/test_command_consistency.py
- tests/test_command_consistency.py tests/test_mcp_cli_init.py tests/test_mcp_cli_main_entry.py
steps:
- name: Checkout code
uses: actions/checkout@v6
Expand All @@ -97,7 +101,7 @@ jobs:
run: uv sync --group dev

- name: Run tests
run: uv run pytest --cov=src --cov-report= "${{ matrix.test-path }}"
run: uv run pytest --cov=src --cov-report= ${{ matrix.test-path }}

- name: Rename coverage file
run: mv .coverage ".coverage.${{ strategy.job-index }}"
Expand Down Expand Up @@ -146,5 +150,5 @@ jobs:
echo "## Code Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
uv run coverage report -m >> $GITHUB_STEP_SUMMARY
uv run coverage report -m --fail-under=60 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
68 changes: 41 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,43 @@ A powerful, feature-rich command-line interface for interacting with Model Conte

**Default Configuration**: MCP CLI defaults to using Ollama with the `gpt-oss` reasoning model for local, privacy-focused operation without requiring API keys.

## 🆕 Recent Updates (v0.14.0)

### Production Hardening (Tier 5)
- **Secret Redaction**: All log output (console and file) is automatically redacted for Bearer tokens, API keys, OAuth tokens, and Authorization headers
- **Structured File Logging**: Optional `--log-file` flag enables rotating JSON log files (10MB, 3 backups) at DEBUG level with secret redaction
- **Per-Server Timeouts**: Server configs now support `tool_timeout` and `init_timeout` overrides, resolved per-server → global → default
- **Thread-Safe OAuth**: Concurrent OAuth flows are serialized with `asyncio.Lock` and copy-on-write header mutation

### Code Quality (Tier 4)
- **Core/UI Separation**: Core modules (`chat/conversation.py`, `chat/tool_processor.py`, `chat/chat_context.py`) no longer import `chuk_term.ui.output` — all logging goes through `logging` module
- **Message Class Clarity**: Local `Message` renamed to `HistoryMessage` (backward-compat alias preserved) to distinguish from `chuk_llm.core.models.Message`
- **Removed Global Singletons**: `_GLOBAL_TOOL_MANAGER` and associated getter/setter functions deleted
- **Integration Test Framework**: Real MCP server tests with `@pytest.mark.integration` marker (SQLite server)
- **Coverage Reporting**: Branch coverage enabled with `fail_under = 60` threshold in pyproject.toml

### Previous: MCP Apps (SEP-1865)
- **Interactive HTML UIs**: MCP servers can now serve interactive HTML applications (charts, tables, maps, markdown viewers) that render in your browser
## 🆕 Recent Updates (v0.16)

### AI Virtual Memory (Experimental)
- **`--vm` flag**: Enable OS-style virtual memory for conversation context management, powered by `chuk-ai-session-manager`
- **`--vm-budget`**: Control token budget for conversation events (system prompt is uncapped on top), forcing earlier eviction and page creation
- **`--vm-mode`**: Choose VM mode — `passive` (runtime-managed, default), `relaxed` (VM-aware conversation), or `strict` (model-driven paging with tools)
- **`/memory` command**: Visualize VM state during conversations — page table, working set utilization, eviction metrics, TLB stats (aliases: `/vm`, `/mem`)
- **Multimodal page_fault**: Image pages return multi-block content (text + image_url) so multimodal models can re-analyze recalled images
- **`/memory page <id> --download`**: Export page content to local files with modality-aware extensions (.txt, .json, .png)

### MCP Apps (SEP-1865)
- **Interactive HTML UIs**: MCP servers can serve interactive HTML applications (charts, tables, maps, markdown viewers) that render in your browser
- **Sandboxed iframes**: Apps run in secure sandboxed iframes with CSP protection
- **WebSocket bridge**: Real-time bidirectional communication between browser apps and MCP servers
- **Automatic launch**: Tools with `_meta.ui` annotations automatically open in the browser when called
- **Session reliability**: Message queuing, reconnection with exponential backoff, deferred tool result delivery

### Previous: Performance & Polish (Tier 3)
- **O(1) Tool Lookups**: Indexed tool lookup replacing O(n) linear scans in both ToolManager and ChatContext
- **Cached LLM Tool Metadata**: Per-provider caching of tool definitions with automatic invalidation
- **Startup Progress**: Real-time progress messages during initialization instead of a single spinner
- **Token Usage Tracking**: Per-turn and cumulative token tracking with `/usage` command (aliases: `/tokens`, `/cost`)
### Production Hardening
- **Secret Redaction**: All log output (console and file) is automatically redacted for Bearer tokens, API keys, OAuth tokens, and Authorization headers
- **Structured File Logging**: Optional `--log-file` flag enables rotating JSON log files (10MB, 3 backups) at DEBUG level
- **Per-Server Timeouts**: Server configs support `tool_timeout` and `init_timeout` overrides, resolved per-server → global → default
- **Thread-Safe OAuth**: Concurrent OAuth flows serialized with `asyncio.Lock` and copy-on-write header mutation
- **Server Health Monitoring**: `/health` command, health-check-on-failure diagnostics, optional `--health-interval` background polling

### Performance & Polish
- **O(1) Tool Lookups**: Indexed tool lookup replacing O(n) linear scans
- **Cached LLM Tool Metadata**: Per-provider caching with automatic invalidation
- **Startup Progress**: Real-time progress messages during initialization
- **Token Usage Tracking**: Per-turn and cumulative tracking with `/usage` command (aliases: `/tokens`, `/cost`)
- **Session Persistence**: Save/load/list conversation sessions with auto-save every 10 turns (`/sessions`)
- **Conversation Export**: Export conversations as Markdown or JSON with metadata (`/export`)
- **Trusted Domains**: Tools from trusted server domains (e.g. chukai.io) skip confirmation prompts

### Code Quality
- **Core/UI Separation**: Core modules use `logging` only — no UI imports
- **3,200+ tests**: Comprehensive test suite with branch coverage, integration tests, and 60% minimum threshold
- **15 Architecture Principles**: Documented and enforced (see [architecture.md](architecture.md))
- **Full [Roadmap](roadmap.md)**: Tiers 1-5 complete, Tiers 6-12 planned (plans, traces, skills, scheduling, multi-agent)

## 🔄 Architecture Overview

Expand Down Expand Up @@ -82,7 +89,7 @@ MCP CLI supports all providers and models from CHUK-LLM, including cutting-edge
| **IBM watsonx** 🏢 | Granite, Llama models | Enterprise compliance |
| **Mistral AI** 🇪🇺 | Mistral Large, Medium | European, efficient models |

### Robust Tool System (Powered by CHUK Tool Processor v0.13+)
### Robust Tool System (Powered by CHUK Tool Processor v0.22+)
- **Automatic Discovery**: Server-provided tools are automatically detected and catalogued
- **Provider Adaptation**: Tool names are automatically sanitized for provider compatibility
- **Production-Grade Execution**: Middleware layers with timeouts, retries, exponential backoff, caching, and circuit breakers
Expand Down Expand Up @@ -120,6 +127,10 @@ MCP CLI supports all providers and models from CHUK-LLM, including cutting-edge

Comprehensive documentation is available in the `docs/` directory:

### Project
- **[Architecture](architecture.md)** - 15 design principles, module layout, and coding conventions
- **[Roadmap](roadmap.md)** - Vision, completed tiers (1-5), and planned tiers (6-12: plans, traces, skills, scheduling, multi-agent, remote sessions)

### Core Documentation
- **[Commands System](docs/COMMANDS.md)** - Complete guide to the unified command system, patterns, and usage across all modes
- **[Token Management](docs/TOKEN_MANAGEMENT.md)** - Comprehensive token management for providers and servers including OAuth, bearer tokens, and API keys
Expand Down Expand Up @@ -251,6 +262,9 @@ Global options available for all modes and commands:
- `--verbose`: Enable detailed logging
- `--quiet`: Suppress non-essential output
- `--log-file`: Write debug logs to a rotating file (secrets auto-redacted)
- `--vm`: [Experimental] Enable AI virtual memory for context management
- `--vm-budget`: Token budget for conversation events in VM mode (default: 128000, on top of system prompt)
- `--vm-mode`: VM mode — `passive` (default), `relaxed`, or `strict`

### Environment Variables

Expand Down Expand Up @@ -1261,8 +1275,8 @@ Core dependencies are organized into feature groups:

- **cli**: Terminal UI and command framework (Rich, Typer, chuk-term)
- **dev**: Development tools, testing utilities, linting
- **chuk-tool-processor v0.13+**: Production-grade tool execution with middleware, multiple execution strategies, and observability
- **chuk-llm v0.16+**: Unified LLM provider with dynamic model discovery, capability-based selection, and llama.cpp integration for 52x faster imports and 112x faster client creation
- **chuk-tool-processor v0.22+**: Production-grade tool execution with middleware, multiple execution strategies, and observability
- **chuk-llm v0.17+**: Unified LLM provider with dynamic model discovery, capability-based selection, and llama.cpp integration
- **chuk-term**: Enhanced terminal UI with themes, prompts, and cross-platform support

Install with specific features:
Expand Down Expand Up @@ -1336,7 +1350,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
## 🙏 Acknowledgments

- **[CHUK Tool Processor](https://github.com/chrishayuk/chuk-tool-processor)** - Production-grade async tool execution with middleware and observability
- **[CHUK-LLM](https://github.com/chrishayuk/chuk-llm)** - Unified LLM provider with dynamic model discovery, llama.cpp integration, and GPT-5/Claude 4.5 support (v0.16+)
- **[CHUK-LLM](https://github.com/chrishayuk/chuk-llm)** - Unified LLM provider with dynamic model discovery, llama.cpp integration, and GPT-5/Claude 4.5 support (v0.17+)
- **[CHUK-Term](https://github.com/chrishayuk/chuk-term)** - Enhanced terminal UI with themes and cross-platform support
- **[Rich](https://github.com/Textualize/rich)** - Beautiful terminal formatting
- **[Typer](https://typer.tiangolo.com/)** - CLI framework
Expand Down
Loading