Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

kiro-cli chat is not honoring tools / commands mentioned in ~/.kiro/settings/mcp.json or ~/.kiro/agents/default.json

Open stm29 opened this issue 7 months ago • 7 comments

Before opening, please confirm:

Operating System

Amazon Linux 2

Kiro Version

2.0.0

Bug Description

I have added tools Specific & commands specific things in ~/.kiro/settings/mcp.json, I am using kiro-cli chat, but cli is not working, but when i do alias kc='kiro-cli chat --trust-tools "read,write,aws,report"' in my ~/.bash_profile file, it works.

{
    "autoApprove": [
        "read",
        "write",
        "shell",
        "aws"
    ],
    "toolsSettings": {
        "shell": {
            "allowedCommands": [
                "git .*",
                "ls .*",
                "cat .*",
                "ls .*",
                "pwd",
                "echo .*",
                "find .*",
                "grep .*",
                "cd .*"
            ],
            "deniedCommands": [
                ".*rm -rf.*",
                "sudo .*",
                ".*> /dev/sda.*"
            ]
        },
        "read": {
            "allowedPaths": ["*"]
        },
        "write": {
            "allowedPaths": ["*"]
        }
    }
}

Steps to Reproduce

  1. create the mentioned file in path ~/.kiro/settings/mcp.json
  2. start kiro-cli
  3. run the commands mentioned in "allowedCommands"
  4. ls -l
  5. 17% > ls -l
    I will run the following command: ls -l (using tool: shell)
    Purpose: List files in current directory
    Allow this action? Use 't' to trust (always allow) the 'shell' tool for the session. [y/n/t]:
    17% >
    

Expected Behavior

  1. ls -l should run, instead of asking to Allow this action?

Conversation ID

No response

Additional Context

No response

stm29 avatar Apr 15 '26 09:04 stm29

🤖 Potential Duplicate Detected

This issue appears to be similar to:

What happens next?

  • ⏰ This issue will be automatically closed in 3 days
  • 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
  • 💬 Comment on the original issue if you have additional information

Why is this marked as duplicate? Both report the execute_bash/shell tool not respecting configuration settings and blocking commands despite proper allowedCommands configuration. Same core problem with tool permissions not being honored from config files.

github-actions[bot] avatar Apr 15 '26 09:04 github-actions[bot]

This is more sort of IDE - https://github.com/kirodotdev/Kiro/issues/4743. but on cli, so not sure both are different cases, and IDE reads from different path for config and cli reads from different path.

stm29 avatar Apr 15 '26 09:04 stm29

Thank you for your feedback! 🙏

The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar Apr 15 '26 09:04 github-actions[bot]

Hi @stm29, thanks for filing this — you're right that this is CLI-specific and not a duplicate of #4743.

The issue is that ~/.kiro/settings/mcp.json is only for defining MCP server configurations (the mcpServers block). The fields you're using — toolsSettings, allowedCommands — are agent configuration fields that belong in an agent config file, not in mcp.json.

Additionally, autoApprove isn't a recognized field in the CLI agent config schema. The CLI equivalent is allowedTools.

To fix this, create a global agent config file at ~/.kiro/agents/default.json:

{
  "name": "default",
  "tools": ["*"],
  "allowedTools": [
    "read",
    "write",
    "shell",
    "aws"
  ],
  "toolsSettings": {
    "shell": {
      "allowedCommands": [
        "git .*",
        "ls .*",
        "cat .*",
        "pwd",
        "echo .*",
        "find .*",
        "grep .*"
      ],
      "deniedCommands": [
        ".*rm -rf.*",
        "sudo .*",
        ".*> /dev/sda.*"
      ]
    },
    "write": {
      "allowedPaths": ["**"]
    },
    "read": {
      "allowedPaths": ["**"]
    }
  }
}

Then switch to it with /agent swap default, or it should load automatically if it's your only agent.

Your ~/.kiro/settings/mcp.json should only contain MCP server definitions.

The reason --trust-tools "read,write,aws,report" works is that it directly sets the allowed tools at runtime, bypassing the config file entirely.

AnilMaktala avatar Apr 16 '26 18:04 AnilMaktala

Thanks it worked. /agents load default is the done which worked.

default, or it should load automatically if it's your only agent.

So if multiple agents configurations ( ~/.kiro/agents/{some_2_3_configurations}.json ) are there it won't load default.json by default?

stm29 avatar Apr 16 '26 23:04 stm29

Once answered feel free to close this

stm29 avatar Apr 16 '26 23:04 stm29

Glad loading the agent fixed it. Closing this since the question is answered. If this still happens, please reopen this issue or open a new one with your Kiro version, steps to reproduce, and any error message.

AnilMaktala avatar Nov 10 '26 16:11 AnilMaktala