Skip to content

How to Add MCP Servers to Kiro CLI (Search, GitHub, Custom Tools)

· 2 min read

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

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

IssueSolution
Don’t hardcode tokensUse $ENV_VAR to reference environment variables
First startup slownpx downloads on first run, cached after
MCP server crashes silentlyAdd --require-mcp-startup flag
Limit agent to specific toolsUse @server_name/tool_name in agent’s tools field

FAQ

Where is the MCP config file?
Global config at ~/.kiro/settings/mcp.json. Project-level config goes in .kiro/agents/ JSON files.
Why is the first MCP startup slow?
npx -y downloads packages on first run. Subsequent starts use cache. You can pre-install globally with npm install -g.
How do I check if MCP servers are connected?
Type /mcp in Kiro CLI to see server status, or /tools to see all available tools including MCP-provided ones.
Should I put API keys directly in the JSON file?
No. Use $ENV_VAR format to reference environment variables. JSON files may end up in git.

Related Posts