Skip to content

Add MCP server for tool dispatch and hc-run resource access - #18

Draft
binrogithub wants to merge 1 commit into
masterfrom
codex/implement-mcpserver-in-server.py
Draft

Add MCP server for tool dispatch and hc-run resource access#18
binrogithub wants to merge 1 commit into
masterfrom
codex/implement-mcpserver-in-server.py

Conversation

@binrogithub

Copy link
Copy Markdown
Owner

Motivation

  • Provide a centralized MCP server to dispatch named tools including hc_tools_search, hc_run, hc_run_demo, and hc_doctor_fix and support admin-gated tools.
  • Allow reading run artifacts and metadata via hc-run:// URIs backed by an abstract run store.
  • Establish a new hc_agent package to host MCP server code.

Description

  • Add McpServer class with fields run_store, tools, admin_tools, and policy, and provide a _missing_tool_stub for unconfigured tools.
  • Implement list_tools() to enumerate available tools and call_tool(name, params, ctx) to dispatch to tools or admin_tools with policy gating and a structured error for unknown tools.
  • Implement read_resource(uri) to parse hc-run://<run_id>/... URIs, fetch artifacts via run_store methods (read_artifact, get_artifact, open_artifact) or run info via get_run/read_run/run_info, and list_resources(prefix) to optionally list artifacts using run_store.list_artifacts.
  • Add helper methods _parse_run_uri, _read_artifact, _read_run_info, _policy_allows_admin, and _format_run_resource, and create package initializers hc_agent/__init__.py and hc_agent/mcp/__init__.py.

Testing

  • No automated tests were run on the modified code.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant