github-mcp-connector 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- github_mcp_connector-0.1.0/LICENSE +21 -0
- github_mcp_connector-0.1.0/PKG-INFO +316 -0
- github_mcp_connector-0.1.0/README.md +286 -0
- github_mcp_connector-0.1.0/pyproject.toml +53 -0
- github_mcp_connector-0.1.0/setup.cfg +4 -0
- github_mcp_connector-0.1.0/src/github_mcp/__init__.py +10 -0
- github_mcp_connector-0.1.0/src/github_mcp/__main__.py +6 -0
- github_mcp_connector-0.1.0/src/github_mcp/client.py +140 -0
- github_mcp_connector-0.1.0/src/github_mcp/config.py +62 -0
- github_mcp_connector-0.1.0/src/github_mcp/server.py +477 -0
- github_mcp_connector-0.1.0/src/github_mcp_connector.egg-info/PKG-INFO +316 -0
- github_mcp_connector-0.1.0/src/github_mcp_connector.egg-info/SOURCES.txt +17 -0
- github_mcp_connector-0.1.0/src/github_mcp_connector.egg-info/dependency_links.txt +1 -0
- github_mcp_connector-0.1.0/src/github_mcp_connector.egg-info/entry_points.txt +3 -0
- github_mcp_connector-0.1.0/src/github_mcp_connector.egg-info/requires.txt +6 -0
- github_mcp_connector-0.1.0/src/github_mcp_connector.egg-info/top_level.txt +1 -0
- github_mcp_connector-0.1.0/tests/test_client.py +81 -0
- github_mcp_connector-0.1.0/tests/test_config.py +50 -0
- github_mcp_connector-0.1.0/tests/test_server.py +165 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 winnerlose2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: github-mcp-connector
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Model Context Protocol (MCP) connector for GitHub, for use with Claude.
|
|
5
|
+
Author: winnerlose2026
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/winnerlose2026/Github-mcp
|
|
8
|
+
Project-URL: Repository, https://github.com/winnerlose2026/Github-mcp
|
|
9
|
+
Project-URL: Issues, https://github.com/winnerlose2026/Github-mcp/issues
|
|
10
|
+
Keywords: mcp,github,claude,model-context-protocol,connector
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: mcp>=1.2.0
|
|
25
|
+
Requires-Dist: httpx>=0.27
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# GitHub MCP Connector
|
|
32
|
+
|
|
33
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that
|
|
34
|
+
connects **Claude** to **GitHub**. It exposes a focused set of GitHub REST API
|
|
35
|
+
operations as MCP tools, so Claude (Desktop, Code, or any MCP client) can read
|
|
36
|
+
repositories, browse files and commit history, triage issues, review pull
|
|
37
|
+
requests, andβoptionallyβopen issues and post comments.
|
|
38
|
+
|
|
39
|
+
It's a small, dependency-light Python package (`mcp` + `httpx`) that you point
|
|
40
|
+
at a GitHub token. It supports both stdio (the default for Claude Desktop/Code)
|
|
41
|
+
and streamable HTTP transports, and works against github.com or GitHub
|
|
42
|
+
Enterprise Server.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- π **Search** repositories, issues/PRs, and code with GitHub's query syntax
|
|
47
|
+
- π¦ **Repositories** β metadata, branches, file contents, directory listings
|
|
48
|
+
- π§Ύ **Commits** β recent history, optionally filtered to a branch or file path
|
|
49
|
+
- π **Issues** β list, read, and (optionally) create issues and comments
|
|
50
|
+
- π **Pull requests** β list, read, and fetch unified diffs
|
|
51
|
+
- π **Read-only mode** β flip one env var to disable every write tool
|
|
52
|
+
- π’ **Enterprise-friendly** β set `GITHUB_API_URL` for GitHub Enterprise Server
|
|
53
|
+
|
|
54
|
+
## Tools
|
|
55
|
+
|
|
56
|
+
| Tool | Description | Write |
|
|
57
|
+
|------|-------------|:-----:|
|
|
58
|
+
| `get_authenticated_user` | Identity/health check for the configured token | |
|
|
59
|
+
| `search_repositories` | Search repositories by query | |
|
|
60
|
+
| `get_repository` | Repository metadata | |
|
|
61
|
+
| `list_branches` | Branches with head commit SHAs | |
|
|
62
|
+
| `get_file_contents` | Read a file (decoded) or list a directory | |
|
|
63
|
+
| `list_commits` | Recent commits, optional branch/path filter | |
|
|
64
|
+
| `list_issues` | Issues by state/labels | |
|
|
65
|
+
| `get_issue` | A single issue with full body | |
|
|
66
|
+
| `list_pull_requests` | Pull requests by state | |
|
|
67
|
+
| `get_pull_request` | A single PR with body and merge status | |
|
|
68
|
+
| `get_pull_request_diff` | Unified diff for a PR (truncated) | |
|
|
69
|
+
| `search_issues` | Search issues and PRs across GitHub | |
|
|
70
|
+
| `search_code` | Search code across GitHub | |
|
|
71
|
+
| `create_issue` | Open a new issue | β
|
|
|
72
|
+
| `add_issue_comment` | Comment on an issue or PR | β
|
|
|
73
|
+
|
|
74
|
+
Tools marked **Write** are disabled when `GITHUB_MCP_READ_ONLY` is set.
|
|
75
|
+
|
|
76
|
+
## Requirements
|
|
77
|
+
|
|
78
|
+
- Python 3.10+
|
|
79
|
+
- A GitHub personal access token. The connector applies **no repository
|
|
80
|
+
restrictions of its own** β it can reach exactly the repositories your token
|
|
81
|
+
can, so token scope is what controls access:
|
|
82
|
+
- **All your repositories (recommended for general use):** create a *classic*
|
|
83
|
+
PAT with the `repo` scope, or a *fine-grained* PAT whose "Repository access"
|
|
84
|
+
is set to **All repositories**. This lets the connector see every repo your
|
|
85
|
+
account can access (public and private).
|
|
86
|
+
- **Only specific repositories:** use a fine-grained PAT and select just those
|
|
87
|
+
repos under "Repository access".
|
|
88
|
+
- **Permissions:** read access is enough for the read tools; to use the write
|
|
89
|
+
tools (`create_issue`, `add_issue_comment`) the token also needs issue
|
|
90
|
+
write access (classic: `repo`; fine-grained: *Issues β Read and write*).
|
|
91
|
+
|
|
92
|
+
## Install from PyPI (recommended)
|
|
93
|
+
|
|
94
|
+
The connector is published to PyPI as
|
|
95
|
+
[`github-mcp-connector`](https://pypi.org/project/github-mcp-connector/), so you
|
|
96
|
+
can install or run it by name β no clone, no git, no build step. This is the
|
|
97
|
+
most reliable option on Windows, where launching from a git URL requires Git on
|
|
98
|
+
the spawned process's `PATH`.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
uvx github-mcp-connector # run on demand with uv (nothing to install)
|
|
102
|
+
pipx run github-mcp-connector # same, with pipx
|
|
103
|
+
pip install github-mcp-connector # or install it permanently
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Wire it into Claude by pointing the command at the published package:
|
|
107
|
+
|
|
108
|
+
**Claude Code:**
|
|
109
|
+
```bash
|
|
110
|
+
claude mcp add-json github '{
|
|
111
|
+
"command": "uvx",
|
|
112
|
+
"args": ["github-mcp-connector"],
|
|
113
|
+
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
|
|
114
|
+
}'
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcpServers": {
|
|
121
|
+
"github": {
|
|
122
|
+
"command": "uvx",
|
|
123
|
+
"args": ["github-mcp-connector"],
|
|
124
|
+
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
On Windows, use the full path to `uvx.exe` (run `where.exe uvx` to find it), e.g.
|
|
131
|
+
`C:\\Users\\you\\.local\\bin\\uvx.exe`.
|
|
132
|
+
|
|
133
|
+
## Quick start (no clone, no venv)
|
|
134
|
+
|
|
135
|
+
If the package isn't published yet (or you want to track an unreleased commit),
|
|
136
|
+
`uvx` can also fetch, build, and run the connector straight from GitHub. This
|
|
137
|
+
path requires Git to be available to the process that launches it.
|
|
138
|
+
|
|
139
|
+
**Claude Code β one command:**
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
claude mcp add-json github '{
|
|
143
|
+
"command": "uvx",
|
|
144
|
+
"args": ["--from", "git+https://github.com/winnerlose2026/Github-mcp.git", "github-mcp"],
|
|
145
|
+
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
|
|
146
|
+
}'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Add `--scope user` to make it available in every project. Verify with
|
|
150
|
+
`claude mcp list` (should show `github` connected).
|
|
151
|
+
|
|
152
|
+
**Claude Code β project-scoped, shareable:** this repo ships a [`.mcp.json`](.mcp.json)
|
|
153
|
+
that reads `GITHUB_TOKEN` from your environment. Drop the same file in any project
|
|
154
|
+
(or copy it from here), export your token, and Claude Code auto-detects it:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
export GITHUB_TOKEN=github_pat_your_token_here
|
|
158
|
+
claude # prompts once to approve the project MCP server
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Claude Desktop:** point the `command` at `uvx` so there's no interpreter path to
|
|
162
|
+
manage:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"github": {
|
|
168
|
+
"command": "uvx",
|
|
169
|
+
"args": ["--from", "git+https://github.com/winnerlose2026/Github-mcp.git", "github-mcp"],
|
|
170
|
+
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Prefer pipx?** `pipx run --spec git+https://github.com/winnerlose2026/Github-mcp.git github-mcp`
|
|
177
|
+
works the same way; use that as the `command`/`args` instead.
|
|
178
|
+
|
|
179
|
+
## Installation (from source)
|
|
180
|
+
|
|
181
|
+
For development, or if you don't use `uv`/`pipx`:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git clone https://github.com/winnerlose2026/Github-mcp.git
|
|
185
|
+
cd Github-mcp
|
|
186
|
+
python -m venv .venv && source .venv/bin/activate
|
|
187
|
+
pip install -e .
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Or, without installing, from the repo root:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pip install -r requirements.txt
|
|
194
|
+
python -m github_mcp
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Configuration
|
|
198
|
+
|
|
199
|
+
All configuration comes from environment variables (see [`.env.example`](.env.example)):
|
|
200
|
+
|
|
201
|
+
| Variable | Required | Default | Description |
|
|
202
|
+
|----------|:--------:|---------|-------------|
|
|
203
|
+
| `GITHUB_TOKEN` | yes | β | GitHub token. `GITHUB_PERSONAL_ACCESS_TOKEN` and `GH_TOKEN` are also accepted. |
|
|
204
|
+
| `GITHUB_API_URL` | no | `https://api.github.com` | API root; set for GitHub Enterprise Server (e.g. `https://ghe.example.com/api/v3`). |
|
|
205
|
+
| `GITHUB_MCP_READ_ONLY` | no | `false` | When truthy, disables all write tools. |
|
|
206
|
+
| `GITHUB_MCP_TIMEOUT` | no | `30` | Per-request timeout in seconds. |
|
|
207
|
+
| `GITHUB_MCP_USER_AGENT` | no | `github-mcp-connector` | `User-Agent` header sent to GitHub. |
|
|
208
|
+
|
|
209
|
+
## Connecting to Claude (from-source install)
|
|
210
|
+
|
|
211
|
+
If you installed from source (above) instead of using `uvx`/`pipx`, configure
|
|
212
|
+
the client to run the package directly.
|
|
213
|
+
|
|
214
|
+
### Claude Desktop
|
|
215
|
+
|
|
216
|
+
Add the server to `claude_desktop_config.json` (Settings β Developer β Edit
|
|
217
|
+
Config):
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"mcpServers": {
|
|
222
|
+
"github": {
|
|
223
|
+
"command": "python",
|
|
224
|
+
"args": ["-m", "github_mcp"],
|
|
225
|
+
"env": {
|
|
226
|
+
"GITHUB_TOKEN": "ghp_your_token_here"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Use the absolute path to the Python interpreter from the virtualenv where you
|
|
234
|
+
installed the package (e.g. `/path/to/Github-mcp/.venv/bin/python`), or the
|
|
235
|
+
`github-mcp` console script directly. Restart Claude Desktop after editing.
|
|
236
|
+
|
|
237
|
+
### Claude Code
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
claude mcp add github \
|
|
241
|
+
--env GITHUB_TOKEN=ghp_your_token_here \
|
|
242
|
+
-- python -m github_mcp
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Streamable HTTP
|
|
246
|
+
|
|
247
|
+
To run as a standalone HTTP server instead of stdio:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
GITHUB_TOKEN=ghp_your_token_here python -m github_mcp --http
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Example prompts
|
|
254
|
+
|
|
255
|
+
Once connected, you can ask Claude things like:
|
|
256
|
+
|
|
257
|
+
- "What's the open PR backlog on `owner/repo`?"
|
|
258
|
+
- "Read `README.md` from the default branch of `owner/repo` and summarize it."
|
|
259
|
+
- "Show me the diff for PR #42 and summarize the risky parts."
|
|
260
|
+
- "Open an issue titled 'Flaky test in CI' with these reproduction stepsβ¦"
|
|
261
|
+
|
|
262
|
+
## Development
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
pip install -e ".[dev]"
|
|
266
|
+
pytest
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The test suite mocks the GitHub API with `httpx.MockTransport`, so it runs
|
|
270
|
+
fully offline and makes no network calls.
|
|
271
|
+
|
|
272
|
+
## Releasing (maintainers)
|
|
273
|
+
|
|
274
|
+
Publishing is automated via GitHub Actions
|
|
275
|
+
([`.github/workflows/publish.yml`](.github/workflows/publish.yml)) using PyPI
|
|
276
|
+
**Trusted Publishing** (OIDC) β no API tokens are stored anywhere.
|
|
277
|
+
|
|
278
|
+
**One-time PyPI setup** (before the first release):
|
|
279
|
+
|
|
280
|
+
1. Sign in at [pypi.org](https://pypi.org) and go to **Your projects β Publishing**
|
|
281
|
+
(or **Account β Publishing** for a project that doesn't exist yet).
|
|
282
|
+
2. Add a **pending publisher** with:
|
|
283
|
+
- PyPI Project Name: `github-mcp-connector`
|
|
284
|
+
- Owner: `winnerlose2026`
|
|
285
|
+
- Repository: `Github-mcp`
|
|
286
|
+
- Workflow name: `publish.yml`
|
|
287
|
+
- Environment name: `pypi`
|
|
288
|
+
3. (Recommended) In the GitHub repo, create an **Environment** named `pypi`
|
|
289
|
+
(Settings β Environments) so the publish job is gated.
|
|
290
|
+
|
|
291
|
+
**Cutting a release:**
|
|
292
|
+
|
|
293
|
+
1. Bump `version` in `pyproject.toml`, commit, and merge to `main`.
|
|
294
|
+
2. Tag and publish a GitHub Release (e.g. `v0.1.0`). Publishing the release
|
|
295
|
+
triggers the workflow, which builds the sdist + wheel, runs `twine check`,
|
|
296
|
+
and uploads to PyPI.
|
|
297
|
+
3. Confirm it's live: `uvx github-mcp-connector@latest --help`.
|
|
298
|
+
|
|
299
|
+
Until the first release is published, install via the
|
|
300
|
+
[git-based quick start](#quick-start-no-clone-no-venv) instead.
|
|
301
|
+
|
|
302
|
+
## Security notes
|
|
303
|
+
|
|
304
|
+
- The connector only has the access your token grants. A broad token (`repo`
|
|
305
|
+
scope / all repositories) gives Claude reach across every repo your account
|
|
306
|
+
can touch β convenient, but treat the token like the credential it is. Prefer
|
|
307
|
+
a fine-grained, repo-limited token if you only need a few repositories.
|
|
308
|
+
- Run with `GITHUB_MCP_READ_ONLY=true` when you only need read access; this is
|
|
309
|
+
enforced server-side, before any write request is sent to GitHub. This pairs
|
|
310
|
+
well with a broad-access token: full visibility, no write risk.
|
|
311
|
+
- Never commit your token. `.env` is git-ignored; `.env.example` is the
|
|
312
|
+
template to copy.
|
|
313
|
+
|
|
314
|
+
## License
|
|
315
|
+
|
|
316
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# GitHub MCP Connector
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that
|
|
4
|
+
connects **Claude** to **GitHub**. It exposes a focused set of GitHub REST API
|
|
5
|
+
operations as MCP tools, so Claude (Desktop, Code, or any MCP client) can read
|
|
6
|
+
repositories, browse files and commit history, triage issues, review pull
|
|
7
|
+
requests, andβoptionallyβopen issues and post comments.
|
|
8
|
+
|
|
9
|
+
It's a small, dependency-light Python package (`mcp` + `httpx`) that you point
|
|
10
|
+
at a GitHub token. It supports both stdio (the default for Claude Desktop/Code)
|
|
11
|
+
and streamable HTTP transports, and works against github.com or GitHub
|
|
12
|
+
Enterprise Server.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- π **Search** repositories, issues/PRs, and code with GitHub's query syntax
|
|
17
|
+
- π¦ **Repositories** β metadata, branches, file contents, directory listings
|
|
18
|
+
- π§Ύ **Commits** β recent history, optionally filtered to a branch or file path
|
|
19
|
+
- π **Issues** β list, read, and (optionally) create issues and comments
|
|
20
|
+
- π **Pull requests** β list, read, and fetch unified diffs
|
|
21
|
+
- π **Read-only mode** β flip one env var to disable every write tool
|
|
22
|
+
- π’ **Enterprise-friendly** β set `GITHUB_API_URL` for GitHub Enterprise Server
|
|
23
|
+
|
|
24
|
+
## Tools
|
|
25
|
+
|
|
26
|
+
| Tool | Description | Write |
|
|
27
|
+
|------|-------------|:-----:|
|
|
28
|
+
| `get_authenticated_user` | Identity/health check for the configured token | |
|
|
29
|
+
| `search_repositories` | Search repositories by query | |
|
|
30
|
+
| `get_repository` | Repository metadata | |
|
|
31
|
+
| `list_branches` | Branches with head commit SHAs | |
|
|
32
|
+
| `get_file_contents` | Read a file (decoded) or list a directory | |
|
|
33
|
+
| `list_commits` | Recent commits, optional branch/path filter | |
|
|
34
|
+
| `list_issues` | Issues by state/labels | |
|
|
35
|
+
| `get_issue` | A single issue with full body | |
|
|
36
|
+
| `list_pull_requests` | Pull requests by state | |
|
|
37
|
+
| `get_pull_request` | A single PR with body and merge status | |
|
|
38
|
+
| `get_pull_request_diff` | Unified diff for a PR (truncated) | |
|
|
39
|
+
| `search_issues` | Search issues and PRs across GitHub | |
|
|
40
|
+
| `search_code` | Search code across GitHub | |
|
|
41
|
+
| `create_issue` | Open a new issue | β
|
|
|
42
|
+
| `add_issue_comment` | Comment on an issue or PR | β
|
|
|
43
|
+
|
|
44
|
+
Tools marked **Write** are disabled when `GITHUB_MCP_READ_ONLY` is set.
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
|
|
48
|
+
- Python 3.10+
|
|
49
|
+
- A GitHub personal access token. The connector applies **no repository
|
|
50
|
+
restrictions of its own** β it can reach exactly the repositories your token
|
|
51
|
+
can, so token scope is what controls access:
|
|
52
|
+
- **All your repositories (recommended for general use):** create a *classic*
|
|
53
|
+
PAT with the `repo` scope, or a *fine-grained* PAT whose "Repository access"
|
|
54
|
+
is set to **All repositories**. This lets the connector see every repo your
|
|
55
|
+
account can access (public and private).
|
|
56
|
+
- **Only specific repositories:** use a fine-grained PAT and select just those
|
|
57
|
+
repos under "Repository access".
|
|
58
|
+
- **Permissions:** read access is enough for the read tools; to use the write
|
|
59
|
+
tools (`create_issue`, `add_issue_comment`) the token also needs issue
|
|
60
|
+
write access (classic: `repo`; fine-grained: *Issues β Read and write*).
|
|
61
|
+
|
|
62
|
+
## Install from PyPI (recommended)
|
|
63
|
+
|
|
64
|
+
The connector is published to PyPI as
|
|
65
|
+
[`github-mcp-connector`](https://pypi.org/project/github-mcp-connector/), so you
|
|
66
|
+
can install or run it by name β no clone, no git, no build step. This is the
|
|
67
|
+
most reliable option on Windows, where launching from a git URL requires Git on
|
|
68
|
+
the spawned process's `PATH`.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
uvx github-mcp-connector # run on demand with uv (nothing to install)
|
|
72
|
+
pipx run github-mcp-connector # same, with pipx
|
|
73
|
+
pip install github-mcp-connector # or install it permanently
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Wire it into Claude by pointing the command at the published package:
|
|
77
|
+
|
|
78
|
+
**Claude Code:**
|
|
79
|
+
```bash
|
|
80
|
+
claude mcp add-json github '{
|
|
81
|
+
"command": "uvx",
|
|
82
|
+
"args": ["github-mcp-connector"],
|
|
83
|
+
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
|
|
84
|
+
}'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"github": {
|
|
92
|
+
"command": "uvx",
|
|
93
|
+
"args": ["github-mcp-connector"],
|
|
94
|
+
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
On Windows, use the full path to `uvx.exe` (run `where.exe uvx` to find it), e.g.
|
|
101
|
+
`C:\\Users\\you\\.local\\bin\\uvx.exe`.
|
|
102
|
+
|
|
103
|
+
## Quick start (no clone, no venv)
|
|
104
|
+
|
|
105
|
+
If the package isn't published yet (or you want to track an unreleased commit),
|
|
106
|
+
`uvx` can also fetch, build, and run the connector straight from GitHub. This
|
|
107
|
+
path requires Git to be available to the process that launches it.
|
|
108
|
+
|
|
109
|
+
**Claude Code β one command:**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
claude mcp add-json github '{
|
|
113
|
+
"command": "uvx",
|
|
114
|
+
"args": ["--from", "git+https://github.com/winnerlose2026/Github-mcp.git", "github-mcp"],
|
|
115
|
+
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
|
|
116
|
+
}'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Add `--scope user` to make it available in every project. Verify with
|
|
120
|
+
`claude mcp list` (should show `github` connected).
|
|
121
|
+
|
|
122
|
+
**Claude Code β project-scoped, shareable:** this repo ships a [`.mcp.json`](.mcp.json)
|
|
123
|
+
that reads `GITHUB_TOKEN` from your environment. Drop the same file in any project
|
|
124
|
+
(or copy it from here), export your token, and Claude Code auto-detects it:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
export GITHUB_TOKEN=github_pat_your_token_here
|
|
128
|
+
claude # prompts once to approve the project MCP server
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Claude Desktop:** point the `command` at `uvx` so there's no interpreter path to
|
|
132
|
+
manage:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"github": {
|
|
138
|
+
"command": "uvx",
|
|
139
|
+
"args": ["--from", "git+https://github.com/winnerlose2026/Github-mcp.git", "github-mcp"],
|
|
140
|
+
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Prefer pipx?** `pipx run --spec git+https://github.com/winnerlose2026/Github-mcp.git github-mcp`
|
|
147
|
+
works the same way; use that as the `command`/`args` instead.
|
|
148
|
+
|
|
149
|
+
## Installation (from source)
|
|
150
|
+
|
|
151
|
+
For development, or if you don't use `uv`/`pipx`:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
git clone https://github.com/winnerlose2026/Github-mcp.git
|
|
155
|
+
cd Github-mcp
|
|
156
|
+
python -m venv .venv && source .venv/bin/activate
|
|
157
|
+
pip install -e .
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Or, without installing, from the repo root:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pip install -r requirements.txt
|
|
164
|
+
python -m github_mcp
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Configuration
|
|
168
|
+
|
|
169
|
+
All configuration comes from environment variables (see [`.env.example`](.env.example)):
|
|
170
|
+
|
|
171
|
+
| Variable | Required | Default | Description |
|
|
172
|
+
|----------|:--------:|---------|-------------|
|
|
173
|
+
| `GITHUB_TOKEN` | yes | β | GitHub token. `GITHUB_PERSONAL_ACCESS_TOKEN` and `GH_TOKEN` are also accepted. |
|
|
174
|
+
| `GITHUB_API_URL` | no | `https://api.github.com` | API root; set for GitHub Enterprise Server (e.g. `https://ghe.example.com/api/v3`). |
|
|
175
|
+
| `GITHUB_MCP_READ_ONLY` | no | `false` | When truthy, disables all write tools. |
|
|
176
|
+
| `GITHUB_MCP_TIMEOUT` | no | `30` | Per-request timeout in seconds. |
|
|
177
|
+
| `GITHUB_MCP_USER_AGENT` | no | `github-mcp-connector` | `User-Agent` header sent to GitHub. |
|
|
178
|
+
|
|
179
|
+
## Connecting to Claude (from-source install)
|
|
180
|
+
|
|
181
|
+
If you installed from source (above) instead of using `uvx`/`pipx`, configure
|
|
182
|
+
the client to run the package directly.
|
|
183
|
+
|
|
184
|
+
### Claude Desktop
|
|
185
|
+
|
|
186
|
+
Add the server to `claude_desktop_config.json` (Settings β Developer β Edit
|
|
187
|
+
Config):
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"mcpServers": {
|
|
192
|
+
"github": {
|
|
193
|
+
"command": "python",
|
|
194
|
+
"args": ["-m", "github_mcp"],
|
|
195
|
+
"env": {
|
|
196
|
+
"GITHUB_TOKEN": "ghp_your_token_here"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Use the absolute path to the Python interpreter from the virtualenv where you
|
|
204
|
+
installed the package (e.g. `/path/to/Github-mcp/.venv/bin/python`), or the
|
|
205
|
+
`github-mcp` console script directly. Restart Claude Desktop after editing.
|
|
206
|
+
|
|
207
|
+
### Claude Code
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
claude mcp add github \
|
|
211
|
+
--env GITHUB_TOKEN=ghp_your_token_here \
|
|
212
|
+
-- python -m github_mcp
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Streamable HTTP
|
|
216
|
+
|
|
217
|
+
To run as a standalone HTTP server instead of stdio:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
GITHUB_TOKEN=ghp_your_token_here python -m github_mcp --http
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Example prompts
|
|
224
|
+
|
|
225
|
+
Once connected, you can ask Claude things like:
|
|
226
|
+
|
|
227
|
+
- "What's the open PR backlog on `owner/repo`?"
|
|
228
|
+
- "Read `README.md` from the default branch of `owner/repo` and summarize it."
|
|
229
|
+
- "Show me the diff for PR #42 and summarize the risky parts."
|
|
230
|
+
- "Open an issue titled 'Flaky test in CI' with these reproduction stepsβ¦"
|
|
231
|
+
|
|
232
|
+
## Development
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
pip install -e ".[dev]"
|
|
236
|
+
pytest
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The test suite mocks the GitHub API with `httpx.MockTransport`, so it runs
|
|
240
|
+
fully offline and makes no network calls.
|
|
241
|
+
|
|
242
|
+
## Releasing (maintainers)
|
|
243
|
+
|
|
244
|
+
Publishing is automated via GitHub Actions
|
|
245
|
+
([`.github/workflows/publish.yml`](.github/workflows/publish.yml)) using PyPI
|
|
246
|
+
**Trusted Publishing** (OIDC) β no API tokens are stored anywhere.
|
|
247
|
+
|
|
248
|
+
**One-time PyPI setup** (before the first release):
|
|
249
|
+
|
|
250
|
+
1. Sign in at [pypi.org](https://pypi.org) and go to **Your projects β Publishing**
|
|
251
|
+
(or **Account β Publishing** for a project that doesn't exist yet).
|
|
252
|
+
2. Add a **pending publisher** with:
|
|
253
|
+
- PyPI Project Name: `github-mcp-connector`
|
|
254
|
+
- Owner: `winnerlose2026`
|
|
255
|
+
- Repository: `Github-mcp`
|
|
256
|
+
- Workflow name: `publish.yml`
|
|
257
|
+
- Environment name: `pypi`
|
|
258
|
+
3. (Recommended) In the GitHub repo, create an **Environment** named `pypi`
|
|
259
|
+
(Settings β Environments) so the publish job is gated.
|
|
260
|
+
|
|
261
|
+
**Cutting a release:**
|
|
262
|
+
|
|
263
|
+
1. Bump `version` in `pyproject.toml`, commit, and merge to `main`.
|
|
264
|
+
2. Tag and publish a GitHub Release (e.g. `v0.1.0`). Publishing the release
|
|
265
|
+
triggers the workflow, which builds the sdist + wheel, runs `twine check`,
|
|
266
|
+
and uploads to PyPI.
|
|
267
|
+
3. Confirm it's live: `uvx github-mcp-connector@latest --help`.
|
|
268
|
+
|
|
269
|
+
Until the first release is published, install via the
|
|
270
|
+
[git-based quick start](#quick-start-no-clone-no-venv) instead.
|
|
271
|
+
|
|
272
|
+
## Security notes
|
|
273
|
+
|
|
274
|
+
- The connector only has the access your token grants. A broad token (`repo`
|
|
275
|
+
scope / all repositories) gives Claude reach across every repo your account
|
|
276
|
+
can touch β convenient, but treat the token like the credential it is. Prefer
|
|
277
|
+
a fine-grained, repo-limited token if you only need a few repositories.
|
|
278
|
+
- Run with `GITHUB_MCP_READ_ONLY=true` when you only need read access; this is
|
|
279
|
+
enforced server-side, before any write request is sent to GitHub. This pairs
|
|
280
|
+
well with a broad-access token: full visibility, no write risk.
|
|
281
|
+
- Never commit your token. `.env` is git-ignored; `.env.example` is the
|
|
282
|
+
template to copy.
|
|
283
|
+
|
|
284
|
+
## License
|
|
285
|
+
|
|
286
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "github-mcp-connector"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A Model Context Protocol (MCP) connector for GitHub, for use with Claude."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "winnerlose2026" }]
|
|
13
|
+
keywords = ["mcp", "github", "claude", "model-context-protocol", "connector"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Topic :: Software Development :: Libraries",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"mcp>=1.2.0",
|
|
28
|
+
"httpx>=0.27",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/winnerlose2026/Github-mcp"
|
|
33
|
+
Repository = "https://github.com/winnerlose2026/Github-mcp"
|
|
34
|
+
Issues = "https://github.com/winnerlose2026/Github-mcp/issues"
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
dev = [
|
|
38
|
+
"pytest>=8.0",
|
|
39
|
+
"pytest-asyncio>=0.23",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
github-mcp = "github_mcp.server:main"
|
|
44
|
+
# Alias matching the PyPI distribution name so `uvx github-mcp-connector` works
|
|
45
|
+
# without a `--from` flag.
|
|
46
|
+
github-mcp-connector = "github_mcp.server:main"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
asyncio_mode = "auto"
|
|
53
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""A Model Context Protocol (MCP) connector for GitHub.
|
|
2
|
+
|
|
3
|
+
Exposes a focused set of GitHub REST API operations as MCP tools so that
|
|
4
|
+
Claude (Desktop, Code, or any MCP client) can read repositories, issues,
|
|
5
|
+
pull requests, commits, and code, and optionally open issues and comments.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
9
|
+
|
|
10
|
+
__all__ = ["__version__"]
|