laive-mcp 0.1.2 → 0.1.3
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/packages/mcp-server/src/server.js +48 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## v0.1.3 - 2026-03-22
|
|
6
|
+
|
|
7
|
+
- Fixed MCP `tools/call` responses to return proper `CallToolResult` envelopes with `content`, `structuredContent`, and `isError`, so Codex clients accept the responses instead of rejecting them as an unexpected type.
|
|
8
|
+
|
|
5
9
|
## v0.1.2 - 2026-03-22
|
|
6
10
|
|
|
7
11
|
- Fixed an MCP transport crash when the Live bridge socket is unreachable by preventing the bridge client from raising an unhandled `error` event during lazy connection attempts. Tool calls now return structured MCP errors instead of closing the server process.
|
package/package.json
CHANGED
|
@@ -86,15 +86,23 @@ export class LaiveMcpServer {
|
|
|
86
86
|
|
|
87
87
|
if (message.method === "tools/call") {
|
|
88
88
|
const params = message.params ?? {};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
try {
|
|
90
|
+
const result = await this.invokeTool(params.name, params.arguments ?? {}, {
|
|
91
|
+
requestId: message.id ?? null
|
|
92
|
+
});
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
return {
|
|
95
|
+
jsonrpc: "2.0",
|
|
96
|
+
id: message.id ?? null,
|
|
97
|
+
result: toToolResult(result)
|
|
98
|
+
};
|
|
99
|
+
} catch (error) {
|
|
100
|
+
return {
|
|
101
|
+
jsonrpc: "2.0",
|
|
102
|
+
id: message.id ?? null,
|
|
103
|
+
result: toToolErrorResult(error)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
98
106
|
}
|
|
99
107
|
|
|
100
108
|
throw new McpServerError("method_not_found", `Unsupported method: ${message.method}`);
|
|
@@ -113,6 +121,38 @@ export class LaiveMcpServer {
|
|
|
113
121
|
}
|
|
114
122
|
}
|
|
115
123
|
|
|
124
|
+
function toToolResult(result) {
|
|
125
|
+
return {
|
|
126
|
+
content: [
|
|
127
|
+
{
|
|
128
|
+
type: "text",
|
|
129
|
+
text:
|
|
130
|
+
typeof result?.summary === "string" && result.summary.length > 0
|
|
131
|
+
? result.summary
|
|
132
|
+
: JSON.stringify(result, null, 2)
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
structuredContent: result,
|
|
136
|
+
isError: false
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function toToolErrorResult(error) {
|
|
141
|
+
const shape = toErrorShape(error);
|
|
142
|
+
return {
|
|
143
|
+
content: [
|
|
144
|
+
{
|
|
145
|
+
type: "text",
|
|
146
|
+
text: shape.message
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
structuredContent: {
|
|
150
|
+
error: shape
|
|
151
|
+
},
|
|
152
|
+
isError: true
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
116
156
|
function createUnsupportedAdapter(name) {
|
|
117
157
|
return new Proxy(
|
|
118
158
|
{},
|