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>
31 lines
765 B
Python
31 lines
765 B
Python
"""
|
|
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",
|
|
]
|