UIengF opened a new pull request, #436:
URL: https://github.com/apache/hugegraph-ai/pull/436
## Summary
This PR introduces **MCP v2** capabilities across `hugegraph-mcp`,
`hugegraph-llm`, and `hugegraph-python-client`, adding native MCP
Resources/Prompts, `streamable-http` transport, durable PostgreSQL plan
storage, bounded graph traversal, semantic VID search, task/graph
observability, and write-plan lifecycle management, together with multi-round
security and reliability hardening.
### Key Changes
#### 1. `hugegraph-mcp` — Protocol, Transport & Persistence
- **Native MCP Resources & Prompts** (`hugegraph_mcp/resources.py`,
`hugegraph_mcp/prompts.py`):
- Added 4 MCP Resources (schema, graph summary, VID embedding index
status, and actor-scoped write plan details) with resource subscription and
invalidation notifications.
- Added 6 MCP Prompts (`explore_graph`, `design_graph_schema`,
`review_write_plan`, `investigate_write_status`, `ingest_text_to_graph`,
`optimize_gremlin_query`).
- **Streamable HTTP & Actor Context** (`auth_middleware.py`, `runtime.py`,
`server.py`):
- Added `streamable-http` / `http` / `sse` transport support with
bearer/actor extraction, admin scope gating, and per-session cleanup.
- **PostgreSQL Plan Store & Outbox Relay** (`stores/postgres.py`,
`stores/base.py`, `plan_store.py`):
- Added `PostgresPlanStore` (and `PostgresSyncPlanStore` bridge) with
outbox event relay alongside the default SQLite store.
#### 2. `hugegraph-mcp` — New `core` Tools (24 tools total in `core`, 10 in
`legacy`)
- **Bounded Traversal & Observability**:
- `traverse_graph_tool` (`neighbors`, `k_out`, `shortest_path`, `paths`
with strict bounds).
- `get_task_status_tool`, `list_tasks_tool`, `cancel_task_tool`
(admin-gated async task inspection & cancellation).
- `list_graphs_tool` (admin-gated visible graph listing in the configured
graphspace).
- **Write-Plan Lifecycle & Schema Append**:
- `list_write_plans_tool` (actor-owned plans ordered by most recent) and
`cancel_write_plan_tool` (cancel `ISSUED` plans to `EXPIRED`, revoking legacy
confirmation tokens).
- `WritePlan` support for `append_vertex_label` and `append_edge_label` in
`apply_schema_tool` / `confirm_write_tool`.
- Cache invalidation on `reconcile_write_tool` and degraded-server
reporting in `read_summary_resource`.
- **Semantic VID Search**:
- `search_vid_embeddings_tool` calling HugeGraph-AI
`/v1/vid-embeddings/search` (requires `HUGEGRAPH_MCP_ALLOW_AI=true`).
#### 3. `hugegraph-python-client` & `hugegraph-llm`
- **Streaming Byte Cap & Trickle Deadline** (`huge_requests.py`,
`exceptions.py`):
- Enforced streaming response byte limits and end-to-end request deadlines
across `hugegraph-python-client` to prevent unbounded response buffering.
- **HugeGraph-AI VID Search & Index Reliability** (`thin_api.py`,
`build_semantic_index.py`, `milvus_vector_store.py`, `qdrant_vector_store.py`):
- Added `POST /v1/vid-embeddings/search` with target `(graphspace, graph)`
validation, read-only index loading, and index generation/refresh metadata
(`index_generation`, `refreshed_at`).
#### 4. Documentation
- Updated `hugegraph-mcp/README.md`, `hugegraph-mcp/README.zh-CN.md`,
`hugegraph-mcp/docs/architecture.md`, `hugegraph-mcp/docs/integration.md`,
`hugegraph-mcp/docs/releasing.md`, and
`hugegraph-mcp/tests/distribution_smoke.py` to reflect the 24 `core` tools,
Resources/Prompts, transports, `PostgresPlanStore`, and schema append support.
---
## Testing & Verification
- **`hugegraph-mcp` & `hugegraph-python-client` offline tests** (verified at
`5174486`):
```bash
python -m pytest hugegraph-python-client/src/tests hugegraph-mcp/tests -m
"not integration" -q
# 1125 passed, 3 skipped, 90 deselected
```
- **MCP distribution smoke test** (verified at `5174486`):
```bash
python hugegraph-mcp/tests/distribution_smoke.py -- <path-to-hugegraph-mcp>
# Command exited with code 0
```
- **Live PostgreSQL 14 + HugeGraph integration test** (verified at
`5174486`):
```bash
# hugegraph-mcp/tests/integration/test_live_v2_postgres_and_hugegraph.py
# 3 passed
```
- **`hugegraph-llm` offline tests** (verified at `d5acfe0` on Windows):
```bash
python -m pytest hugegraph-llm/src/tests -m "not integration" -q
# 1274 passed, 11 skipped, 16 deselected
# (2 pre-existing Windows-only failures in test_external_config.py due to
POSIX st_mode 0o600/0o660 checks on NTFS)
```
- **Public docs & stable tool contract tests** (verified at `94bec5b`):
```bash
python -m pytest hugegraph-mcp/tests/test_public_docs_contract.py
hugegraph-mcp/tests/test_v1_stable_tools.py -q
# 50 passed
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]