hermes-to-claude 0.1.1 → 0.1.2
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.
- package/dist/hbridge.mjs +1 -1
- package/docs/mcp-spec.md +85 -85
- package/package.json +2 -2
package/dist/hbridge.mjs
CHANGED
|
@@ -1582,7 +1582,7 @@ function stopStatusBar(intervalId) {
|
|
|
1582
1582
|
|
|
1583
1583
|
// src/hbridge/cli.mjs
|
|
1584
1584
|
import { networkInterfaces } from "os";
|
|
1585
|
-
var H2C_VERSION = "
|
|
1585
|
+
var H2C_VERSION = "v184.0.572153f";
|
|
1586
1586
|
var server = null;
|
|
1587
1587
|
var statusBarInterval = null;
|
|
1588
1588
|
function getLocalIPs() {
|
package/docs/mcp-spec.md
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
# MCP Protocol Spec — h2c Mapping
|
|
2
|
-
|
|
3
|
-
Spec: https://modelcontextprotocol.io/specification/2024-11-05
|
|
4
|
-
|
|
5
|
-
## 1. Lifecycle — Initialization
|
|
6
|
-
|
|
7
|
-
**Spec ref**: `Specification → Base Protocol → Lifecycle → Initialization`
|
|
8
|
-
|
|
9
|
-
**Sequence**:
|
|
10
|
-
```
|
|
11
|
-
Client → Server: initialize (protocolVersion + capabilities + clientInfo)
|
|
12
|
-
Server → Client: initialize response (protocolVersion + capabilities + serverInfo)
|
|
13
|
-
Client → Server: notifications/initialized (no response needed)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**h2c implementation**: `mcp.mjs` lines 79-88
|
|
17
|
-
|
|
18
|
-
## 2. Capabilities — tools MUST declare listChanged
|
|
19
|
-
|
|
20
|
-
**Spec ref**: `Specification → Server Features → Tools → Capabilities`
|
|
21
|
-
|
|
22
|
-
**Spec quote**: "Servers that support tools MUST declare the tools capability"
|
|
23
|
-
```
|
|
24
|
-
{"capabilities": {"tools": {"listChanged": true}}}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**h2c implementation**: `mcp.mjs` line 85 — `capabilities: { tools: { listChanged: true } }`
|
|
28
|
-
|
|
29
|
-
## 3. Tool Definition Format
|
|
30
|
-
|
|
31
|
-
**Spec ref**: `Specification → Server Features → Tools → Data Types → Tool`
|
|
32
|
-
|
|
33
|
-
**Fields**:
|
|
34
|
-
- `name` (string, required) — unique tool name
|
|
35
|
-
- `description` (string, optional) — human-readable description
|
|
36
|
-
- `inputSchema` (object, required) — JSON Schema for tool parameters
|
|
37
|
-
|
|
38
|
-
**h2c implementation**: `mcp.mjs` TOOLS array, lines 292-322 — all 4 tools have name + description + inputSchema
|
|
39
|
-
|
|
40
|
-
## 4. tools/list Response
|
|
41
|
-
|
|
42
|
-
**Spec ref**: `Specification → Server Features → Tools → Protocol Messages → Listing Tools`
|
|
43
|
-
|
|
44
|
-
**Response format**:
|
|
45
|
-
```
|
|
46
|
-
{"tools": [Tool, Tool, ...]}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**h2c implementation**: `mcp.mjs` line 89 — respond({ result: { tools: TOOLS } })
|
|
50
|
-
|
|
51
|
-
## 5. tools/call Response
|
|
52
|
-
|
|
53
|
-
**Spec ref**: `Specification → Server Features → Tools → Data Types → Text Content`
|
|
54
|
-
|
|
55
|
-
**Format**:
|
|
56
|
-
```
|
|
57
|
-
{"content": [{"type": "text", "text": "result string"}]}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**h2c implementation**: `mcp.mjs` lines 161-164 — respond({ result: { content: [{ type: "text", text: t }] } })
|
|
61
|
-
|
|
62
|
-
## 6. Available Tools
|
|
63
|
-
|
|
64
|
-
| Tool | Description |
|
|
65
|
-
|------|-------------|
|
|
66
|
-
| `h2c_enable` | Start h2c HTTP server, show access key |
|
|
67
|
-
| `h2c_disable` | Stop h2c server |
|
|
68
|
-
| `h2c_status` | Show server status + last client connection info |
|
|
69
|
-
| `h2c_status_bar` | Show/hide h2c status in Claude Code status bar |
|
|
70
|
-
|
|
71
|
-
## 7. Additional Features
|
|
72
|
-
|
|
73
|
-
- **Stdout guard** (`mcp.mjs` lines 25-32): Non-JSON stdout writes are redirected to stderr to prevent third-party console.log from corrupting the MCP JSON-RPC stream.
|
|
74
|
-
- **Crash protection** (`mcp.mjs` lines 35-40): `uncaughtException` and `unhandledRejection` handlers keep the MCP process alive.
|
|
75
|
-
- **HTTP inbox server** (`mcp.mjs` lines 180-285): When `H2C_HOME=1`, the MCP server also auto-starts an HTTP server on the deterministic port.
|
|
76
|
-
- **Server info**: `serverInfo: { name: "h2c", version: "1.0.0" }` in initialize response.
|
|
77
|
-
|
|
78
|
-
## 8. Validation Results
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
✅ initialize → protocolVersion:2024-11-05, capabilities.listChanged:true
|
|
82
|
-
✅ tools/list → 4 tools with name+description+inputSchema
|
|
83
|
-
✅ tools/call → content[{type:text,text:...}]
|
|
84
|
-
✅ notified/init → silent accept
|
|
85
|
-
```
|
|
1
|
+
# MCP Protocol Spec — h2c Mapping
|
|
2
|
+
|
|
3
|
+
Spec: https://modelcontextprotocol.io/specification/2024-11-05
|
|
4
|
+
|
|
5
|
+
## 1. Lifecycle — Initialization
|
|
6
|
+
|
|
7
|
+
**Spec ref**: `Specification → Base Protocol → Lifecycle → Initialization`
|
|
8
|
+
|
|
9
|
+
**Sequence**:
|
|
10
|
+
```
|
|
11
|
+
Client → Server: initialize (protocolVersion + capabilities + clientInfo)
|
|
12
|
+
Server → Client: initialize response (protocolVersion + capabilities + serverInfo)
|
|
13
|
+
Client → Server: notifications/initialized (no response needed)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**h2c implementation**: `mcp.mjs` lines 79-88
|
|
17
|
+
|
|
18
|
+
## 2. Capabilities — tools MUST declare listChanged
|
|
19
|
+
|
|
20
|
+
**Spec ref**: `Specification → Server Features → Tools → Capabilities`
|
|
21
|
+
|
|
22
|
+
**Spec quote**: "Servers that support tools MUST declare the tools capability"
|
|
23
|
+
```
|
|
24
|
+
{"capabilities": {"tools": {"listChanged": true}}}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**h2c implementation**: `mcp.mjs` line 85 — `capabilities: { tools: { listChanged: true } }`
|
|
28
|
+
|
|
29
|
+
## 3. Tool Definition Format
|
|
30
|
+
|
|
31
|
+
**Spec ref**: `Specification → Server Features → Tools → Data Types → Tool`
|
|
32
|
+
|
|
33
|
+
**Fields**:
|
|
34
|
+
- `name` (string, required) — unique tool name
|
|
35
|
+
- `description` (string, optional) — human-readable description
|
|
36
|
+
- `inputSchema` (object, required) — JSON Schema for tool parameters
|
|
37
|
+
|
|
38
|
+
**h2c implementation**: `mcp.mjs` TOOLS array, lines 292-322 — all 4 tools have name + description + inputSchema
|
|
39
|
+
|
|
40
|
+
## 4. tools/list Response
|
|
41
|
+
|
|
42
|
+
**Spec ref**: `Specification → Server Features → Tools → Protocol Messages → Listing Tools`
|
|
43
|
+
|
|
44
|
+
**Response format**:
|
|
45
|
+
```
|
|
46
|
+
{"tools": [Tool, Tool, ...]}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**h2c implementation**: `mcp.mjs` line 89 — respond({ result: { tools: TOOLS } })
|
|
50
|
+
|
|
51
|
+
## 5. tools/call Response
|
|
52
|
+
|
|
53
|
+
**Spec ref**: `Specification → Server Features → Tools → Data Types → Text Content`
|
|
54
|
+
|
|
55
|
+
**Format**:
|
|
56
|
+
```
|
|
57
|
+
{"content": [{"type": "text", "text": "result string"}]}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**h2c implementation**: `mcp.mjs` lines 161-164 — respond({ result: { content: [{ type: "text", text: t }] } })
|
|
61
|
+
|
|
62
|
+
## 6. Available Tools
|
|
63
|
+
|
|
64
|
+
| Tool | Description |
|
|
65
|
+
|------|-------------|
|
|
66
|
+
| `h2c_enable` | Start h2c HTTP server, show access key |
|
|
67
|
+
| `h2c_disable` | Stop h2c server |
|
|
68
|
+
| `h2c_status` | Show server status + last client connection info |
|
|
69
|
+
| `h2c_status_bar` | Show/hide h2c status in Claude Code status bar |
|
|
70
|
+
|
|
71
|
+
## 7. Additional Features
|
|
72
|
+
|
|
73
|
+
- **Stdout guard** (`mcp.mjs` lines 25-32): Non-JSON stdout writes are redirected to stderr to prevent third-party console.log from corrupting the MCP JSON-RPC stream.
|
|
74
|
+
- **Crash protection** (`mcp.mjs` lines 35-40): `uncaughtException` and `unhandledRejection` handlers keep the MCP process alive.
|
|
75
|
+
- **HTTP inbox server** (`mcp.mjs` lines 180-285): When `H2C_HOME=1`, the MCP server also auto-starts an HTTP server on the deterministic port.
|
|
76
|
+
- **Server info**: `serverInfo: { name: "h2c", version: "1.0.0" }` in initialize response.
|
|
77
|
+
|
|
78
|
+
## 8. Validation Results
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
✅ initialize → protocolVersion:2024-11-05, capabilities.listChanged:true
|
|
82
|
+
✅ tools/list → 4 tools with name+description+inputSchema
|
|
83
|
+
✅ tools/call → content[{type:text,text:...}]
|
|
84
|
+
✅ notified/init → silent accept
|
|
85
|
+
```
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hermes-to-claude",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local HTTP bridge connecting Hermes Agent to Claude Code — no Pro/Max subscription required",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"repository": "github:xuhancn/hermes-claude
|
|
7
|
+
"repository": "github:xuhancn/hermes-to-claude",
|
|
8
8
|
"bin": {
|
|
9
9
|
"h2c": "dist/hbridge.mjs"
|
|
10
10
|
},
|