feat: diagnose live MCP namespace EOF health

This commit is contained in:
2026-07-09 18:39:41 -04:00
parent 52013791d4
commit 314615ec2c
5 changed files with 540 additions and 24 deletions
+32
View File
@@ -191,6 +191,7 @@ MERGER_WORKTREE_ENV = "GITEA_MERGER_WORKTREE"
RECONCILER_WORKTREE_ENV = "GITEA_RECONCILER_WORKTREE"
import namespace_workspace_binding as nwb # noqa: E402
import mcp_namespace_health # noqa: E402
def _preflight_in_test_mode() -> bool:
@@ -9187,6 +9188,37 @@ def gitea_list_profiles() -> dict:
return {"profiles": profiles_out}
@mcp.tool()
def gitea_assess_mcp_namespace_health(
namespace: str,
required_tool: str | None = None,
registered_tools: list[str] | None = None,
probe_result: dict | None = None,
process: dict | None = None,
config_path: str | None = None,
profile: str | None = None,
configured: bool = True,
) -> dict:
"""Read-only: classify live MCP namespace health for required Gitea tools.
Static FastMCP registration is not enough to prove a namespace works: IDE
clients can keep a registered tool list while live calls fail with
``client is closing: EOF``. This diagnostic accepts static registration
evidence plus live invocation evidence and returns fail-closed guidance for
reviewer/merger workflows.
"""
return mcp_namespace_health.classify_namespace_probe(
namespace,
required_tool=required_tool,
registered_tools=registered_tools,
probe_result=probe_result,
process=process,
config_path=config_path,
profile=profile,
configured=configured,
)
@mcp.tool()
def gitea_activate_profile(
profile_name: str,