Skip to content

[WIP] Fix MCP server permission denied error for testing#14183

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-permission-denied-error
Closed

[WIP] Fix MCP server permission denied error for testing#14183
Copilot wants to merge 3 commits intomainfrom
copilot/fix-permission-denied-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Investigation Plan: MCP Server Permission Denied Error

  • Analyze the problem: Permission denied error for all MCP tools
  • Review repository memories: Found naming convention issue
  • Identify root cause: MCP server ID mismatch
  • Add constant for AgenticWorkflowsMCPServerID
  • Update mcp_config_builtin.go to use correct ID
  • Update mcp_renderer.go references
  • Update all tests to use correct ID
  • Run targeted tests to validate changes
  • Recompile all workflows
  • Validate generated lock files
  • Run full test suite

Root Cause & Resolution

The Problem:
The Daily CLI Tools Exploratory Tester and other workflows were failing with "Permission denied and could not request permission from user" errors when attempting to use the agentic-workflows MCP server.

Root Cause:
Built-in MCP server identifiers in gh-aw follow a single-word lowercase naming convention:

  • safeoutputs (not safe_outputs)
  • safeinputs (not safe_inputs)
  • agenticworkflows (not agentic_workflows)

The compiled workflow lock files were incorrectly generating "agentic_workflows" (with underscore), but the Copilot agent expected "agenticworkflows" (no separator). This mismatch caused permission validation to fail.

The Fix:

  1. ✅ Added AgenticWorkflowsMCPServerID = "agenticworkflows" constant to pkg/constants/constants.go
  2. ✅ Updated pkg/workflow/mcp_config_builtin.go to use the constant
  3. ✅ Updated pkg/workflow/mcp_renderer.go TOML rendering
  4. ✅ Updated all test expectations and added constants imports
  5. ✅ Recompiled all 146 workflows successfully
  6. ✅ Verified no agentic_workflows (underscore) remains in any lock file
  7. ✅ All unit tests pass

Impact:
This fix resolves the permission denied errors and allows workflows to properly access the agentic-workflows MCP server for audit, logs, and compile functionality.

Original prompt

This section details on the original issue you should resolve

<issue_title>[cli-tools-test] MCP Server Permission Denied Error Blocking All Testing</issue_title>
<issue_description>## Problem Description

The Daily CLI Tools Exploratory Tester is unable to perform any testing due to a "Permission denied and could not request permission from user" error when attempting to use MCP server tools, including the agentic-workflows server.

Impact

  • Severity: Critical
  • Frequency: Always (100% failure rate)
  • Affected Tools: All MCP tools (agentic-workflows, github, bash, status)
  • Workaround: None identified

This completely blocks the automated testing workflow, preventing:

  • Testing of audit command functionality
  • Testing of logs command functionality
  • Testing of compile command functionality
  • Any MCP tool usage for exploratory testing

Steps to Reproduce

  1. Workflow triggered: Daily CLI Tools Exploratory Tester
  2. Attempt to call any MCP tool (e.g., agentic_workflows-status)
  3. Observe "Permission denied" error

Expected Behavior

MCP server tools should be accessible and return responses based on tool invocation.

Actual Behavior

All tool calls return: Permission denied and could not request permission from user

Environment

  • Repository: github/gh-aw
  • Run ID: 21757938067
  • Workflow: Daily CLI Tools Exploratory Tester
  • Date: 2026-02-06T16:32:18Z

Diagnostics

MCP Server Status (from logs)

MCP Gateway: ✅ Healthy and running

- ✓ startup: MCPG Gateway version: v0.0.103
- ✓ startup: Loaded 3 MCP server(s): [agentic_workflows github safeoutputs]
- ✓ backend: Successfully connected to MCP backend server
- ✓ startup: Starting in ROUTED mode on 0.0.0.0:80

MCP Configuration (/home/runner/.copilot/mcp-config.json):

{
  "mcpServers": {
    "agentic_workflows": {
      "type": "http",
      "url": "(host.docker.internal/redacted)
      "tools": ["*"]
    },
    "github": { ... },
    "safeoutputs": { ... }
  }
}
```

**Agentic Workflows MCP Server**: ✅ Initialized successfully
```
[2026-02-06T16:32:04Z] [INFO] [backend] Successfully launched MCP backend server: agentic_workflows
[2026-02-06T16:32:04Z] [INFO] [backend] [stderr] mcp:server MCP server ready on stdio
[2026-02-06T16:32:04Z] [INFO] [backend] Successfully registered tools from agentic_workflows

Error Details

Failed Tool Calls:

  • agentic_workflows-status → Permission denied
  • bash commands → Permission denied (some commands succeed, others fail)

Gateway Logs: No errors or authentication failures logged. All requests show status 200 or 202.

Analysis

The MCP infrastructure (gateway, backend servers, configuration) is functioning correctly. The "Permission denied" error appears to originate from the Copilot agent environment itself, not from the MCP servers or gateway.

Possible causes:

  1. Agent permission model: The Copilot agent may have restrictions on which MCP tools can be called
  2. Authentication/authorization: Session or token validation may be failing at the agent level
  3. Tool registration: MCP tools may not be properly registered with the agent runtime
  4. Environment issue: Specific to this workflow's execution environment

Recommendations

  1. Investigate agent permission model: Review how the Copilot agent validates and authorizes MCP tool calls
  2. Check tool registration: Verify that agentic-workflows tools are properly registered in the agent's tool catalog
  3. Review authentication flow: Ensure the agent session has proper credentials for MCP tool access
  4. Test in different context: Try the same workflow with a different engine (e.g., claude, codex) to isolate the issue
  5. Agent logs: Examine Copilot agent internal logs (if available) for more detailed error information

Additional Context

This is a blocker for the entire Daily CLI Tools Exploratory Testing workflow. Without MCP tool access, no testing phases can be executed. The workflow instructions explicitly state "DO NOT USE gh aw it is not authenticated. Only use tools."

The workflow appears to be caught in a permissions deadlock where:

  • Direct CLI usage is unavailable (not authenticated)
  • MCP tool usage is blocked (permission denied)
  • No alternative testing mechanism is available

AI generated by Daily CLI Tools Exploratory Tester

  • expires on Feb 13, 2026, 4:36 PM UTC

Comments on the Issue (you are @copilot in this section)

@pelikhan Investigate gateway.log and agent logs to determine why this mcp fails.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 6, 2026 16:55
- Add AgenticWorkflowsMCPServerID constant
- Update mcp_config_builtin.go to use constant
- Update mcp_renderer.go TOML rendering
- Update all test expectations
- Add constants imports to test files

This aligns with built-in MCP server naming convention:
- safeoutputs (not safe_outputs)
- safeinputs (not safe_inputs)
- agenticworkflows (not agentic_workflows)

Fixes permission denied errors in Copilot agent workflows

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan closed this Feb 6, 2026
Copilot AI requested a review from pelikhan February 6, 2026 16:59
Copilot stopped work on behalf of pelikhan due to an error February 6, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cli-tools-test] MCP Server Permission Denied Error Blocking All Testing

2 participants