@opennous/mcp 0.51.0 → 0.54.0
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/package.json +1 -1
- package/src/client.js +4 -1
- package/src/http.js +1 -0
- package/src/index.js +4 -1
- package/src/server.js +181 -1324
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -122,7 +122,10 @@ async function request(method, path, { body, query } = {}) {
|
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
124
|
const errorMessage = err.error || err.message || res.statusText;
|
|
125
|
-
|
|
125
|
+
// Append `detail` when present — it carries the actionable explanation (e.g. "reconnect
|
|
126
|
+
// the repo with Pull requests: write") that a bare error code doesn't.
|
|
127
|
+
const suffix = err.detail && err.detail !== errorMessage ? ` — ${err.detail}` : "";
|
|
128
|
+
throw new Error(`Nous API error (${res.status}): ${errorMessage}${suffix}`);
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
// Some endpoints return empty 204
|
package/src/http.js
CHANGED
|
@@ -100,6 +100,7 @@ const httpServer = http.createServer(async (req, res) => {
|
|
|
100
100
|
// Fresh server + transport per request (stateless), with the key bound for
|
|
101
101
|
// the whole async handling so every tool call uses this tenant's key.
|
|
102
102
|
await runWithApiKey(apiKey, async () => {
|
|
103
|
+
// One surface: the 6-primitive revenue plugin. createServer() exposes only those.
|
|
103
104
|
const server = createServer();
|
|
104
105
|
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
|
|
105
106
|
res.on("close", () => {
|
package/src/index.js
CHANGED
|
@@ -27,6 +27,9 @@ try {
|
|
|
27
27
|
console.error(`[nous] ${err.message}`);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
// NOUS_SURFACE=plugin trims the stdio server to the 6-primitive plugin allowlist
|
|
31
|
+
// (+ whoami) — the same trim the hosted HTTP variant applies via ?surface=plugin.
|
|
32
|
+
// Unset (or any other value) serves the full toolset. See server.js createServer({surface}).
|
|
33
|
+
const server = createServer({ surface: process.env.NOUS_SURFACE });
|
|
31
34
|
const transport = new StdioServerTransport();
|
|
32
35
|
await server.connect(transport);
|