Kiro CLI MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Kiro CLI MCP Servercreate a new session for my project 'api-refactor' using the code-review agent"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Related MCP server: local-mcp
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)
git clone https://github.com/your-org/kiro-cli-mcp.git
cd kiro-cli-mcp
pip install -e .Via pip (After PyPI Publication)
# Will be available after publishing to PyPI
pip install kiro-cli-mcpVia uvx (After PyPI Publication)
# Will be available after publishing to PyPI
uvx install kiro-cli-mcpConfiguration
IDE Integration
Add to your IDE's MCP configuration file:
Cursor/Claude Desktop (~/.config/claude-desktop/mcp.json):
{
"mcpServers": {
"kiro-cli-mcp": {
"command": "uvx",
"args": ["kiro-cli-mcp"],
"env": {
"KIRO_MCP_LOG_LEVEL": "INFO"
}
}
}
}Windsurf (.windsurf/mcp.json):
{
"mcpServers": {
"kiro-cli-mcp": {
"command": "python",
"args": ["-m", "kiro_cli_mcp"],
"env": {
"KIRO_MCP_CLI_PATH": "/usr/local/bin/kiro-cli",
"KIRO_MCP_POOL_SIZE": "5"
},
"autoApprove": [
"kiro_session_list",
"kiro_agents_list",
"kiro_history"
]
}
}
}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
# Create session for project
await mcp_client.call_tool("kiro_session_create", {
"working_directory": "/path/to/project",
"agent": "code-reviewer"
})
# Send message
response = await mcp_client.call_tool("kiro_chat", {
"message": "Analyze this codebase and suggest improvements"
})Multi-Project Workflow
# Project A
session_a = await mcp_client.call_tool("kiro_session_create", {
"working_directory": "/projects/frontend",
"agent": "react-expert"
})
# Project B
session_b = await mcp_client.call_tool("kiro_session_create", {
"working_directory": "/projects/backend",
"agent": "python-expert"
})
# Switch between projects
await mcp_client.call_tool("kiro_session_switch", {
"session_id": session_a["session_id"]
})Async Operations
# Start long-running task
task = await mcp_client.call_tool("kiro_chat_async", {
"message": "Generate comprehensive test suite"
})
# Poll for progress
while True:
status = await mcp_client.call_tool("kiro_task_status", {
"task_id": task["task_id"]
})
if status["status"] == "completed":
break
await asyncio.sleep(1)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
IDE Agent → MCP Server → Process Pool → kiro-cli instances
↓
Session Manager → Isolated contexts per projectKey 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
git clone https://github.com/your-org/kiro-cli-mcp.git
cd kiro-cli-mcp
pip install -e ".[dev]"Testing
# Run all tests
pytest
# With coverage
pytest --cov=kiro_cli_mcp --cov-report=html
# Property-based tests
pytest tests/test_config.py -vCode Quality
# Format code
ruff format .
# Lint
ruff check .
# Type checking
mypy src/Running Server
# Development mode with debug logging
python -m kiro_cli_mcp --log-level DEBUG
# With custom config
python -m kiro_cli_mcp --config config.jsonContributing
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:
# Check kiro-cli availability
which kiro-cli
# Set custom path
export KIRO_MCP_CLI_PATH=/custom/path/to/kiro-cli
# Verify server mode
python -m kiro_cli_mcp --log-level DEBUG
# Look for: "✅ kiro-cli is available" or "❌ kiro-cli not available: enabling mock mode"Performance Issues
# Verify process pooling is enabled
python -m kiro_cli_mcp --log-level DEBUG
# Look for: "🔄 Using pooled process execution"
# Check pool statistics
# Use kiro_pool_stats tool to monitor performanceSession Management
# Increase session limits
export KIRO_MCP_MAX_SESSIONS=20
export KIRO_MCP_SESSION_TIMEOUT=7200 # 2 hours
# Clear stuck sessions
# Sessions auto-cleanup after timeoutProcess Cleanup
If you encounter orphaned processes:
# Unix/Linux/macOS
pkill -f kiro-cli
# Windows
taskkill /F /IM kiro-cli.exe
# Check process groups (Unix)
ps -eo pid,pgid,cmd | grep kiroLicense
MIT License - see LICENSE file for details.
Support
Issues: GitHub Issues
Discussions: GitHub Discussions
Documentation: Wiki
Available Tools
16 toolskiro_agents_listB
List available custom agents
Inputs: no named parameters.
kiro_chatC
Send a chat message to kiro-cli and get AI response
Inputs: message (required), session_id, stream.
kiro_chat_asyncA
Start an async chat task for streaming-like experience. Use kiro_task_status to poll for results.
Inputs: message (required), session_id.
kiro_commandC
Execute a kiro-cli command (e.g., /mcp, /help)
Inputs: command (required), session_id.
kiro_historyC
Get conversation history for a session
Inputs: session_id, limit.
kiro_history_clearC
Clear conversation history for a session
Inputs: session_id.
kiro_pool_statsB
Get process pool statistics for performance monitoring
Inputs: no named parameters.
kiro_session_clearA
Clear kiro-cli session history in working directory (deletes .kiro/session.json)
Inputs: session_id.
kiro_session_createB
Create a new kiro-cli session. If working_directory is not provided or does not exist, the current directory will be used.
Inputs: agent, working_directory.
kiro_session_endC
End a kiro-cli session
Inputs: session_id (required).
kiro_session_listB
List all active kiro-cli sessions
Inputs: no named parameters.
kiro_session_saveC
Save current kiro-cli session to a file using /save command
Inputs: path (required), session_id.
kiro_session_switchC
Switch to a specific session
Inputs: session_id (required).
kiro_task_cancelC
Cancel a running async task
Inputs: task_id (required).
kiro_task_listC
List active async tasks
Inputs: session_id, include_done.
kiro_task_statusA
Get status and partial results of an async task. Use for polling streaming results.
Inputs: task_id (required), from_chunk_index.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
TDQS
Scored across 16 tools
Most tools have distinct purposes, but there is some overlap between kiro_chat and kiro_command, as both involve sending messages or commands to kiro-cli, which could cause confusion. However, descriptions clarify that kiro_chat is for AI responses and kiro_command for CLI commands, mitigating ambiguity.
All tool names follow a consistent kiro_ prefix with snake_case and clear verb_noun patterns (e.g., kiro_agents_list, kiro_session_create). This uniformity makes the tool set predictable and easy to navigate.
With 16 tools, the count is slightly high but reasonable for a CLI server covering agents, chat, sessions, and tasks. It feels comprehensive without being overwhelming, though some tools like kiro_session_clear and kiro_history_clear might be redundant.
The tool set provides good coverage for managing kiro-cli sessions, agents, chat, and async tasks, with clear CRUD-like operations (e.g., create, list, end, clear). Minor gaps exist, such as no direct tool for updating sessions or agents, but agents can work around this using chat or commands.
Maintenance
Related MCP Connectors
Develop, manage, and debug Railway projects, services, and deployments from within agents.
Hosted runtime for persistent agent teams, durable workflows, memory, schedules, and goals.
The AI orchestration agent for modern software teams.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP server that lets any agent or MCP host delegate tasks to the Cursor CLI agent for fast, headless execution. Supports task delegation, project discovery, file analysis, and follow-up sessions.314 npm4MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to securely inspect, modify, and manage local projects with trusted filesystem access, safe Git operations, controlled task execution, and developer runtime process management over stdio or HTTP.4Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables local, permissioned development workflows from compatible AI clients, including filesystem editing, interactive terminals, durable jobs, Git operations, and semantic browser testing.64 npm1Apache 2.0
- AlicenseNot gradedqualityAmaintenanceEnables AI clients such as Claude, Cursor, VS Code, and Windsurf to manage workspaces, projects, tasks, AI agents, automations, and files via the Model Context Protocol, with hosted OAuth or local stdio options.1,958 npmMIT