Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support debugging e2e tests#380

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
williammartin merged 2 commits intomainfromwm/debug-e2e-tests
May 7, 2025
Merged

Conversation

williammartin
Copy link
Collaborator

@williammartinwilliammartin commentedMay 7, 2025
edited
Loading

Description

While working on other issues, I often found myself experiencing failures that were not easy to debug given the black box nature of the e2e tests. Now we can useGITHUB_MCP_SERVER_E2E_DEBUG=true to run an inprocess server version of the server, allowing for breakpointing. Open to renaming the env var to indicate exactly what it does, rather than debug. See image:

image
➜  github-mcp-server git:(wm/debug-e2e-tests) GOMAXPROCS=1 GITHUB_MCP_SERVER_E2E_TOKEN=$(gh auth token) go test -v -count=1 --tags e2e ./e2e=== RUN   TestGetMe=== PAUSE TestGetMe=== RUN   TestToolsets=== PAUSE TestToolsets=== RUN   TestTags=== PAUSE TestTags=== CONT  TestGetMe    e2e_test.go:49: Building Docker image for e2e tests...    e2e_test.go:122: Starting Stdio MCP client...--- PASS: TestGetMe (3.07s)=== CONT  TestTags    e2e_test.go:122: Starting Stdio MCP client...    e2e_test.go:245: Getting current user...    e2e_test.go:274: Creating repository williammartin/github-mcp-server-e2e-TestTags-1746619480361...    e2e_test.go:291: Creating tag williammartin/github-mcp-server-e2e-TestTags-1746619480361:v0.0.1...    e2e_test.go:321: Listing tags for williammartin/github-mcp-server-e2e-TestTags-1746619480361...    e2e_test.go:354: Getting tag williammartin/github-mcp-server-e2e-TestTags-1746619480361:v0.0.1...    e2e_test.go:283: Deleting repository williammartin/github-mcp-server-e2e-TestTags-1746619480361...--- PASS: TestTags (3.51s)=== CONT  TestToolsets    e2e_test.go:122: Starting Stdio MCP client...--- PASS: TestToolsets (0.19s)PASSok      github.com/github/github-mcp-server/e2e 7.048s➜  github-mcp-server git:(wm/debug-e2e-tests) GOMAXPROCS=1 GITHUB_MCP_SERVER_E2E_DEBUG=true GITHUB_MCP_SERVER_E2E_TOKEN=$(gh auth token) go test -v -count=1 --tags e2e ./e2e=== RUN   TestGetMe=== PAUSE TestGetMe=== RUN   TestToolsets=== PAUSE TestToolsets=== RUN   TestTags=== PAUSE TestTags=== CONT  TestGetMe    e2e_test.go:142: Starting In Process MCP client...--- PASS: TestGetMe (0.46s)=== CONT  TestTags    e2e_test.go:142: Starting In Process MCP client...    e2e_test.go:245: Getting current user...    e2e_test.go:274: Creating repository williammartin/github-mcp-server-e2e-TestTags-1746619493471...    e2e_test.go:291: Creating tag williammartin/github-mcp-server-e2e-TestTags-1746619493471:v0.0.1...    e2e_test.go:321: Listing tags for williammartin/github-mcp-server-e2e-TestTags-1746619493471...    e2e_test.go:354: Getting tag williammartin/github-mcp-server-e2e-TestTags-1746619493471:v0.0.1...    e2e_test.go:283: Deleting repository williammartin/github-mcp-server-e2e-TestTags-1746619493471...--- PASS: TestTags (3.04s)=== CONT  TestToolsets    e2e_test.go:142: Starting In Process MCP client...--- PASS: TestToolsets (0.00s)PASSok      github.com/github/github-mcp-server/e2e 3.738s➜  github-mcp-server git:(wm/debug-e2e-tests)

Doing this also drove out some nice cleanups, separating config parsing, mcp server construction and stdio server execution. I have not written unit tests for these extracted functions as they were not previously tested and currently get most of their coverage from the e2e tests. I believe that later we may want to look into further testing of these to support further refactors, but that is out of scope for this PR.

@CopilotCopilotAI review requested due to automatic review settingsMay 7, 2025 12:04
@williammartinwilliammartin requested a review froma team as acode ownerMay 7, 2025 12:04
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR refactors server startup logic into a shared internal package and adds an in-process debug mode for end-to-end tests.

  • ExtractNewMCPServer andRunStdioServer intointernal/ghmcp and wire them into the CLI
  • Update e2e tests to optionally run the MCP server in‐process viaGITHUB_MCP_SERVER_E2E_DEBUG
  • Document the new debug mode ine2e/README.md

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

FileDescription
internal/ghmcp/server.goNew shared server construction & stdio runner
e2e/e2e_test.goRefactor test client setup to support Docker vs. in-process debug
e2e/README.mdAdd instructions for theGITHUB_MCP_SERVER_E2E_DEBUG flag
cmd/github-mcp-server/main.goSwitch CLI commands to useinternal/ghmcp andRunE for errors
Comments suppressed due to low confidence (2)

internal/ghmcp/server.go:101

  • [nitpick] The variable namecontext shadows the importedcontext package. Consider renaming toctxToolset or similar to avoid confusion.
context := github.InitContextToolset(getClient, cfg.Translator)

internal/ghmcp/server.go:47

  • Newly extracted functions likeNewMCPServer andRunStdioServer lack direct unit tests. Consider adding unit tests to cover config parsing, hook registration, and shutdown behavior.
func NewMCPServer(cfg MCPServerConfig) (*server.MCPServer, error) {

enabledToolsets = github.DefaultTools
}

ghServer, err := ghmcp.NewMCPServer(ghmcp.MCPServerConfig{
Copy link
Preview

CopilotAIMay 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

TheMCPServerConfig only setsToken,EnabledToolsets, andTranslator, leavingVersion,Host,DynamicToolsets, andReadOnly at zero values. This can change client behavior—please populate all required fields.

Copilot uses AI. Check for mistakes.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeh they aren't required, that's why.

This commit cleanly separates config parsing, stdio server execution andmcp server construction. Aside from significant clarity improvements, itallows for direct construction of the mcp server in e2e tests to allowfor breakpoint debugging.
juruen
juruen previously approved these changesMay 7, 2025
Copy link
Collaborator

@juruenjuruen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks great! Just a small comment. 🚀

args = append(args, "github/e2e-github-mcp-server")

// Construct the env vars for the MCP Client to execute docker with
dockerEnvVars := make([]string, 0, len(opts.enabledToolsets)+1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If I'm not mistaken, as you arejoiningopts.enabledToolsets below, you might not want to set this slice size, and it could be just2?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks, this was part of the previous implementation where we supportedWithEnvVars, so it could have beenn. Good spot, thanks, will adjust before merge.

@williammartin
Copy link
CollaboratorAuthor

Bypassing review requirement as the only thing I changed after@juruen approved was to fixhttps://github.com/github/github-mcp-server/pull/380/files#r2077653340

@williammartinwilliammartin merged commit0ca07aa intomainMay 7, 2025
16 checks passed
@williammartinwilliammartin deleted the wm/debug-e2e-tests branchMay 7, 2025 14:13
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@juruenjuruenjuruen left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@williammartin@juruen

[8]ページ先頭

©2009-2025 Movatter.jp