Publish curated ITWorx_MCP_Hub source from 9ec6419178e8ddc76a698e84bde72d5ff4472411

This commit is contained in:
Public Source Publisher committed 2026-10-01 09:39:30 +00:00
1 parent 5ff5c807d3
commit f26354e16c
20 files changed
+1639 -84

No files matched your search

+21 -5
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
import os
import re
from collections.abc import Callable
from typing import Any, Literal, ParamSpec, TypeVar, cast
from typing import Annotated, Any, Literal, ParamSpec, TypeVar, cast
from mcp.server.mcpserver import MCPServer
from mcp.server.mcpserver.context import Context
@@ -87,6 +87,14 @@ class ResearchFetchOutput(BaseModel):
metadata: dict[str, Any] | None = None
class PortfolioGovernanceApplyPlan(BaseModel):
model_config = ConfigDict(extra="forbid")
repositoryRef: str
planHash: str = Field(pattern=r"^[0-9a-f]{64}$")
applyScope: Literal["all", "protection_only"] = "all"
def _repository_ref(name: str) -> str:
value = re.sub(r"[^a-z0-9]+", "-", name.casefold()).strip("-")
if not value:
@@ -655,9 +663,12 @@ def build_server() -> MCPServer[Any]:
repositoryRef: str,
expectedPlanHash: str,
context: Context[Any, Any],
applyScope: Literal["all", "protection_only"] = "all",
) -> dict[str, Any]:
"""Apply one unchanged governance preview and verify the stored result."""
return connector.branch_protection_ensure(current(context), repositoryRef, expectedPlanHash)
"""Apply one unchanged governance preview with its explicitly hashed scope."""
return connector.branch_protection_ensure(
current(context), repositoryRef, expectedPlanHash, apply_scope=applyScope
)
@write_tool(
name="gitea.portfolio.governance.apply",
@@ -665,10 +676,15 @@ def build_server() -> MCPServer[Any]:
structured_output=True,
)
async def portfolio_governance_apply(
plans: list[dict[str, str]], context: Context[Any, Any]
context: Context[Any, Any],
plans: Annotated[
list[PortfolioGovernanceApplyPlan], Field(min_length=1, max_length=5)
],
) -> dict[str, Any]:
"""Apply at most five exact governance plans; every item is independently verified."""
return connector.portfolio_governance_apply(current(context), plans)
return connector.portfolio_governance_apply(
current(context), [plan.model_dump() for plan in plans]
)
@write_tool(name="gitea.branch.create", annotations=SAFE_WRITE_TOOL, structured_output=True)
async def branch_create(