Skip to content

Support the ability to have multiple instances running at the same time #206

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

Open
ylazzari opened this issue Apr 9, 2025 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@ylazzari
Copy link

ylazzari commented Apr 9, 2025

Hi.

My organization is currently slowing migrating from a hosted Github Enterprise Server instance to Github Enterprise Cloud. When I try to use VS Code's Agent support, I can configure two distinct tools with different names and different configurations. Something like this:

{ 
  "chat.agent.enabled": true,
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "ghec_token",
        "description": "GitHub Enterprise Cloud Personal Access Token",
        "password": true
      },
      {
        "type": "promptString",
        "id": "ghes_token",
        "description": "GitHub Enterprise Server Personal Access Token",
        "password": true
      }
    ],
    "servers": {
      "GHEC": {
        "command": "github-mcp-server",
        "args": [
            "stdio"
        ],
        "env": {
            "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:ghec_token}"
        }
      },      
      "GHES": {
        "command": "github-mcp-server",
        "args": [
            "stdio"
        ],
        "env": {
            "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:ghes_token}",
            "GH_HOST": "https://someotherdomain.com"
        }
      }           
    }       
  }
}

The problem is that the Agent is confused and seems to pin itself to only the set of tools exposed by one of the servers, hence I cannot navigate between the repos hosted on both Github instances. I can't seem to "prompt" engineer my way out of this.

The Github MCP server docs show how to overwrite individual tool descriptions. I haven't tried, but I guess I could override the tool descriptions for both servers, explicitly call out one set is for GHEC, one for GHES, and see if I can then adjust the prompt to force it to use one set of tools, so one server, or the other. But I'm hoping there's a better way to do this.

This may be more of a VS Code issue, but maybe there's something in how the server is actually implemented that could help facilitate this use case.

Thank you!

@ylazzari ylazzari added the enhancement New feature or request label Apr 9, 2025
@smadi0x86
Copy link

The github MCP server already has the code to support multiple instances as shown in codebase:

  1. Server Configuration Support (from cmd/github-mcp-server/main.go):
// Create GH client
token := os.Getenv("GITHUB_PERSONAL_ACCESS_TOKEN")
if token == "" {
    cfg.logger.Fatal("GITHUB_PERSONAL_ACCESS_TOKEN not set")
}
ghClient := gogithub.NewClient(nil).WithAuthToken(token)
ghClient.UserAgent = fmt.Sprintf("github-mcp-server/%s", version)

// Check GH_HOST env var first, then fall back to viper config
host := os.Getenv("GH_HOST")
if host == "" {
    host = viper.GetString("gh-host")
}

if host != "" {
    var err error
    ghClient, err = ghClient.WithEnterpriseURLs(host, host)
    if err != nil {
        return fmt.Errorf("failed to create GitHub client with host: %w", err)
    }
}
  1. Tool Name Differentiation (from pkg/github/server.go):
func NewServer(client *github.Client, version string, readOnly bool, t translations.TranslationHelperFunc) *server.MCPServer {
    s := server.NewMCPServer(
        "github-mcp-server",
        version,
        server.WithResourceCapabilities(true, true),
        server.WithLogging())

As previously shown, the server already supports:

  1. Running multiple instances with different configurations
  2. Using different tokens for each instance
  3. Configuring different GitHub hosts for each instance
  4. Overriding tool descriptions using environment variables or configuration files

The issue appears to be more related to vscode agent implementation rather than a limitation in the GitHub MCP server itself.

@SamMorrowDrums
Copy link
Collaborator

I would love to hear back if overriding tool descriptions works. Definitely also share this use case with vscode.

@digitarald
Copy link
Member

digitarald commented Apr 10, 2025

Feature I am tracking for client-side controls/customizations; as I heard the same use case before: microsoft/vscode#243940

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants