specrails-desktop 2.18.1 → 2.18.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/package.json
CHANGED
|
@@ -7,6 +7,7 @@ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamable
|
|
|
7
7
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
8
8
|
const mobile_event_bus_1 = require("../mobile/mobile-event-bus");
|
|
9
9
|
const mcp_tiers_1 = require("./mcp-tiers");
|
|
10
|
+
const agent_tier_1 = require("../agent-tier");
|
|
10
11
|
const desktop_db_1 = require("../desktop-db");
|
|
11
12
|
const catalog_1 = require("./tools/catalog");
|
|
12
13
|
const types_1 = require("./tools/types");
|
|
@@ -88,7 +89,17 @@ class McpServerManager {
|
|
|
88
89
|
* carry the `mcp-session-id` header.
|
|
89
90
|
*/
|
|
90
91
|
async handleHttp(req, res) {
|
|
91
|
-
|
|
92
|
+
// The external Settings ▸ MCP toggle gates THIRD-PARTY clients only. The
|
|
93
|
+
// in-app agent chat is first-party: it reaches this loopback endpoint through
|
|
94
|
+
// the bundled bridge, which always forwards the `x-specrails-agent-tier`
|
|
95
|
+
// header. Serving that request regardless of the toggle means the in-app
|
|
96
|
+
// agent gets its MCP by default with zero config on a fresh install (the
|
|
97
|
+
// toggle defaults OFF). Third-party clients (no agent-tier header) still get
|
|
98
|
+
// 404 until the user explicitly opts in. Both paths already sit behind
|
|
99
|
+
// requireLoopback + requireMcpAuth (scoped token), so this is not an auth
|
|
100
|
+
// relaxation — only the enable-toggle is bypassed for the first-party agent.
|
|
101
|
+
const isFirstPartyAgent = Boolean(req.headers[agent_tier_1.AGENT_TIER_HEADER]);
|
|
102
|
+
if (!this.isEnabledSetting() && !isFirstPartyAgent) {
|
|
92
103
|
res.status(404).json(jsonRpcError('MCP is disabled. Enable it in the Specrails app under Settings ▸ MCP.', -32004));
|
|
93
104
|
return;
|
|
94
105
|
}
|