fastmcp-tools-github 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.
- fastmcp_tools_github-0.1.0/PKG-INFO +7 -0
- fastmcp_tools_github-0.1.0/pyproject.toml +22 -0
- fastmcp_tools_github-0.1.0/setup.cfg +4 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github/__init__.py +5 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github/create_pr.py +43 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github/get_file.py +41 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github/list_issues.py +49 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github.egg-info/PKG-INFO +7 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github.egg-info/SOURCES.txt +11 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github.egg-info/dependency_links.txt +1 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github.egg-info/entry_points.txt +2 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github.egg-info/requires.txt +1 -0
- fastmcp_tools_github-0.1.0/src/fastmcp_tools_github.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "fastmcp-tools-github"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "GitHub tools for fastmcp-server"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
dependencies = ["requests>=2.31"]
|
|
12
|
+
|
|
13
|
+
[project.entry-points."fastmcp_tools"]
|
|
14
|
+
github = "fastmcp_tools_github"
|
|
15
|
+
|
|
16
|
+
[tool.setuptools.packages.find]
|
|
17
|
+
where = ["src"]
|
|
18
|
+
include = ["fastmcp_tools_github*"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
[tool.setuptools.package-data]
|
|
22
|
+
"fastmcp_tools_github" = ["*.py"]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Create a GitHub pull request.
|
|
2
|
+
|
|
3
|
+
Requires: requests
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
__tags__ = ["github", "write"]
|
|
7
|
+
__timeout__ = 30.0
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def create_pr(
|
|
11
|
+
owner: str,
|
|
12
|
+
repo: str,
|
|
13
|
+
title: str,
|
|
14
|
+
head: str,
|
|
15
|
+
base: str = "main",
|
|
16
|
+
body: str = "",
|
|
17
|
+
) -> str:
|
|
18
|
+
"""Create a pull request on a GitHub repository."""
|
|
19
|
+
import os
|
|
20
|
+
|
|
21
|
+
import requests
|
|
22
|
+
|
|
23
|
+
token = os.environ.get("GITHUB_TOKEN", "")
|
|
24
|
+
if not token:
|
|
25
|
+
return "Error: GITHUB_TOKEN environment variable required"
|
|
26
|
+
|
|
27
|
+
headers = {
|
|
28
|
+
"Accept": "application/vnd.github+json",
|
|
29
|
+
"Authorization": f"Bearer {token}",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
data = {"title": title, "head": head, "base": base, "body": body}
|
|
33
|
+
|
|
34
|
+
resp = requests.post(
|
|
35
|
+
f"https://api.github.com/repos/{owner}/{repo}/pulls",
|
|
36
|
+
headers=headers,
|
|
37
|
+
json=data,
|
|
38
|
+
timeout=15,
|
|
39
|
+
)
|
|
40
|
+
resp.raise_for_status()
|
|
41
|
+
|
|
42
|
+
pr = resp.json()
|
|
43
|
+
return f"PR #{pr['number']} created: {pr['html_url']}"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Get file contents from a GitHub repository.
|
|
2
|
+
|
|
3
|
+
Requires: requests
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
__tags__ = ["github", "read"]
|
|
7
|
+
__timeout__ = 30.0
|
|
8
|
+
__cache_ttl__ = 120
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_file(
|
|
12
|
+
owner: str,
|
|
13
|
+
repo: str,
|
|
14
|
+
path: str,
|
|
15
|
+
ref: str = "main",
|
|
16
|
+
) -> str:
|
|
17
|
+
"""Get file contents from a GitHub repository."""
|
|
18
|
+
import base64
|
|
19
|
+
import os
|
|
20
|
+
|
|
21
|
+
import requests
|
|
22
|
+
|
|
23
|
+
token = os.environ.get("GITHUB_TOKEN", "")
|
|
24
|
+
headers = {"Accept": "application/vnd.github+json"}
|
|
25
|
+
if token:
|
|
26
|
+
headers["Authorization"] = f"Bearer {token}"
|
|
27
|
+
|
|
28
|
+
resp = requests.get(
|
|
29
|
+
f"https://api.github.com/repos/{owner}/{repo}/contents/{path}",
|
|
30
|
+
headers=headers,
|
|
31
|
+
params={"ref": ref},
|
|
32
|
+
timeout=15,
|
|
33
|
+
)
|
|
34
|
+
resp.raise_for_status()
|
|
35
|
+
|
|
36
|
+
data = resp.json()
|
|
37
|
+
if data.get("type") != "file":
|
|
38
|
+
return f"Error: {path} is a {data.get('type', 'unknown')}, not a file"
|
|
39
|
+
|
|
40
|
+
content = base64.b64decode(data["content"]).decode("utf-8", errors="replace")
|
|
41
|
+
return content
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""List GitHub issues for a repository.
|
|
2
|
+
|
|
3
|
+
Requires: requests
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
__tags__ = ["github", "read"]
|
|
7
|
+
__timeout__ = 30.0
|
|
8
|
+
__cache_ttl__ = 60
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def list_issues(
|
|
12
|
+
owner: str,
|
|
13
|
+
repo: str,
|
|
14
|
+
state: str = "open",
|
|
15
|
+
labels: str = "",
|
|
16
|
+
limit: int = 20,
|
|
17
|
+
) -> str:
|
|
18
|
+
"""List issues from a GitHub repository."""
|
|
19
|
+
import os
|
|
20
|
+
|
|
21
|
+
import requests
|
|
22
|
+
|
|
23
|
+
token = os.environ.get("GITHUB_TOKEN", "")
|
|
24
|
+
headers = {"Accept": "application/vnd.github+json"}
|
|
25
|
+
if token:
|
|
26
|
+
headers["Authorization"] = f"Bearer {token}"
|
|
27
|
+
|
|
28
|
+
params = {"state": state, "per_page": min(limit, 100)}
|
|
29
|
+
if labels:
|
|
30
|
+
params["labels"] = labels
|
|
31
|
+
|
|
32
|
+
resp = requests.get(
|
|
33
|
+
f"https://api.github.com/repos/{owner}/{repo}/issues",
|
|
34
|
+
headers=headers,
|
|
35
|
+
params=params,
|
|
36
|
+
timeout=15,
|
|
37
|
+
)
|
|
38
|
+
resp.raise_for_status()
|
|
39
|
+
|
|
40
|
+
issues = resp.json()
|
|
41
|
+
lines = [f"Issues for {owner}/{repo} ({state}):"]
|
|
42
|
+
for issue in issues[:limit]:
|
|
43
|
+
labels_str = ", ".join(lbl["name"] for lbl in issue.get("labels", []))
|
|
44
|
+
lines.append(f" #{issue['number']} {issue['title']} [{labels_str}]")
|
|
45
|
+
|
|
46
|
+
if len(lines) == 1:
|
|
47
|
+
lines.append(" (no issues found)")
|
|
48
|
+
|
|
49
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
src/fastmcp_tools_github/__init__.py
|
|
3
|
+
src/fastmcp_tools_github/create_pr.py
|
|
4
|
+
src/fastmcp_tools_github/get_file.py
|
|
5
|
+
src/fastmcp_tools_github/list_issues.py
|
|
6
|
+
src/fastmcp_tools_github.egg-info/PKG-INFO
|
|
7
|
+
src/fastmcp_tools_github.egg-info/SOURCES.txt
|
|
8
|
+
src/fastmcp_tools_github.egg-info/dependency_links.txt
|
|
9
|
+
src/fastmcp_tools_github.egg-info/entry_points.txt
|
|
10
|
+
src/fastmcp_tools_github.egg-info/requires.txt
|
|
11
|
+
src/fastmcp_tools_github.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.31
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fastmcp_tools_github
|