Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 19, 2025

Users now have complete visibility into MCP server logs during workflow execution for debugging purposes. Previously, MCP server logs were lost when workflows completed, making it difficult to troubleshoot connection issues, tool failures, and server errors.

What's Changed

MCP Server Configuration Updates

  • Modified Docker container configuration to use named containers (mcp-{toolname}-${github.run_id}) instead of auto-removal
  • Updated both Claude and Codex engines to support log collection
  • Maintains backward compatibility with existing workflow configurations

New Log Collection Steps

  • Added automatic MCP server log collection after agentic execution
  • Creates dedicated /tmp/mcp-logs/ directory with individual log files per MCP server
  • Handles missing containers gracefully by creating informative placeholder logs
  • Includes container cleanup to prevent resource leaks

Artifact Upload

  • Uploads all MCP server logs as mcp-server-logs artifact alongside existing workflow logs
  • Runs with if: always() to capture logs even when workflows fail
  • Provides debugging visibility through log file summaries

Example Output

When workflows use MCP servers (GitHub, custom stdio servers, etc.), the generated workflow now includes:

- name: Collect MCP server logs
  if: always()
  run: |
    echo "Collecting MCP server logs..."
    mkdir -p /tmp/mcp-logs
    
    # Collect Docker container logs for MCP servers
    echo "Collecting logs for MCP server: github"
    if docker ps -a --format '{{.Names}}' | grep -q '^mcp-github-${{ github.run_id }}$'; then
      docker logs mcp-github-${{ github.run_id }} > /tmp/mcp-logs/github.log 2>&1
      docker rm -f mcp-github-${{ github.run_id }} || true
    else
      echo "No MCP server container found for github" > /tmp/mcp-logs/github.log
    fi

- name: Upload MCP server logs  
  if: always()
  uses: actions/upload-artifact@v4
  with:
    name: mcp-server-logs
    path: /tmp/mcp-logs/
    if-no-files-found: warn

Testing

Added comprehensive test coverage in mcp_log_collection_test.go covering:

  • Workflows with GitHub MCP servers
  • Workflows with custom MCP servers
  • Workflows with multiple MCP servers
  • Workflows without MCP servers (no-op behavior)

All existing tests pass, confirming no breaking changes to current functionality.

Fixes #119.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.contoso.com
    • Triggering command: /tmp/go-build488418282/b278/cli.test -test.testlogfile=/tmp/go-build488418282/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build3358252787/b278/cli.test -test.testlogfile=/tmp/go-build3358252787/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build977542521/b278/cli.test -test.testlogfile=/tmp/go-build977542521/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Add generateMCPLogCollection function to collect MCP server logs
- Modify Docker container configuration to remove --rm and add unique names
- Add log collection step after agentic execution to capture container logs
- Add upload step for MCP server logs as artifacts
- Support both Claude and Codex engines
- Add comprehensive test coverage for the new functionality
- Include container cleanup after log collection to avoid resource leaks

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copilot AI changed the title [WIP] Add MCP Server Log Collection and Upload to Workflow Runs Add MCP Server Log Collection and Upload to Workflow Runs Aug 19, 2025
Copilot AI requested a review from Mossaka August 19, 2025 21:33
@Mossaka Mossaka closed this Aug 19, 2025
@pelikhan pelikhan deleted the copilot/fix-119 branch September 17, 2025 15:14
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.

Proposal: Add MCP Server Log Collection and Upload to Workflow Runs

2 participants