[FEATURE] Better support for alloweding/denying for MCPs in Claude Code

Resolved 💬 3 comments Opened Apr 17, 2026 by starJammer Closed May 25, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

MCP tools take up context, context costs money.

I want to be able to enable/disable tools for use within Claude Code so that I can better optimize my usage since I'm charged by the token I consume. (I'm on an Enterprise plan)

The current functionality that loads MCP tools on demand does not appear to work consistently. It appears to only work with Sonnet, not Haiku. Based on output from the /context command.

<img width="698" height="371" alt="Image" src="https://github.com/user-attachments/assets/1ba0ebe9-3060-4fa9-9f21-22f0ba759bea" />

<img width="682" height="410" alt="Image" src="https://github.com/user-attachments/assets/8500fa15-5fc4-4e10-a2df-94383d3fdbe2" />

Proposed Solution

Use the .mcp.json file that is stored locally within a project to disable and enable tools. This has the advantage of NOT needing to run extra commands and co-locating the entire MCP configuration within one file, instead of spreading it out to the ./.claude/settings.json file.

Using the disabledTools approach

Seems to be supported by other agents and allows the disabling of tools to be co-located in the .mcp.json file.

{
  "mcpServers": {
    "confluence": {
      "args": [
        "-c",
        "docker run -i --rm -e ATLASSIAN_HOST=${ATLASSIAN_HOST} -e ATLASSIAN_EMAIL=${ATLASSIAN_EMAIL} -e ATLASSIAN_TOKEN=${ATLASSIAN_TOKEN} -e JIRA_SSL_VERIFY=false -e CONFLUENCE_SSL_VERIFY=false ghcr.io/metorial/mcp-container--sooperset--mcp-atlassian--mcp-atlassian \"mcp-atlassian --no-jira-ssl-verify --confluence-url $ATLASSIAN_HOST/wiki --confluence-username $ATLASSIAN_EMAIL --confluence-token $ATLASSIAN_TOKEN --jira-url ${ATLASSIAN_HOST} --jira-username ${ATLASSIAN_EMAIL} --jira-token ${ATLASSIAN_TOKEN}\""
      ],
      "command": "zsh",
      "disabled": false,
      "disabledTools": [
        // first tool is disabled because the tool name matches
        "confluence_delete_page",
        // to enable a tool add the -enabled suffix. Since the tool names don't match it would effectively be disabled.
        "confluence_get_comments-enabled",
        "confluence_update_page-enabled",
      ]
    }
  }
}

Alternative Solutions

Using the allowedTools approach

Mentioned in this issue and comment: https://github.com/anthropics/claude-code/issues/7328#issuecomment-4042941478

{
  "mcpServers": {
    "confluence": {
      "args": [
        "-c",
        "docker run -i --rm -e ATLASSIAN_HOST=${ATLASSIAN_HOST} -e ATLASSIAN_EMAIL=${ATLASSIAN_EMAIL} -e ATLASSIAN_TOKEN=${ATLASSIAN_TOKEN} -e JIRA_SSL_VERIFY=false -e CONFLUENCE_SSL_VERIFY=false ghcr.io/metorial/mcp-container--sooperset--mcp-atlassian--mcp-atlassian \"mcp-atlassian --no-jira-ssl-verify --confluence-url $ATLASSIAN_HOST/wiki --confluence-username $ATLASSIAN_EMAIL --confluence-token $ATLASSIAN_TOKEN --jira-url ${ATLASSIAN_HOST} --jira-username ${ATLASSIAN_EMAIL} --jira-token ${ATLASSIAN_TOKEN}\""
      ],
      "command": "zsh",
      "disabled": false,
      "allowedTools": [
        // enabled tools, all others are implicitly disabled
        "confluence_get_comments",
        "confluence_update_page"
      ]
    }
  }
}

Priority

Medium - Would be very helpful

Feature Category

MCP server integration

Use Case Example

_No response_

Additional Context

claude --version
2.1.112 (Claude Code)

I added a .mcp.json file to my project adding 3 servers with ALL tools disabled: Jira, Confluence, gitlab. See Appendix section for the file contents.

After, I started a claude session. I asked it to create a jira ticket using the jira_create_issue tool, which I KNEW was disabled. It created the ticket even though it should NOT have been able to do so.

I asked Claude how it was able to do that, this is the response I got.

How did you create that ticket if I marked the jira_create_issue tool as disabled in the .mcp.json file?

⏺ Good question. I didn't check your .mcp.json file — let me look at the current state.

  Read 1 file (ctrl+o to expand)

⏺ You're right to call this out. Here's what happened:

  jira_create_issue is listed in disabledTools under both the confluence and jira servers. However, I called mcp__jira__jira_create_issue and it succeeded — meaning the
  disabledTools list in .mcp.json was not enforced by the runtime. The tool was still callable despite being listed there.

  This looks like a bug or limitation in how Claude Code reads and enforces disabledTools. The /mcp dialog showed all tools as "Available" without distinguishing
  disabled ones, and the deferred tool schema loaded and executed without any block.

  You should report this at https://github.com/anthropics/claude-code/issues — disabling tools in .mcp.json should prevent them from being called.

※ recap: We were testing MCP tool availability and discovered that disabledTools in .mcp.json is not being enforced by Claude Code — jira_create_issue executed
  successfully despite being listed as disabled. Next step is to report this bug to the Claude Code GitHub issues page. (disable recaps in /config)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗