Kiro CLI MCP Server
A Model Context Protocol (MCP) server that enables IDE agents like Cursor and Windsurf to orchestrate kiro-cli with advanced session management, process pooling, and robust error handling.
Overview
Kiro CLI MCP Server bridges the gap between IDE agents and kiro-cli by providing a standardized MCP interface with enterprise-grade features:
10x Performance Improvement: Process pooling reduces response time from ~500ms to ~50ms
Multi-Session Management: Isolated contexts for different projects/workflows
Production-Ready Reliability: Comprehensive error handling, timeout management, and process cleanup
Mock Mode: Development and testing without kiro-cli dependency
Features
Core Capabilities
Chat Integration: Send messages to kiro-cli and receive AI responses
Session Management: Create, switch, and manage multiple isolated sessions
Command Execution: Execute kiro-cli commands (
/help,/mcp, etc.)Custom Agents: Use and list available custom agents
History Management: Store and retrieve conversation history per session
Async Operations: Background task execution with progress polling
Performance & Reliability
Process Pooling: Reuse warm kiro-cli processes for 10x faster responses
Process Tree Cleanup: Prevent orphaned processes across platforms
Automatic Fallback: Mock mode when kiro-cli unavailable
Timeout Handling: Configurable timeouts with graceful cleanup
Session Isolation: Per-project working directories and conversation state
Installation
Prerequisites
Python 3.10+
kiro-cli installed and available in PATH (for full functionality - uses mock mode if unavailable)
From Source (Current Method)
Via pip (After PyPI Publication)
Via uvx (After PyPI Publication)
Configuration
IDE Integration
Add to your IDE's MCP configuration file:
Cursor/Claude Desktop (~/.config/claude-desktop/mcp.json):
Windsurf (.windsurf/mcp.json):
Environment Variables
Variable | Description | Default |
| Path to kiro-cli executable |
|
| Command timeout (seconds) - IDE-optimized |
|
| Maximum concurrent sessions |
|
| Session idle timeout (seconds) |
|
| Session cleanup check interval (seconds) |
|
| Logging level |
|
| Default AI model for kiro-cli |
|
| Default agent to use |
|
| Log full CLI responses for debugging |
|
| Process pool size |
|
| Enable process pooling |
|
| Process idle time before recycling (seconds) |
|
| Max uses per process before recycling |
|
| Maximum concurrent async tasks |
|
| Task result TTL (seconds) |
|
Available MCP Tools
Session Management
kiro_session_create- Create new session with optional agent and working directorykiro_session_list- List all active sessionskiro_session_switch- Switch to specific sessionkiro_session_end- End a sessionkiro_session_clear- Clear session history fileskiro_session_save- Save session to file
Chat & Commands
kiro_chat- Send chat message and get AI responsekiro_command- Execute kiro-cli commands (/help,/mcp, etc.)kiro_agents_list- List available custom agents
History Management
kiro_history- Get conversation history for sessionkiro_history_clear- Clear conversation history
Async Operations
kiro_chat_async- Start background chat taskkiro_task_status- Poll task progress and resultskiro_task_cancel- Cancel running taskkiro_task_list- List active tasks
Monitoring
kiro_pool_stats- Get process pool performance statistics
Usage Examples
Basic Chat
Multi-Project Workflow
Async Operations
Architecture
MCP Protocol Integration
Server: Built on official MCP SDK (
mcp.server.Server)Transport: JSON-RPC 2.0 over stdio
Tools: 16 registered tools with schema validation
Resources: Minimal resource handling for extensibility
Process Management
Key Components
SessionManager: Multi-session isolation and lifecycle management
ProcessPool: Warm process reuse for 10x performance improvement
CommandExecutor: Robust command execution with timeout handling
StreamingTaskManager: Async task execution with progress polling
Performance Optimizations
Process Pooling: Reuse warm kiro-cli processes
Session Affinity: Route requests to appropriate process
Intelligent Cleanup: Remove idle/unhealthy processes
Mock Mode: Fast responses during development
Development
Setup
Testing
Code Quality
Running Server
Contributing
Fork the repository
Create feature branch (
git checkout -b feature/amazing-feature)Commit changes (
git commit -m 'Add amazing feature')Push to branch (
git push origin feature/amazing-feature)Open Pull Request
Troubleshooting
kiro-cli Not Found
Server automatically enables mock mode if kiro-cli is unavailable:
Performance Issues
Session Management
Process Cleanup
If you encounter orphaned processes:
License
MIT License - see LICENSE file for details.
Support
Issues: GitHub Issues
Discussions: GitHub Discussions
Documentation: Wiki