Skip to content

Fix safe-outputs MCP server tools registration by adding missing environment variables#11148

Merged
pelikhan merged 2 commits intocopilot/convert-safe-outputs-to-html-transportfrom
copilot/investigate-no-comments-created
Jan 22, 2026
Merged

Fix safe-outputs MCP server tools registration by adding missing environment variables#11148
pelikhan merged 2 commits intocopilot/convert-safe-outputs-to-html-transportfrom
copilot/investigate-no-comments-created

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Safe-outputs MCP server returned {"tools":[]} when the MCP gateway called tools/list at startup, preventing agents from using create_issue, add_comment, and other safe-outputs operations.

Root Cause

The server startup step was missing environment variables that specify file paths:

# Before - server falls back to non-existent /tmp/gh-aw/safeoutputs/
env:
  GH_AW_SAFE_OUTPUTS_PORT: ...
  GH_AW_SAFE_OUTPUTS_API_KEY: ...

Without GH_AW_SAFE_OUTPUTS_TOOLS_PATH and GH_AW_SAFE_OUTPUTS_CONFIG_PATH, the server's loadTools() function couldn't find the workflow-generated tool definitions at /opt/gh-aw/safeoutputs/tools.json and returned an empty array.

Changes

Modified pkg/workflow/mcp_setup_generator.go to include missing environment variables:

# After - server finds tools at correct location
env:
  GH_AW_SAFE_OUTPUTS_PORT: ...
  GH_AW_SAFE_OUTPUTS_API_KEY: ...
  GH_AW_SAFE_OUTPUTS_TOOLS_PATH: /opt/gh-aw/safeoutputs/tools.json
  GH_AW_SAFE_OUTPUTS_CONFIG_PATH: /opt/gh-aw/safeoutputs/config.json
  GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs

All workflow lock files regenerated with the fix applied.

Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/21232781914/job/61094490165

Investigate why no comments were created.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

The safe-outputs MCP server was returning an empty tools list because
critical environment variables were not set when the server started.

Changes:
- Add GH_AW_SAFE_OUTPUTS_TOOLS_PATH env var to point to /opt/gh-aw/safeoutputs/tools.json
- Add GH_AW_SAFE_OUTPUTS_CONFIG_PATH env var to point to /opt/gh-aw/safeoutputs/config.json
- Add GH_AW_MCP_LOG_DIR env var to point to /tmp/gh-aw/mcp-logs/safeoutputs
- Export these variables in the server startup script

Without these variables, the server fell back to /tmp/gh-aw/safeoutputs/ paths which
don't exist, causing tools.json and config.json to not be found, resulting in 0 tools
being registered.

This fixes workflow run 21232781914 where the agent couldn't use create_issue and
add_comment tools, falling back to writing markdown files that were never processed.

File changed: pkg/workflow/mcp_setup_generator.go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review January 22, 2026 02:23
Copilot AI changed the title [WIP] Investigate absence of created comments Fix safe-outputs MCP server tools registration by adding missing environment variables Jan 22, 2026
Copilot AI requested a review from pelikhan January 22, 2026 02:24
@pelikhan pelikhan merged commit 9cf9c54 into copilot/convert-safe-outputs-to-html-transport Jan 22, 2026
@pelikhan pelikhan deleted the copilot/investigate-no-comments-created branch January 22, 2026 02:25
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.

2 participants