github-mcp-connector 0.2.0__tar.gz → 0.3.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.
Files changed (19) hide show
  1. {github_mcp_connector-0.2.0/src/github_mcp_connector.egg-info → github_mcp_connector-0.3.0}/PKG-INFO +2 -1
  2. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/README.md +1 -0
  3. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/pyproject.toml +1 -1
  4. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp/client.py +4 -0
  5. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp/server.py +16 -0
  6. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0/src/github_mcp_connector.egg-info}/PKG-INFO +2 -1
  7. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/tests/test_server.py +32 -0
  8. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/LICENSE +0 -0
  9. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/setup.cfg +0 -0
  10. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp/__init__.py +0 -0
  11. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp/__main__.py +0 -0
  12. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp/config.py +0 -0
  13. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp_connector.egg-info/SOURCES.txt +0 -0
  14. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp_connector.egg-info/dependency_links.txt +0 -0
  15. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp_connector.egg-info/entry_points.txt +0 -0
  16. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp_connector.egg-info/requires.txt +0 -0
  17. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/src/github_mcp_connector.egg-info/top_level.txt +0 -0
  18. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/tests/test_client.py +0 -0
  19. {github_mcp_connector-0.2.0 → github_mcp_connector-0.3.0}/tests/test_config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github-mcp-connector
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A Model Context Protocol (MCP) connector for GitHub, for use with Claude.
5
5
  Author: winnerlose2026
6
6
  License: MIT
@@ -80,6 +80,7 @@ Enterprise Server.
80
80
  | `update_issue` | Edit/close/reopen an issue | ✅ |
81
81
  | `add_issue_comment` | Comment on an issue or PR | ✅ |
82
82
  | `create_branch` | Create a branch from a ref | ✅ |
83
+ | `delete_branch` | Delete a branch | ✅ |
83
84
  | `create_or_update_file` | Commit a file (create or update) | ✅ |
84
85
 
85
86
  Tools marked **Write** are disabled when `GITHUB_MCP_READ_ONLY` is set.
@@ -50,6 +50,7 @@ Enterprise Server.
50
50
  | `update_issue` | Edit/close/reopen an issue | ✅ |
51
51
  | `add_issue_comment` | Comment on an issue or PR | ✅ |
52
52
  | `create_branch` | Create a branch from a ref | ✅ |
53
+ | `delete_branch` | Delete a branch | ✅ |
53
54
  | `create_or_update_file` | Commit a file (create or update) | ✅ |
54
55
 
55
56
  Tools marked **Write** are disabled when `GITHUB_MCP_READ_ONLY` is set.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "github-mcp-connector"
7
- version = "0.2.0"
7
+ version = "0.3.0"
8
8
  description = "A Model Context Protocol (MCP) connector for GitHub, for use with Claude."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -136,6 +136,10 @@ class GitHubClient:
136
136
  return None
137
137
  return response.json()
138
138
 
139
+ async def delete(self, path: str) -> None:
140
+ # GitHub returns 204 No Content on a successful delete.
141
+ await self._request("DELETE", path)
142
+
139
143
 
140
144
  def _extract_error_detail(response: httpx.Response) -> str:
141
145
  """Pull the most useful human-readable error message out of a response."""
@@ -695,6 +695,22 @@ async def create_branch(
695
695
  }
696
696
 
697
697
 
698
+ @mcp.tool()
699
+ async def delete_branch(owner: str, repo: str, branch: str) -> dict[str, Any]:
700
+ """Delete a branch from a repository.
701
+
702
+ `branch` is the branch name (e.g. `feature-x`, not `refs/heads/feature-x`).
703
+ This permanently removes the ref; it cannot delete the repository's default
704
+ branch (GitHub rejects that). Disabled in read-only mode; requires a token
705
+ with write access.
706
+ """
707
+ _require_token()
708
+ _require_write()
709
+ async with GitHubClient(config) as gh:
710
+ await gh.delete(f"/repos/{owner}/{repo}/git/refs/heads/{branch}")
711
+ return {"deleted": True, "branch": branch}
712
+
713
+
698
714
  @mcp.tool()
699
715
  async def create_or_update_file(
700
716
  owner: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github-mcp-connector
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A Model Context Protocol (MCP) connector for GitHub, for use with Claude.
5
5
  Author: winnerlose2026
6
6
  License: MIT
@@ -80,6 +80,7 @@ Enterprise Server.
80
80
  | `update_issue` | Edit/close/reopen an issue | ✅ |
81
81
  | `add_issue_comment` | Comment on an issue or PR | ✅ |
82
82
  | `create_branch` | Create a branch from a ref | ✅ |
83
+ | `delete_branch` | Delete a branch | ✅ |
83
84
  | `create_or_update_file` | Commit a file (create or update) | ✅ |
84
85
 
85
86
  Tools marked **Write** are disabled when `GITHUB_MCP_READ_ONLY` is set.
@@ -379,3 +379,35 @@ async def test_create_or_update_file_creates_new_on_404(monkeypatch):
379
379
  result = await server.create_or_update_file("o", "r", "new.md", "x", "add")
380
380
  assert "sha" not in captured["body"] # no sha -> create
381
381
  assert result["created"] is True
382
+
383
+
384
+ async def test_delete_branch_blocked_in_read_only(monkeypatch):
385
+ install_mock(monkeypatch, lambda r: httpx.Response(204), read_only=True)
386
+ with pytest.raises(GitHubError) as exc:
387
+ await server.delete_branch("o", "r", "feature")
388
+ assert exc.value.status_code == 403
389
+
390
+
391
+ async def test_delete_branch_calls_correct_ref(monkeypatch):
392
+ captured = {}
393
+
394
+ def handler(request):
395
+ captured["method"] = request.method
396
+ captured["path"] = request.url.path
397
+ return httpx.Response(204)
398
+
399
+ install_mock(monkeypatch, handler)
400
+ result = await server.delete_branch("o", "r", "feature-x")
401
+ assert captured["method"] == "DELETE"
402
+ assert captured["path"] == "/repos/o/r/git/refs/heads/feature-x"
403
+ assert result == {"deleted": True, "branch": "feature-x"}
404
+
405
+
406
+ async def test_delete_branch_surfaces_api_error(monkeypatch):
407
+ def handler(request):
408
+ return httpx.Response(422, json={"message": "Reference does not exist"})
409
+
410
+ install_mock(monkeypatch, handler)
411
+ with pytest.raises(GitHubError) as exc:
412
+ await server.delete_branch("o", "r", "missing")
413
+ assert exc.value.status_code == 422