mcp-hcl 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. mcp_hcl-0.5.0/LICENSE +21 -0
  2. mcp_hcl-0.5.0/PKG-INFO +201 -0
  3. mcp_hcl-0.5.0/README.md +168 -0
  4. mcp_hcl-0.5.0/pyproject.toml +72 -0
  5. mcp_hcl-0.5.0/setup.cfg +4 -0
  6. mcp_hcl-0.5.0/src/mcp_hcl/__init__.py +3 -0
  7. mcp_hcl-0.5.0/src/mcp_hcl/acl_removal.py +302 -0
  8. mcp_hcl-0.5.0/src/mcp_hcl/acl_semantics.py +378 -0
  9. mcp_hcl-0.5.0/src/mcp_hcl/acl_values.py +131 -0
  10. mcp_hcl-0.5.0/src/mcp_hcl/address_observation.py +199 -0
  11. mcp_hcl-0.5.0/src/mcp_hcl/api_compatibility.py +137 -0
  12. mcp_hcl-0.5.0/src/mcp_hcl/artifact_store.py +114 -0
  13. mcp_hcl-0.5.0/src/mcp_hcl/artifacts.py +123 -0
  14. mcp_hcl-0.5.0/src/mcp_hcl/backend.py +674 -0
  15. mcp_hcl-0.5.0/src/mcp_hcl/build_pipeline.py +90 -0
  16. mcp_hcl-0.5.0/src/mcp_hcl/catalog.py +384 -0
  17. mcp_hcl-0.5.0/src/mcp_hcl/cli_session.py +366 -0
  18. mcp_hcl-0.5.0/src/mcp_hcl/command_reference.py +38 -0
  19. mcp_hcl-0.5.0/src/mcp_hcl/console.py +912 -0
  20. mcp_hcl-0.5.0/src/mcp_hcl/contracts.py +267 -0
  21. mcp_hcl-0.5.0/src/mcp_hcl/data/command_reference.json +850 -0
  22. mcp_hcl-0.5.0/src/mcp_hcl/data/hcl_open_gate.ps1 +516 -0
  23. mcp_hcl-0.5.0/src/mcp_hcl/data/hcl_process_identity.ps1 +117 -0
  24. mcp_hcl-0.5.0/src/mcp_hcl/data/native_terminal_reference.json +29 -0
  25. mcp_hcl-0.5.0/src/mcp_hcl/data/platform_reference.json +27 -0
  26. mcp_hcl-0.5.0/src/mcp_hcl/data/upstream_contracts.json +2308 -0
  27. mcp_hcl-0.5.0/src/mcp_hcl/data/upstream_parity.json +830 -0
  28. mcp_hcl-0.5.0/src/mcp_hcl/deployment.py +593 -0
  29. mcp_hcl-0.5.0/src/mcp_hcl/dsh_compat.py +378 -0
  30. mcp_hcl-0.5.0/src/mcp_hcl/environment.py +109 -0
  31. mcp_hcl-0.5.0/src/mcp_hcl/evidence.py +609 -0
  32. mcp_hcl-0.5.0/src/mcp_hcl/generation.py +442 -0
  33. mcp_hcl-0.5.0/src/mcp_hcl/geometry.py +75 -0
  34. mcp_hcl-0.5.0/src/mcp_hcl/gui_identity.py +371 -0
  35. mcp_hcl-0.5.0/src/mcp_hcl/gui_relay.py +342 -0
  36. mcp_hcl-0.5.0/src/mcp_hcl/inspection.py +235 -0
  37. mcp_hcl-0.5.0/src/mcp_hcl/interface_tuning.py +458 -0
  38. mcp_hcl-0.5.0/src/mcp_hcl/lab_bundle.py +387 -0
  39. mcp_hcl-0.5.0/src/mcp_hcl/live_acceptance.py +190 -0
  40. mcp_hcl-0.5.0/src/mcp_hcl/models.py +18 -0
  41. mcp_hcl-0.5.0/src/mcp_hcl/nat_models.py +222 -0
  42. mcp_hcl-0.5.0/src/mcp_hcl/nat_policy.py +578 -0
  43. mcp_hcl-0.5.0/src/mcp_hcl/nat_semantics.py +486 -0
  44. mcp_hcl-0.5.0/src/mcp_hcl/netstream_policy.py +520 -0
  45. mcp_hcl-0.5.0/src/mcp_hcl/offline_tools.py +93 -0
  46. mcp_hcl-0.5.0/src/mcp_hcl/parity.py +206 -0
  47. mcp_hcl-0.5.0/src/mcp_hcl/planning.py +860 -0
  48. mcp_hcl-0.5.0/src/mcp_hcl/policy.py +538 -0
  49. mcp_hcl-0.5.0/src/mcp_hcl/project.py +522 -0
  50. mcp_hcl-0.5.0/src/mcp_hcl/project_build.py +265 -0
  51. mcp_hcl-0.5.0/src/mcp_hcl/project_edit.py +303 -0
  52. mcp_hcl-0.5.0/src/mcp_hcl/readback.py +231 -0
  53. mcp_hcl-0.5.0/src/mcp_hcl/reconciliation.py +715 -0
  54. mcp_hcl-0.5.0/src/mcp_hcl/runtime.py +127 -0
  55. mcp_hcl-0.5.0/src/mcp_hcl/runtime_binding.py +682 -0
  56. mcp_hcl-0.5.0/src/mcp_hcl/security_audit.py +576 -0
  57. mcp_hcl-0.5.0/src/mcp_hcl/server.py +625 -0
  58. mcp_hcl-0.5.0/src/mcp_hcl/services.py +708 -0
  59. mcp_hcl-0.5.0/src/mcp_hcl/startup.py +167 -0
  60. mcp_hcl-0.5.0/src/mcp_hcl/switch_security.py +590 -0
  61. mcp_hcl-0.5.0/src/mcp_hcl/templates.py +58 -0
  62. mcp_hcl-0.5.0/src/mcp_hcl/tool_annotations.py +191 -0
  63. mcp_hcl-0.5.0/src/mcp_hcl/topology.py +458 -0
  64. mcp_hcl-0.5.0/src/mcp_hcl/transactions.py +101 -0
  65. mcp_hcl-0.5.0/src/mcp_hcl/vlan_network.py +456 -0
  66. mcp_hcl-0.5.0/src/mcp_hcl/vlan_semantics.py +170 -0
  67. mcp_hcl-0.5.0/src/mcp_hcl.egg-info/PKG-INFO +201 -0
  68. mcp_hcl-0.5.0/src/mcp_hcl.egg-info/SOURCES.txt +123 -0
  69. mcp_hcl-0.5.0/src/mcp_hcl.egg-info/dependency_links.txt +1 -0
  70. mcp_hcl-0.5.0/src/mcp_hcl.egg-info/entry_points.txt +3 -0
  71. mcp_hcl-0.5.0/src/mcp_hcl.egg-info/requires.txt +7 -0
  72. mcp_hcl-0.5.0/src/mcp_hcl.egg-info/top_level.txt +1 -0
  73. mcp_hcl-0.5.0/tests/test_040_console.py +174 -0
  74. mcp_hcl-0.5.0/tests/test_040_deployment.py +202 -0
  75. mcp_hcl-0.5.0/tests/test_040_evidence.py +59 -0
  76. mcp_hcl-0.5.0/tests/test_040_offline.py +207 -0
  77. mcp_hcl-0.5.0/tests/test_050_bundle.py +101 -0
  78. mcp_hcl-0.5.0/tests/test_050_environment.py +64 -0
  79. mcp_hcl-0.5.0/tests/test_050_evidence.py +344 -0
  80. mcp_hcl-0.5.0/tests/test_050_wireless.py +156 -0
  81. mcp_hcl-0.5.0/tests/test_acl_extended.py +237 -0
  82. mcp_hcl-0.5.0/tests/test_acl_named.py +337 -0
  83. mcp_hcl-0.5.0/tests/test_acl_persistence.py +228 -0
  84. mcp_hcl-0.5.0/tests/test_acl_removal.py +188 -0
  85. mcp_hcl-0.5.0/tests/test_address_observation.py +137 -0
  86. mcp_hcl-0.5.0/tests/test_api_compatibility.py +212 -0
  87. mcp_hcl-0.5.0/tests/test_backend.py +103 -0
  88. mcp_hcl-0.5.0/tests/test_backend_verbs.py +464 -0
  89. mcp_hcl-0.5.0/tests/test_basic_console_probe.py +163 -0
  90. mcp_hcl-0.5.0/tests/test_build_pipeline.py +69 -0
  91. mcp_hcl-0.5.0/tests/test_catalog.py +39 -0
  92. mcp_hcl-0.5.0/tests/test_console.py +677 -0
  93. mcp_hcl-0.5.0/tests/test_console_diagnostics.py +260 -0
  94. mcp_hcl-0.5.0/tests/test_console_ownership.py +106 -0
  95. mcp_hcl-0.5.0/tests/test_generation.py +118 -0
  96. mcp_hcl-0.5.0/tests/test_geometry.py +47 -0
  97. mcp_hcl-0.5.0/tests/test_gui_identity.py +191 -0
  98. mcp_hcl-0.5.0/tests/test_gui_relay.py +246 -0
  99. mcp_hcl-0.5.0/tests/test_inspection.py +702 -0
  100. mcp_hcl-0.5.0/tests/test_interface_tuning.py +206 -0
  101. mcp_hcl-0.5.0/tests/test_lab_account_plan.py +434 -0
  102. mcp_hcl-0.5.0/tests/test_live_gate_script.py +85 -0
  103. mcp_hcl-0.5.0/tests/test_mcp_contract.py +916 -0
  104. mcp_hcl-0.5.0/tests/test_nat_modes.py +146 -0
  105. mcp_hcl-0.5.0/tests/test_nat_transactions.py +270 -0
  106. mcp_hcl-0.5.0/tests/test_netstream_transactions.py +228 -0
  107. mcp_hcl-0.5.0/tests/test_new_sdk.py +150 -0
  108. mcp_hcl-0.5.0/tests/test_offline.py +195 -0
  109. mcp_hcl-0.5.0/tests/test_p0.py +162 -0
  110. mcp_hcl-0.5.0/tests/test_parity.py +41 -0
  111. mcp_hcl-0.5.0/tests/test_planning.py +61 -0
  112. mcp_hcl-0.5.0/tests/test_planning_fidelity.py +258 -0
  113. mcp_hcl-0.5.0/tests/test_policy.py +384 -0
  114. mcp_hcl-0.5.0/tests/test_project.py +142 -0
  115. mcp_hcl-0.5.0/tests/test_project_build.py +205 -0
  116. mcp_hcl-0.5.0/tests/test_reconciliation.py +147 -0
  117. mcp_hcl-0.5.0/tests/test_reproduction_goals.py +60 -0
  118. mcp_hcl-0.5.0/tests/test_runtime.py +100 -0
  119. mcp_hcl-0.5.0/tests/test_security_audit.py +181 -0
  120. mcp_hcl-0.5.0/tests/test_stdio.py +70 -0
  121. mcp_hcl-0.5.0/tests/test_switch_security.py +161 -0
  122. mcp_hcl-0.5.0/tests/test_topology.py +77 -0
  123. mcp_hcl-0.5.0/tests/test_topology_graph.py +264 -0
  124. mcp_hcl-0.5.0/tests/test_transaction_failures.py +220 -0
  125. mcp_hcl-0.5.0/tests/test_vlan_network.py +308 -0
mcp_hcl-0.5.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MCP_HCL contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
mcp_hcl-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,201 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-hcl
3
+ Version: 0.5.0
4
+ Summary: Agent-neutral MCP server for strict offline HCL planning, artifacts and gated control
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/yzd098776/dsh-HCL-mcp
7
+ Project-URL: Documentation, https://github.com/yzd098776/dsh-HCL-mcp/blob/main/docs/README.md
8
+ Project-URL: Repository, https://github.com/yzd098776/dsh-HCL-mcp
9
+ Project-URL: Changelog, https://github.com/yzd098776/dsh-HCL-mcp/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/yzd098776/dsh-HCL-mcp/issues
11
+ Project-URL: Security, https://github.com/yzd098776/dsh-HCL-mcp/security/policy
12
+ Keywords: mcp,model-context-protocol,hcl,h3c,network-automation,netops,comware,deepseek-harness
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Telecommunications Industry
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: System :: Networking
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: mcp<2,>=1.28
27
+ Requires-Dist: pydantic<3,>=2.11
28
+ Requires-Dist: packaging<27,>=24
29
+ Provides-Extra: dev
30
+ Requires-Dist: ruff==0.17.0; extra == "dev"
31
+ Requires-Dist: jsonschema<5,>=4.26; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # MCP_HCL
35
+
36
+ **A Model Context Protocol server for HCL (H3C Cloud Lab): plan and stage topologies offline, inspect a live lab through its real telnet bridge, and change device configuration only through gated, receipt-backed operations.**
37
+
38
+ [![CI](https://github.com/yzd098776/dsh-HCL-mcp/actions/workflows/software-ci.yml/badge.svg)](https://github.com/yzd098776/dsh-HCL-mcp/actions/workflows/software-ci.yml)
39
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
40
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](pyproject.toml)
41
+
42
+ Ships a DeepSeek Harness bundle ([`dsh/`](dsh/README.md)) and works with any
43
+ other MCP client over stdio.
44
+
45
+ ---
46
+
47
+ ## What it does
48
+
49
+ | Area | Tools |
50
+ |---|---|
51
+ | Topology planning and staging | `hcl_plan_topology`, `hcl_stage_plan`, `hcl_stage_copy`, `hcl_stage_add_device`, `hcl_stage_link`, `hcl_move/rename/delete`, `hcl_export_artifacts`, `hcl_load_plan`, `hcl_fix_plan` |
52
+ | Offline validation and generation | `hcl_validate_plan`, `hcl_explain_plan`, `hcl_estimate_plan`, `hcl_generate_configs`, `hcl_generate_operations` |
53
+ | Live lab read-only inspection | `hcl_read_vlans`, `hcl_read_qos`, `hcl_inspect_ports`, `hcl_health_check`, `hcl_diff`, `hcl_audit_security`, `hcl_inspect_project`, `hcl_capabilities`, … |
54
+ | Gated device configuration | `hcl_apply_vlan`, `hcl_apply_acl`, `hcl_apply_nat`, `hcl_apply_stp`, `hcl_apply_port_security`, `hcl_apply_netstream`, `hcl_apply_interface_tuning`, `hcl_remove_acl`, `hcl_remove_nat`, `hcl_backup_config`, `hcl_restore_config`, `hcl_live_deploy`, `hcl_device_power`, `hcl_console_exec` |
55
+
56
+ Full surface: **55 tools / 6 resources**, discoverable via `tools/list` and
57
+ `resources/list`. Every tool carries MCP safety annotations (`readOnlyHint`,
58
+ `destructiveHint`, `idempotentHint`, `openWorldHint`) so a client can decide
59
+ what to confirm before calling: 24 read-only, 14 destructive device-mutating,
60
+ 17 staging/GUI/other.
61
+
62
+ ## What it changes in the Harness, and what it does not
63
+
64
+ - **Changes**: one MCP client-connector row in the active DSH profile, which
65
+ exposes the server's tools as `mcp__hcl__<tool>`.
66
+ - **Does not change**: no Harness core file is patched, no module is injected
67
+ into the Harness process, no lifecycle or install script runs, and no GUI is
68
+ automated by default.
69
+ - **Does not do**: create HCL virtual machines, draw cables on the HCL canvas,
70
+ power devices on, or prove end-to-end connectivity. HCL itself owns VM
71
+ lifecycle; this server plans, validates, opens and configures.
72
+
73
+ ## Requirements
74
+
75
+ | Requirement | Notes |
76
+ |---|---|
77
+ | Python | 3.11+ |
78
+ | MCP client | Any stdio client; DeepSeek Harness 0.1.0-rc.7+ for the bundled plugin |
79
+ | Windows | Required for live-lab and GUI tools; offline planning/staging tools also run on Linux/macOS |
80
+ | HCL (H3C Cloud Lab) | Required for native tools; without it the server starts and offline tools still work |
81
+
82
+ ## Install
83
+
84
+ ```powershell
85
+ pipx install mcp-hcl # or: uv tool install mcp-hcl
86
+ ```
87
+
88
+ DeepSeek Harness plugin (adds the `hcl` MCP server row):
89
+
90
+ ```powershell
91
+ dsh plugin --profile desktop add .\dsh # from this checkout, or from a release tarball
92
+ ```
93
+
94
+ Then set the HCL paths in the composed profile patch — see
95
+ [`dsh/README.md`](dsh/README.md) for the full env table, health check and
96
+ uninstall steps.
97
+
98
+ Generic MCP client (`claude_desktop_config.json` style):
99
+
100
+ ```json
101
+ {
102
+ "mcpServers": {
103
+ "hcl": {
104
+ "command": "mcp-hcl",
105
+ "env": {
106
+ "MCP_HCL_INSTALL_ROOT": "E:\\HCL",
107
+ "MCP_HCL_PROJECT_ROOTS": "C:\\Users\\me\\HCL\\Projects",
108
+ "MCP_HCL_OUTPUT_ROOT": "D:\\mcp-hcl\\staged",
109
+ "MCP_HCL_ALLOW_LIVE_WRITE": "0"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ ## Quick start
117
+
118
+ ```text
119
+ # offline: turn a declarative request into a real, staged HCL project
120
+ hcl_estimate_plan {template: "router_on_a_stick", routers: 1, pcs_per_lan: 3}
121
+ hcl_stage_plan {project_path: "C:\\Users\\me\\HCL\\Projects\\lab",
122
+ stage_name: "demo", request: {...}, port_map: {...}}
123
+
124
+ # live: read the running lab through the telnet bridge
125
+ hcl_read_vlans {project_path: "...\\work\\staged\\demo\\lab", topology: "topo1",
126
+ device: "MSR36-20_1"}
127
+ ```
128
+
129
+ ## Safety and permissions
130
+
131
+ - **Local only**: talks to `127.0.0.1:16600` (HCL backend) and
132
+ `127.0.0.1:30001-31024` (HCL telnet bridge). No outbound network access.
133
+ - **Writes are opt-in**: `MCP_HCL_ALLOW_LIVE_WRITE` defaults to `0`; with the
134
+ default, device-mutating tools return a refusal instead of touching a device.
135
+ - **Staged-only deployments**: destructive tools refuse the original HCL
136
+ project and require a stage receipt plus VDI/VM identity binding; every
137
+ operation writes a receipt under the configured output root.
138
+ - **Evidence over claims**: read tools report `native_readback_verified`, and
139
+ the contract keeps `connectivity_verified` / `guest_boot_verified` /
140
+ `full_live_gate_passed` false because the server cannot prove those.
141
+ - **No secrets**: stores no credentials; lab device logins stay inside the
142
+ emulated network.
143
+
144
+ ## Status and evidence
145
+
146
+ - Verified on a real Windows HCL install: read-only tools return
147
+ `native_readback_verified: true` over the telnet bridge (14 ports, VLAN 1,
148
+ empty QoS DB, security audit, health and diff), after a restart and a fresh
149
+ staging round.
150
+ - Boundary documented in [真实 HCL 观测](docs/hcl-live-findings.md): restart
151
+ invalidates a staged copy's config-disk UUID, so re-run the restage helper;
152
+ HCL's GUI cannot be automated from a non-elevated process.
153
+ - Upstream MCP-Packet-Tracer parity is **incomplete** (12 implemented / 47
154
+ planned / 3 unverified). This project does not claim that parity.
155
+
156
+ ## Development
157
+
158
+ ```powershell
159
+ python -m venv .venv
160
+ .\.venv\Scripts\python.exe -m pip install -e '.[dev]'
161
+ .\.venv\Scripts\python.exe scripts\check_all.py # ruff + full software verification
162
+ ```
163
+
164
+ Module responsibilities and code style: [docs/development.md](docs/development.md).
165
+ Contracts and schemas: [docs/contract-v2.md](docs/contract-v2.md),
166
+ [docs/offline-contracts.json](docs/offline-contracts.json).
167
+ A handful of tests exercise signed PowerShell helpers and need an execution
168
+ policy that permits them.
169
+
170
+ ## Documentation
171
+
172
+ | Document | Purpose |
173
+ |---|---|
174
+ | [docs/README.md](docs/README.md) | Documentation index |
175
+ | [docs/offline-api.md](docs/offline-api.md) | Tool groups and call patterns |
176
+ | [docs/contract-v2.md](docs/contract-v2.md) | Strict argument/result/recovery contract |
177
+ | [docs/deepseek-harness.md](docs/deepseek-harness.md) | Schema projection and Harness registration |
178
+ | [docs/hcl-live-findings.md](docs/hcl-live-findings.md) | Real HCL observations and known issues |
179
+ | [docs/live-acceptance.md](docs/live-acceptance.md) | Software and native acceptance steps |
180
+ | [HANDOFF.md](HANDOFF.md) | Current version, verification results, next steps |
181
+ | [CHANGELOG.md](CHANGELOG.md) | Release history |
182
+ | [SECURITY.md](SECURITY.md) | Reporting a vulnerability |
183
+
184
+ ## 中文摘要
185
+
186
+ MCP_HCL 把 HCL(H3C Cloud Lab)的规划、staging、只读回读与受控配置封装成 MCP
187
+ 工具,既可接入任意 MCP 客户端,也自带 DeepSeek Harness 插件包(`dsh/`)。
188
+
189
+ 安装:`pipx install mcp-hcl`,再 `dsh plugin --profile desktop add .\dsh`,并在
190
+ profile 的 patch 里填好 `MCP_HCL_INSTALL_ROOT` / `MCP_HCL_PROJECT_ROOTS` /
191
+ `MCP_HCL_OUTPUT_ROOT`。写设备默认关闭(`MCP_HCL_ALLOW_LIVE_WRITE=0`),只读与
192
+ 离线工具可直接使用。边界:本服务不创建虚拟机、不代替 HCL 画布,也不声称已证明
193
+ 业务连通性;真实设备结论见 [docs/hcl-live-findings.md](docs/hcl-live-findings.md)。
194
+
195
+ ## License
196
+
197
+ MIT — see [LICENSE](LICENSE).
198
+
199
+ 本仓库是基于 [cheese-sansan/MCP_HCL](https://github.com/cheese-sansan/MCP_HCL)(MIT)
200
+ 面向 DeepSeek Harness 插件市场的适配版本:新增插件包、工具安全注解与发布面文档,
201
+ 未改变服务的功能边界与验收口径。
@@ -0,0 +1,168 @@
1
+ # MCP_HCL
2
+
3
+ **A Model Context Protocol server for HCL (H3C Cloud Lab): plan and stage topologies offline, inspect a live lab through its real telnet bridge, and change device configuration only through gated, receipt-backed operations.**
4
+
5
+ [![CI](https://github.com/yzd098776/dsh-HCL-mcp/actions/workflows/software-ci.yml/badge.svg)](https://github.com/yzd098776/dsh-HCL-mcp/actions/workflows/software-ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](pyproject.toml)
8
+
9
+ Ships a DeepSeek Harness bundle ([`dsh/`](dsh/README.md)) and works with any
10
+ other MCP client over stdio.
11
+
12
+ ---
13
+
14
+ ## What it does
15
+
16
+ | Area | Tools |
17
+ |---|---|
18
+ | Topology planning and staging | `hcl_plan_topology`, `hcl_stage_plan`, `hcl_stage_copy`, `hcl_stage_add_device`, `hcl_stage_link`, `hcl_move/rename/delete`, `hcl_export_artifacts`, `hcl_load_plan`, `hcl_fix_plan` |
19
+ | Offline validation and generation | `hcl_validate_plan`, `hcl_explain_plan`, `hcl_estimate_plan`, `hcl_generate_configs`, `hcl_generate_operations` |
20
+ | Live lab read-only inspection | `hcl_read_vlans`, `hcl_read_qos`, `hcl_inspect_ports`, `hcl_health_check`, `hcl_diff`, `hcl_audit_security`, `hcl_inspect_project`, `hcl_capabilities`, … |
21
+ | Gated device configuration | `hcl_apply_vlan`, `hcl_apply_acl`, `hcl_apply_nat`, `hcl_apply_stp`, `hcl_apply_port_security`, `hcl_apply_netstream`, `hcl_apply_interface_tuning`, `hcl_remove_acl`, `hcl_remove_nat`, `hcl_backup_config`, `hcl_restore_config`, `hcl_live_deploy`, `hcl_device_power`, `hcl_console_exec` |
22
+
23
+ Full surface: **55 tools / 6 resources**, discoverable via `tools/list` and
24
+ `resources/list`. Every tool carries MCP safety annotations (`readOnlyHint`,
25
+ `destructiveHint`, `idempotentHint`, `openWorldHint`) so a client can decide
26
+ what to confirm before calling: 24 read-only, 14 destructive device-mutating,
27
+ 17 staging/GUI/other.
28
+
29
+ ## What it changes in the Harness, and what it does not
30
+
31
+ - **Changes**: one MCP client-connector row in the active DSH profile, which
32
+ exposes the server's tools as `mcp__hcl__<tool>`.
33
+ - **Does not change**: no Harness core file is patched, no module is injected
34
+ into the Harness process, no lifecycle or install script runs, and no GUI is
35
+ automated by default.
36
+ - **Does not do**: create HCL virtual machines, draw cables on the HCL canvas,
37
+ power devices on, or prove end-to-end connectivity. HCL itself owns VM
38
+ lifecycle; this server plans, validates, opens and configures.
39
+
40
+ ## Requirements
41
+
42
+ | Requirement | Notes |
43
+ |---|---|
44
+ | Python | 3.11+ |
45
+ | MCP client | Any stdio client; DeepSeek Harness 0.1.0-rc.7+ for the bundled plugin |
46
+ | Windows | Required for live-lab and GUI tools; offline planning/staging tools also run on Linux/macOS |
47
+ | HCL (H3C Cloud Lab) | Required for native tools; without it the server starts and offline tools still work |
48
+
49
+ ## Install
50
+
51
+ ```powershell
52
+ pipx install mcp-hcl # or: uv tool install mcp-hcl
53
+ ```
54
+
55
+ DeepSeek Harness plugin (adds the `hcl` MCP server row):
56
+
57
+ ```powershell
58
+ dsh plugin --profile desktop add .\dsh # from this checkout, or from a release tarball
59
+ ```
60
+
61
+ Then set the HCL paths in the composed profile patch — see
62
+ [`dsh/README.md`](dsh/README.md) for the full env table, health check and
63
+ uninstall steps.
64
+
65
+ Generic MCP client (`claude_desktop_config.json` style):
66
+
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "hcl": {
71
+ "command": "mcp-hcl",
72
+ "env": {
73
+ "MCP_HCL_INSTALL_ROOT": "E:\\HCL",
74
+ "MCP_HCL_PROJECT_ROOTS": "C:\\Users\\me\\HCL\\Projects",
75
+ "MCP_HCL_OUTPUT_ROOT": "D:\\mcp-hcl\\staged",
76
+ "MCP_HCL_ALLOW_LIVE_WRITE": "0"
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ ## Quick start
84
+
85
+ ```text
86
+ # offline: turn a declarative request into a real, staged HCL project
87
+ hcl_estimate_plan {template: "router_on_a_stick", routers: 1, pcs_per_lan: 3}
88
+ hcl_stage_plan {project_path: "C:\\Users\\me\\HCL\\Projects\\lab",
89
+ stage_name: "demo", request: {...}, port_map: {...}}
90
+
91
+ # live: read the running lab through the telnet bridge
92
+ hcl_read_vlans {project_path: "...\\work\\staged\\demo\\lab", topology: "topo1",
93
+ device: "MSR36-20_1"}
94
+ ```
95
+
96
+ ## Safety and permissions
97
+
98
+ - **Local only**: talks to `127.0.0.1:16600` (HCL backend) and
99
+ `127.0.0.1:30001-31024` (HCL telnet bridge). No outbound network access.
100
+ - **Writes are opt-in**: `MCP_HCL_ALLOW_LIVE_WRITE` defaults to `0`; with the
101
+ default, device-mutating tools return a refusal instead of touching a device.
102
+ - **Staged-only deployments**: destructive tools refuse the original HCL
103
+ project and require a stage receipt plus VDI/VM identity binding; every
104
+ operation writes a receipt under the configured output root.
105
+ - **Evidence over claims**: read tools report `native_readback_verified`, and
106
+ the contract keeps `connectivity_verified` / `guest_boot_verified` /
107
+ `full_live_gate_passed` false because the server cannot prove those.
108
+ - **No secrets**: stores no credentials; lab device logins stay inside the
109
+ emulated network.
110
+
111
+ ## Status and evidence
112
+
113
+ - Verified on a real Windows HCL install: read-only tools return
114
+ `native_readback_verified: true` over the telnet bridge (14 ports, VLAN 1,
115
+ empty QoS DB, security audit, health and diff), after a restart and a fresh
116
+ staging round.
117
+ - Boundary documented in [真实 HCL 观测](docs/hcl-live-findings.md): restart
118
+ invalidates a staged copy's config-disk UUID, so re-run the restage helper;
119
+ HCL's GUI cannot be automated from a non-elevated process.
120
+ - Upstream MCP-Packet-Tracer parity is **incomplete** (12 implemented / 47
121
+ planned / 3 unverified). This project does not claim that parity.
122
+
123
+ ## Development
124
+
125
+ ```powershell
126
+ python -m venv .venv
127
+ .\.venv\Scripts\python.exe -m pip install -e '.[dev]'
128
+ .\.venv\Scripts\python.exe scripts\check_all.py # ruff + full software verification
129
+ ```
130
+
131
+ Module responsibilities and code style: [docs/development.md](docs/development.md).
132
+ Contracts and schemas: [docs/contract-v2.md](docs/contract-v2.md),
133
+ [docs/offline-contracts.json](docs/offline-contracts.json).
134
+ A handful of tests exercise signed PowerShell helpers and need an execution
135
+ policy that permits them.
136
+
137
+ ## Documentation
138
+
139
+ | Document | Purpose |
140
+ |---|---|
141
+ | [docs/README.md](docs/README.md) | Documentation index |
142
+ | [docs/offline-api.md](docs/offline-api.md) | Tool groups and call patterns |
143
+ | [docs/contract-v2.md](docs/contract-v2.md) | Strict argument/result/recovery contract |
144
+ | [docs/deepseek-harness.md](docs/deepseek-harness.md) | Schema projection and Harness registration |
145
+ | [docs/hcl-live-findings.md](docs/hcl-live-findings.md) | Real HCL observations and known issues |
146
+ | [docs/live-acceptance.md](docs/live-acceptance.md) | Software and native acceptance steps |
147
+ | [HANDOFF.md](HANDOFF.md) | Current version, verification results, next steps |
148
+ | [CHANGELOG.md](CHANGELOG.md) | Release history |
149
+ | [SECURITY.md](SECURITY.md) | Reporting a vulnerability |
150
+
151
+ ## 中文摘要
152
+
153
+ MCP_HCL 把 HCL(H3C Cloud Lab)的规划、staging、只读回读与受控配置封装成 MCP
154
+ 工具,既可接入任意 MCP 客户端,也自带 DeepSeek Harness 插件包(`dsh/`)。
155
+
156
+ 安装:`pipx install mcp-hcl`,再 `dsh plugin --profile desktop add .\dsh`,并在
157
+ profile 的 patch 里填好 `MCP_HCL_INSTALL_ROOT` / `MCP_HCL_PROJECT_ROOTS` /
158
+ `MCP_HCL_OUTPUT_ROOT`。写设备默认关闭(`MCP_HCL_ALLOW_LIVE_WRITE=0`),只读与
159
+ 离线工具可直接使用。边界:本服务不创建虚拟机、不代替 HCL 画布,也不声称已证明
160
+ 业务连通性;真实设备结论见 [docs/hcl-live-findings.md](docs/hcl-live-findings.md)。
161
+
162
+ ## License
163
+
164
+ MIT — see [LICENSE](LICENSE).
165
+
166
+ 本仓库是基于 [cheese-sansan/MCP_HCL](https://github.com/cheese-sansan/MCP_HCL)(MIT)
167
+ 面向 DeepSeek Harness 插件市场的适配版本:新增插件包、工具安全注解与发布面文档,
168
+ 未改变服务的功能边界与验收口径。
@@ -0,0 +1,72 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mcp-hcl"
7
+ version = "0.5.0"
8
+ description = "Agent-neutral MCP server for strict offline HCL planning, artifacts and gated control"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.11"
12
+ dependencies = ["mcp>=1.28,<2", "pydantic>=2.11,<3", "packaging>=24,<27"]
13
+ keywords = [
14
+ "mcp",
15
+ "model-context-protocol",
16
+ "hcl",
17
+ "h3c",
18
+ "network-automation",
19
+ "netops",
20
+ "comware",
21
+ "deepseek-harness",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 4 - Beta",
25
+ "Environment :: Console",
26
+ "Intended Audience :: Telecommunications Industry",
27
+ "Intended Audience :: Developers",
28
+ "Operating System :: Microsoft :: Windows",
29
+ "Operating System :: POSIX :: Linux",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Topic :: System :: Networking",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/yzd098776/dsh-HCL-mcp"
38
+ Documentation = "https://github.com/yzd098776/dsh-HCL-mcp/blob/main/docs/README.md"
39
+ Repository = "https://github.com/yzd098776/dsh-HCL-mcp"
40
+ Changelog = "https://github.com/yzd098776/dsh-HCL-mcp/blob/main/CHANGELOG.md"
41
+ Issues = "https://github.com/yzd098776/dsh-HCL-mcp/issues"
42
+ Security = "https://github.com/yzd098776/dsh-HCL-mcp/security/policy"
43
+
44
+ [project.scripts]
45
+ mcp-hcl = "mcp_hcl.server:main"
46
+ mcp-hcl-lab = "mcp_hcl.lab_bundle:main"
47
+
48
+ [tool.setuptools.packages.find]
49
+ where = ["src"]
50
+
51
+ [tool.setuptools.package-data]
52
+ mcp_hcl = ["data/*.json", "data/*.ps1"]
53
+
54
+ [project.optional-dependencies]
55
+ dev = ["ruff==0.17.0", "jsonschema>=4.26,<5"]
56
+
57
+ [tool.ruff]
58
+ target-version = "py311"
59
+ line-length = 100
60
+ extend-exclude = ["docs/history", "work", "build", "dist"]
61
+
62
+ [tool.ruff.lint]
63
+ select = ["E4", "E7", "E9", "F811", "F821", "F822", "F823", "I"]
64
+
65
+ [tool.ruff.lint.per-file-ignores]
66
+ # These entry points bind the tested package before importing it.
67
+ "scripts/run_software_verification.py" = ["E402"]
68
+
69
+ [tool.ruff.format]
70
+ quote-style = "double"
71
+ indent-style = "space"
72
+ line-ending = "lf"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """HCL MCP tools backed by observed HCL project behavior."""
2
+
3
+ __version__ = "0.5.0"