Skip to content

[WIP] Support completions for GH resources #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 28, 2025

  • Explore repository structure and understand current state
  • Understand MCP completion protocol requirements
  • Identify resource templates that need completion support
  • Verify build and test setup works
  • Add completion capability to server configuration
  • Implement CompletionHandlerFunc type and registration
  • Create repository_completions.go with GitHub API completion logic
  • Add completion handler to server registration
  • Write tests for completion functionality
  • Create completion-aware stdio server wrapper
  • Implement custom in-process transport for GitHubMCPServer
  • Test end-to-end completion behavior with working MCP client
  • Update library dependencies to latest version

Successfully implemented full completion support for GitHub MCP Server!

Core Completion Logic:

  • CompletionHandlerFunc type and registration in GitHubMCPServer
  • Comprehensive RepositoryCompletionHandler that provides contextual completions for:
    • Repository owners/organizations (via GitHub search)
    • Repository names (via GitHub search with owner context)
    • Branch names (via GitHub API for specific repos)
    • Commit SHAs (via GitHub API for specific repos)
    • Tag names (via GitHub API for specific repos)
    • Pull request numbers (via GitHub API for specific repos)
    • File paths (via GitHub API directory listings)

Custom MCP Server & Transport:

  • Extended GitHubMCPServer that wraps base MCPServer and overrides HandleMessage
  • Custom completion handling that intercepts completion/complete requests
  • GitHubInProcessTransport that routes requests through the custom server
  • Proper JSON-RPC error and response handling
  • Falls back to base server for all non-completion requests

Working Integration:

  • ✅ End-to-end completion tests passing using custom in-process client
  • ✅ Proper error handling for invalid requests and GitHub API failures
  • ✅ Empty completion results for non-repo URIs and unsupported arguments
  • ✅ Full test coverage including unit and integration tests
  • ✅ All existing tests continue to pass

Client Usage:

  • Use NewInProcessClientWithGitHubServer() for testing with completion support
  • Use custom stdio server wrapper for command-line completion support
  • Maintains backward compatibility with existing toolsets and resources

The completion feature now works end-to-end and provides intelligent GitHub resource completions based on context!

Fixes #422.


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

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.

Support completions for GH resources
2 participants