How to Add MCP Servers to Kiro CLI (Search, GitHub, Custom Tools)
How Does Kiro CLI Connect to External Tools?
Through MCP (Model Context Protocol). You declare MCP servers in a JSON file, Kiro CLI connects on startup, and the AI can call search, GitHub, databases, and any other external service.
Config file: ~/.kiro/settings/mcp.json
How to Add Web Search?
Give AI real-time internet search. Edit ~/.kiro/settings/mcp.json:
{
"mcpServers": {
"exa": {
"command": "npx",
"args": ["-y", "exa-mcp-server"],
"env": {
"EXA_API_KEY": "your-exa-key"
}
}
}
}
Get your API key at exa.ai (free 1000 requests/month).
Restart Kiro CLI and ask:
Search for React 19 breaking changes
The AI calls Exa and returns real-time results.
How to Add GitHub Access?
Let AI read PRs, issues, and repository code:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "$GITHUB_TOKEN"
}
}
}
}
Set the environment variable:
export GITHUB_TOKEN=ghp_your_token_here
echo 'export GITHUB_TOKEN=ghp_your_token_here' >> ~/.bashrc
Now you can ask:
Show me open PRs in this repo
How to Configure Multiple MCP Servers?
Put them all in one JSON:
{
"mcpServers": {
"exa": {
"command": "npx",
"args": ["-y", "exa-mcp-server"],
"env": { "EXA_API_KEY": "$EXA_API_KEY" }
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "$GITHUB_TOKEN" }
},
"git": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-git"],
"env": {}
}
}
}
How to Set Up Project-Level MCP Config?
Put MCP config inside an agent file so it travels with the code. Create .kiro/agents/default.json:
{
"name": "default",
"mcpServers": {
"company-docs": {
"command": "node",
"args": ["./tools/mcp-docs-server.js"],
"env": {
"DOCS_API_URL": "https://internal-api.company.com/docs"
}
}
},
"includeMcpJson": true
}
includeMcpJson: true means global MCP servers are also loaded. Team members get project-specific tools automatically after cloning.
How to Verify MCP Connection?
Inside Kiro CLI:
/mcp # Show MCP server connection status
/tools # List all available tools (including MCP-provided)
Quick Reference
| Issue | Solution |
|---|---|
| Don’t hardcode tokens | Use $ENV_VAR to reference environment variables |
| First startup slow | npx downloads on first run, cached after |
| MCP server crashes silently | Add --require-mcp-startup flag |
| Limit agent to specific tools | Use @server_name/tool_name in agent’s tools field |