Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

Make the GitHub MCP example runnable and return only issues

Rudy Celekli3fea7d499fae
diff --git a/specialized/specialized-mcp-builder.md b/specialized/specialized-mcp-builder.md
index e12b89c5..0bc5352a 100644
--- a/specialized/specialized-mcp-builder.md
+++ b/specialized/specialized-mcp-builder.md
@@ -110,6 +110,12 @@ await server.connect(transport);
### Python MCP Server
```python
+# MCP Python SDK 1.x: pip install 'mcp>=1,<2' httpx
+# SDK 2.x uses a different server API; this example targets FastMCP.
+import json
+import os
+from pathlib import Path
+import httpx
from mcp.server.fastmcp import FastMCP
from pydantic import Field
@@ -133,7 +139,13 @@ async def search_issues(
headers={"Authorization": f"token {os.environ['GITHUB_TOKEN']}"},
)
resp.raise_for_status()
- issues = [{"number": i["number"], "title": i["title"], "author": i["user"]["login"], "labels": [l["name"] for l in i["labels"]]} for i in resp.json()]
+ # GitHub's repository issues endpoint also returns pull requests.
+ # Keep this tool's issue-only contract; limit bounds the listing page.
+ issues = [
+ {"number": i["number"], "title": i["title"],
+ "author": i["user"]["login"], "labels": [l["name"] for l in i["labels"]]}
+ for i in resp.json() if "pull_request" not in i
+ ]
return json.dumps(issues, indent=2)
@mcp.resource("repo://readme")