feat(gitea): add pip-installable packaging for external consumption
Extract tool definitions and dispatcher from server.py into tool_registry.py to enable transport-agnostic reuse. External consumers (e.g., HTTP transport in gitea-mcp-remote) can now import and use the Gitea MCP tools without duplicating code. Changes: - Create pyproject.toml with PEP 621 compliant package manifest (hatchling) - Create tool_registry.py with get_tool_definitions() and create_tool_dispatcher() - Refactor server.py to use registry (1100 -> 93 lines) - Update __init__.py with package exports and __version__ The tool_filter parameter enables selective tool exposure for remote servers. Stdio transport behavior is unchanged - all 36 tools still work identically. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
"""
|
||||||
|
Gitea MCP Server package.
|
||||||
|
|
||||||
|
Provides MCP tools for Gitea integration via JSON-RPC 2.0.
|
||||||
|
|
||||||
|
For external consumers (e.g., HTTP transport), use:
|
||||||
|
from mcp_server import get_tool_definitions, create_tool_dispatcher, GiteaClient
|
||||||
|
|
||||||
|
# Get tool schemas
|
||||||
|
tools = get_tool_definitions()
|
||||||
|
|
||||||
|
# Create dispatcher bound to a client
|
||||||
|
client = GiteaClient()
|
||||||
|
dispatch = create_tool_dispatcher(client)
|
||||||
|
result = await dispatch("list_issues", {"state": "open"})
|
||||||
|
"""
|
||||||
|
|
||||||
|
__version__ = "1.0.0"
|
||||||
|
|
||||||
|
from .tool_registry import get_tool_definitions, create_tool_dispatcher
|
||||||
|
from .gitea_client import GiteaClient
|
||||||
|
from .config import GiteaConfig
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"__version__",
|
||||||
|
"get_tool_definitions",
|
||||||
|
"create_tool_dispatcher",
|
||||||
|
"GiteaClient",
|
||||||
|
"GiteaConfig",
|
||||||
|
]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1098
mcp-servers/gitea/mcp_server/tool_registry.py
Normal file
1098
mcp-servers/gitea/mcp_server/tool_registry.py
Normal file
File diff suppressed because it is too large
Load Diff
39
mcp-servers/gitea/pyproject.toml
Normal file
39
mcp-servers/gitea/pyproject.toml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "gitea-mcp-server"
|
||||||
|
version = "1.0.0"
|
||||||
|
description = "MCP Server for Gitea integration - provides issue, label, wiki, milestone, dependency, and PR tools"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
license = "MIT"
|
||||||
|
authors = [
|
||||||
|
{ name = "Leo Miranda" }
|
||||||
|
]
|
||||||
|
keywords = ["mcp", "gitea", "claude", "tools"]
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 4 - Beta",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"License :: OSI Approved :: MIT License",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
]
|
||||||
|
dependencies = [
|
||||||
|
"mcp>=0.9.0",
|
||||||
|
"python-dotenv>=1.0.0",
|
||||||
|
"requests>=2.31.0",
|
||||||
|
"pydantic>=2.5.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
test = [
|
||||||
|
"pytest>=7.4.3",
|
||||||
|
"pytest-asyncio>=0.23.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["mcp_server"]
|
||||||
Reference in New Issue
Block a user