Skip to content

Add support for exact relative path resolution in mcp inspect command#1768

Merged
pelikhan merged 5 commits intomainfrom
copilot/update-mcp-inspect-support
Oct 16, 2025
Merged

Add support for exact relative path resolution in mcp inspect command#1768
pelikhan merged 5 commits intomainfrom
copilot/update-mcp-inspect-support

Conversation

Copy link
Contributor

Copilot AI commented Oct 15, 2025

Summary

The gh aw mcp inspect command now supports exact relative path resolution for workflow files under .github/workflows, making it easier to inspect MCP server configurations in subdirectories.

Problem

Previously, mcp inspect could only resolve workflow files from the .github/workflows/ directory. Shared MCP configurations like serena.md, tavily.md, and other files in subdirectories like shared/mcp/ required users to provide full absolute or relative paths:

# Required before this change
gh aw mcp inspect .github/workflows/shared/mcp/serena.md

# Would fail with "workflow file not found"
gh aw mcp inspect shared/mcp/serena

Solution

Enhanced the ResolveWorkflowPath function to support exact relative path resolution under .github/workflows:

  1. Exact path - If the path exists as-is, use it
  2. Exact relative path - Try path under .github/workflows (e.g., shared/b.md.github/workflows/shared/b.md)

Changes

  • pkg/cli/resolver.go: Enhanced path resolution to support exact relative paths under .github/workflows
  • pkg/cli/resolver_test.go: Added comprehensive tests covering full relative paths with and without .md extension
  • pkg/cli/mcp_inspect.go: Updated inspector flag to use the enhanced path resolution

Examples

Users must provide the full relative path to access nested workflows:

# Full relative path required for nested workflows
gh aw mcp inspect shared/mcp/serena.md
gh aw mcp inspect shared/mcp/serena  # .md extension added automatically

# Main workflows still work with just the name
gh aw mcp inspect daily-news

# Launch inspector with shared workflow
gh aw mcp inspect shared/mcp/serena --inspector

All existing functionality remains unchanged:

  • Main workflow files still work as before
  • Absolute paths still work
  • Listing workflows works correctly
  • Error handling for nonexistent files works as expected

Testing

  • ✅ All existing unit tests pass
  • ✅ New tests added for exact relative path resolution
  • ✅ Linting passes
  • ✅ Manual testing confirms all use cases work correctly
  • ✅ Backward compatibility maintained for main workflow files
Original prompt

Update the "mcp inspect" to support loading and inspect shared agentic workflows like serena.md without requiring a full agentic workflow


💡 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.

Copilot AI and others added 2 commits October 15, 2025 23:47
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update mcp inspect to load shared agentic workflows Add support for inspecting shared agentic workflows in mcp inspect command Oct 15, 2025
Copilot AI requested a review from pelikhan October 15, 2025 23:55
@pelikhan
Copy link
Contributor

@copilot search all workflows under .github/workflows as long as the subpath matches.

First full relative path match then

a.md -> .github/workflows/a.md
shared/b.md -> .github/workflows/b.md

There is already logic in the add command to do this kind of resolutions, refactor and reuse.

- Walk entire .github/workflows tree to find workflow files
- Support full relative path matching (e.g., shared/mcp/serena.md)
- Support subpath matching (e.g., mcp/serena matches shared/mcp/serena.md)
- Support basename matching (e.g., serena matches any serena.md in subdirs)
- Resolution priority: exact path > exact relative path > subpath match > basename match

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 16, 2025

@copilot search all workflows under .github/workflows as long as the subpath matches.

...

Refactored ResolveWorkflowPath to recursively search all workflows under .github/workflows with subpath matching support.

The function now supports:

  • Full relative paths: shared/b.md.github/workflows/shared/b.md
  • Subpath matching: mcp/serena.github/workflows/shared/mcp/serena.md
  • Basename matching: serena → any serena.md in subdirectories

Resolution priority: exact path → exact relative path → subpath match → basename match

Commit: Refactor ResolveWorkflowPath to support recursive subpath matching

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:

  • mcp.tavily.com
    • Triggering command: ./gh-aw mcp inspect daily-news (dns block)

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

@pelikhan
Copy link
Contributor

@copilot remove recursive subpath matching

Copilot AI changed the title Add support for inspecting shared agentic workflows in mcp inspect command Add support for recursive workflow path resolution in mcp inspect command Oct 16, 2025
Simplified to only support exact relative paths under .github/workflows:
- a.md -> .github/workflows/a.md
- shared/b.md -> .github/workflows/shared/b.md

Removed recursive directory walking and fuzzy matching (basename/suffix).
Users must provide full relative path to access nested workflows.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 16, 2025

@copilot remove recursive subpath matching

Removed recursive subpath matching. Now only supports exact relative paths:

  • a.md.github/workflows/a.md
  • shared/b.md.github/workflows/shared/b.md

Users must provide full relative path for nested workflows (e.g., shared/mcp/serena.md). Basename-only matching (serena) no longer works.

Commit: Remove recursive subpath matching from ResolveWorkflowPath

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:

  • mcp.tavily.com
    • Triggering command: ./gh-aw mcp inspect daily-news (dns block)

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

Copilot AI changed the title Add support for recursive workflow path resolution in mcp inspect command Add support for exact relative path resolution in mcp inspect command Oct 16, 2025
@pelikhan pelikhan marked this pull request as ready for review October 16, 2025 00:50
@pelikhan pelikhan merged commit 4aaf0b8 into main Oct 16, 2025
5 checks passed
@pelikhan pelikhan deleted the copilot/update-mcp-inspect-support branch October 16, 2025 00:50
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request

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