An MCP server for GitHub Enterprise that handles repository access, branch creation, commits, and pushes
Project description
github-enterprise-mcp MCP server
An MCP server for GitHub Enterprise that handles repository access, branch creation, commits, and pushes.
Components
Resources
The server implements GitHub Enterprise repositories as resources:
- Custom github:// URI scheme for accessing repositories
- Each repository resource has a name, description and custom mimetype
- Resources are dynamically loaded from the connected GitHub Enterprise instance
Prompts
The server provides the following prompts:
- repo-details: Gets detailed information about a repository
- Required "repository" argument to specify the repository
- Returns comprehensive information about the repository
- create-pr-description: Creates a pull request description based on changes
- Required "repository", "base_branch", and "head_branch" arguments
- Analyzes branch differences and suggests PR description
Tools
The server implements the following tools:
- test-api-connection: Test connection to a GitHub API endpoint
- Takes "url" as a required string argument
- Tests multiple API endpoint formats to determine which works
- Provides recommendations for the correct URL to use
- Useful for troubleshooting API connectivity issues
- connect-github-enterprise: Connect to a GitHub Enterprise instance
- Takes "name", "url", and "token" as required string arguments
- For "url", use the correct format based on your GitHub instance:
- GitHub.com: Use
https://github.comorhttps://api.github.com - GitHub Enterprise: Use
https://HOSTNAME/api/v3orhttps://HOSTNAME/api
- GitHub.com: Use
- Establishes and validates a connection to GitHub Enterprise
- Automatically detects if 2FA is required and provides appropriate guidance
- connect-github-enterprise-2fa: Connect to a GitHub Enterprise instance with 2FA
- Takes "name", "url", "username", "token", and "otp_code" as required string arguments
- Establishes and validates a connection to GitHub Enterprise with Two-Factor Authentication
- Validates OTP code format (typically 6-8 digits from an authenticator app)
- list-repositories: List repositories from the connected GitHub Enterprise instance
- Takes "connection" as a required string argument
- Returns a list of available repositories
- create-branch: Create a new branch in a repository
- Takes "repository", "base_branch", and "new_branch" as required string arguments
- Creates a new branch based on an existing branch
- commit-and-push: Commit file changes and push to a branch
- Takes "repository", "branch", "file_path", "content", and "commit_message" as required arguments
- Creates or updates files in a repository and commits changes
Configuration
GitHub Enterprise Setup
To use this MCP server with your GitHub Enterprise instance, you'll need:
-
GitHub Enterprise URL:
- For GitHub.com: Use
https://github.comorhttps://api.github.com - For GitHub Enterprise Server:
- Simply use the base URL (e.g.,
https://github.example.com) - The server will try to detect the correct API path format automatically
- Modern GitHub Enterprise:
/api(added by default if no path is specified) - Older GitHub Enterprise:
/api/v3(you can explicitly include this if needed) - If you're unsure, use the
test-api-connectiontool to determine the best format
- Simply use the base URL (e.g.,
- The URL should be accessible from the machine where the MCP server is running
- GitHub Enterprise API URLs can vary based on server version and configuration
- For GitHub.com: Use
-
Authentication:
-
For standard authentication (no 2FA):
- Create a Personal Access Token (PAT) from your GitHub Enterprise instance
- Required scopes:
repo(Full control of private repositories)read:org(Read organization information)user(Read user information)
- For fine-grained tokens, ensure repository access is enabled
-
For Two-Factor Authentication (2FA):
- You will need:
- Your GitHub Enterprise username
- Your Personal Access Token (PAT) with the required scopes
- A one-time password (OTP) from your authenticator app
- Note that OTP codes are typically valid for 30-60 seconds
- The server validates that the OTP code is in the correct format (6-8 digits)
- You will need:
-
-
Connection Name:
- A friendly name to identify your connection within the MCP server
- This will be used in subsequent commands
Claude or Other LLM Integration
To use this MCP server with AI assistants like Claude:
-
Configure your LLM client:
- For Claude Desktop, modify the configuration file as shown below in the Quickstart section
- This tells Claude how to find and communicate with your GitHub Enterprise MCP server
- The MCP server must be running on your machine when you use it with Claude
-
Authentication Flow:
- When using the MCP server with an LLM, you'll need to connect to your GitHub Enterprise instance first
- Use the
connect-github-enterprisetool to establish the connection - Your personal access token is only stored in memory and not persisted between sessions
- For security, restart the MCP server when you're done using it
-
Security Considerations:
- The LLM only interacts with your GitHub Enterprise through the MCP server
- Your credentials are never exposed to the LLM itself
- Consider using tokens with limited scope and expiration for enhanced security
- Never share your MCP server logs, as they might contain sensitive information
Quickstart
Install
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Development/Unpublished Servers Configuration
``` "mcpServers": { "github-enterprise-mcp": { "command": "uv", "args": [ "--directory", "/Users/annmariyajoshy/vibecoding/github-enterprise-mcp", "run", "github-enterprise-mcp" ] } } ```Published Servers Configuration
``` "mcpServers": { "github-enterprise-mcp": { "command": "uvx", "args": [ "github-enterprise-mcp" ] } } ```Development
Building and Publishing
To prepare the package for distribution:
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/ directory.
- Publish to PyPI:
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--password/UV_PUBLISH_PASSWORD
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm with this command:
npx @modelcontextprotocol/inspector uv --directory /Users/annmariyajoshy/vibecoding/github-enterprise-mcp run github-enterprise-mcp
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
Example Workflow
Here's how to use the GitHub Enterprise MCP server with an LLM assistant:
-
Start the MCP server by running:
uv --directory /path/to/github-enterprise-mcp run github-enterprise-mcp
-
Test your GitHub API connection (recommended before connecting): Use the
test-api-connectiontool with:url: Your GitHub or GitHub Enterprise URL (e.g., "https://github.com" or "https://github.example.com")
This tool will:
- Test multiple API endpoint formats automatically (base URL, /api, and /api/v3)
- Try various GitHub API endpoints like /zen, /rate_limit, and /meta
- Recommend the best URL format to use for your specific GitHub Enterprise instance
- Provide diagnostics if connection issues are found
- Help you troubleshoot network or configuration problems
-
Connect to GitHub Enterprise:
-
For standard authentication (no 2FA): Use the
connect-github-enterprisetool with:name: A name for your connection (e.g., "my-enterprise")url: Your GitHub Enterprise URL (e.g., "https://github.example.com")token: Your Personal Access Token
-
For Two-Factor Authentication (2FA): Use the
connect-github-enterprise-2fatool with:name: A name for your connection (e.g., "my-enterprise")url: Your GitHub Enterprise URL (e.g., "https://github.example.com")username: Your GitHub Enterprise usernametoken: Your Personal Access Tokenotp_code: Current one-time password from your authenticator app
Note: If you attempt to use standard authentication with an account that has 2FA enabled, the server will automatically detect this and suggest using the 2FA-specific connection tool.
-
-
List available repositories: Use the
list-repositoriestool with:connection: The name you provided in step 2
-
Create a branch: Use the
create-branchtool with:repository: The repository namebase_branch: The source branch (typically "main" or "master")new_branch: The name for your new branch
-
Make file changes: Use the
commit-and-pushtool with:repository: The repository namebranch: The branch to commit tofile_path: Path to the file in the repositorycontent: The new content for the filecommit_message: Your commit message
-
Generate a PR description: Use the
create-pr-descriptionprompt with:repository: The repository namebase_branch: The target branch for the PRhead_branch: Your feature branch with changes
This workflow enables AI-assisted repository management while keeping your code secure in your GitHub Enterprise instance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file github_enterprise_mcp-0.1.0.tar.gz.
File metadata
- Download URL: github_enterprise_mcp-0.1.0.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cad4cf321e959ef5eb70a4f97e9141d644b94afa28e63f8189f188468e3ac95
|
|
| MD5 |
5cbf936772a4ebbe7761f90105852754
|
|
| BLAKE2b-256 |
0596e882f211d097f973cb1b77ac4cc18056dc9e73ccf2e45c4a0ef12e9b0b53
|
File details
Details for the file github_enterprise_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: github_enterprise_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d2df34aa3ae07b69df6fde241d4e398711076a07c9bd087566128a231394752
|
|
| MD5 |
54201ce6fa8285e53355cfb39fb95b4a
|
|
| BLAKE2b-256 |
56b17046808d8cfaef1943acfd130f26d2442cd1599c94a963d9944d5bc441c7
|