Use these practices to limit MCP server access, protect credentials, and verify the code you run.
MCP servers extend Kiro's capabilities by connecting to external services and APIs. Since MCP servers are third-party code, this introduces security considerations:
- Access to sensitive information: MCP servers may require API keys or tokens
- External code execution: By default, MCP servers run code outside Kiro's local command sandbox. You can opt stdio servers into it; see Sandboxing stdio servers
- Data transmission: Information flows between Kiro and external services
- Source verification: Review the source code and verify the server comes from a trusted source before using
- Isolation: Run servers in isolated environments when possible and limit the permissions granted
The MCP security model is designed with these principles:
- Permission Checks: Kiro's permissions system evaluates each MCP tool call. Depending on workspace trust and active rules, Kiro denies the call, asks for approval, or runs it without a per-call prompt.
- Local Execution: Stdio MCP servers run locally on your machine. Remote HTTP and SSE servers run on the provider's infrastructure, and Kiro connects to them over the network
- Isolation: Each stdio MCP server runs as a separate local process
- Transparency: Users can see what tools are available and what they do
- Never commit configuration files with sensitive tokens to version control
- Create tokens with minimal permissions necessary for the MCP server to function (for example, use fine-grained personal access tokens for GitHub instead of classic tokens)
- Limit access scope to only the repositories or resources needed
- Regularly rotate API keys and tokens used in configurations
- Use environment variables when possible instead of hardcoding values
Instead of hardcoding tokens in your configuration:
{ "mcpServers": { "github": { "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}" } } } }
Set the environment variable in your shell:
export GITHUB_TOKEN=your-token-value
For security, Kiro IDE only expands environment variables that are explicitly approved. Only variables in the approved list will be expanded when found in MCP config files.
When you add or modify an MCP server configuration that includes unapproved environment variables, Kiro displays a security warning popup listing the variables that need approval. You can approve them directly from the popup or manage them in settings.
To manage approved environment variables:
- Open Kiro settings
- Search for "Mcp Approved Env Vars"
- Add the environment variables you want to allow for expansion
This prevents MCP servers from accessing arbitrary environment variables on your system.
Restrict access to your MCP configuration files:
# Set restrictive permissions on user-level config chmod 600 ~/.kiro/settings/mcp.json # Set restrictive permissions on workspace-level config chmod 600 .kiro/settings/mcp.json
- Review each tool request carefully before approval
- Check the parameters being passed to the tool
- Understand what the tool will do before approving it
- Deny any suspicious requests that don't match your current task
Only auto-approve tools that:
- Don't have write access to sensitive systems
- Come from trusted sources with verified code
- Are used frequently in your workflow
- Have limited scope of what they can access
{ "mcpServers": { "aws-docs": { "autoApprove": [ "mcp_aws_docs_search_documentation", "mcp_aws_docs_read_documentation" ] } } }
- Use least-privilege principles for server permissions
- Limit file system access to necessary directories only
- Restrict network access where possible
- Use
disabledToolsto restrict access to dangerous operations:
{ "mcpServers": { "github": { "disabledTools": ["delete_repository", "force_push"] } } }
On your own machine, the local command sandbox can start stdio MCP server processes inside the same OS-level sandbox it uses for the agent's shell commands. Set mcpSandboxing to true in your sandbox configuration; the server then runs under the same network mode and sandbox_network host rules as sandboxed commands. Remote HTTP and SSE servers are not affected, and their network access does not follow sandbox rules.
See Local command sandbox for setup, platform requirements, and what happens when wrapping fails.
Use workspace-level configuration to keep each project's MCP server list separate:
project-a/ ├── .kiro/ │ └── settings/ │ └── mcp.json # Project A specific servers project-b/ ├── .kiro/ │ └── settings/ │ └── mcp.json # Project B specific servers
Kiro starts a project's workspace servers only when that project is open. Workspace configuration separates server lists; it does not isolate server access. Without the local command sandbox or other OS restrictions, a workspace server can still access the files, credentials, environment variables, and network resources available to your user account.
- Never hardcode API keys or tokens in configuration files
- Use environment variables for sensitive data
- Rotate credentials regularly
- Store credentials securely using system keychains
- Use HTTPS for remote MCP servers
- Verify SSL/TLS certificates
- Use firewalls to restrict outbound connections from MCP servers
- Monitor network traffic for unusual activity
- Be cautious with servers that require broad network access
- Open the Kiro panel
- Select the Output tab
- Choose "Kiro - MCP Logs" from the dropdown
Periodically review which tools you've approved:
- Check your MCP configuration for auto-approved tools
- Review the MCP logs for tool usage patterns
- Monitor server activity for unexpected behavior
- Remove auto-approval for tools you no longer use frequently
If you suspect a security issue with an MCP server:
- Disable the server immediately in your configuration
- Revoke any tokens or API keys associated with the server
- Check for unauthorized activity in the connected services
- Report the issue to the MCP server maintainer
- Keep your system updated with security patches
- Run MCP servers with minimal privileges
- Use separate user accounts for running sensitive MCP servers
- Only install MCP servers from trusted sources
- Review tool descriptions and documentation before installation
- Check for security advisories and updates regularly
Best practices