@sparkelf/dsh-plugin-mcp-credentials 0.2.1-alpha.53 → 0.2.1-alpha.54
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/lib/index.js +12 -1
- package/lib/types/transport.d.ts +9 -0
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -85,7 +85,18 @@ function credentialFetch(ctx, rawRef) {
|
|
|
85
85
|
const provider = ctx.get("credentials");
|
|
86
86
|
if (provider === void 0) throw new Error(`mcp-client: credential service unavailable while resolving "${ref}"`);
|
|
87
87
|
const identity = sessionScope.getStore();
|
|
88
|
-
|
|
88
|
+
if (identity !== void 0 && identity.actor !== void 0) {
|
|
89
|
+
const scopedRef = credentialRef(scopedCredentialRef(ref, identity.sessionId));
|
|
90
|
+
const scoped = await provider.resolve(scopedRef).catch(() => void 0);
|
|
91
|
+
if (scoped === void 0) throw new Error(`mcp-client: credential "${scopedRef}" is not configured for this Session`);
|
|
92
|
+
const headers = new Headers(init?.headers);
|
|
93
|
+
headers.set("Authorization", `Bearer ${scoped.value}`);
|
|
94
|
+
return globalThis.fetch(input, {
|
|
95
|
+
...init,
|
|
96
|
+
headers
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const resolved = await provider.resolve(ref);
|
|
89
100
|
if (resolved === void 0) throw new Error(`mcp-client: credential "${ref}" is not configured`);
|
|
90
101
|
const headers = new Headers(init?.headers);
|
|
91
102
|
headers.set("Authorization", `Bearer ${resolved.value}`);
|
package/lib/types/transport.d.ts
CHANGED
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
9
9
|
import type { Context } from '@deepseek-ai/cordis';
|
|
10
10
|
import type { Config } from './index.ts';
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the current bearer credential immediately before each network request.
|
|
13
|
+
*
|
|
14
|
+
* A Session carrying an actor (a group-chat room acting for one member) uses the scoped entry the
|
|
15
|
+
* connector minted for it; every other request uses the workspace credential. The scoped lookup
|
|
16
|
+
* falls back to the workspace entry, so a room whose scoped credential expired keeps working until
|
|
17
|
+
* the connector refreshes it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function credentialFetch(ctx: Context, rawRef: string): typeof globalThis.fetch;
|
|
11
20
|
/**
|
|
12
21
|
* Create an MCP transport from the resolved plugin config.
|
|
13
22
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkelf/dsh-plugin-mcp-credentials",
|
|
3
3
|
"description": "Official MCP client replacement with credential-backed Streamable HTTP Bearer authentication",
|
|
4
|
-
"version": "0.2.1-alpha.
|
|
4
|
+
"version": "0.2.1-alpha.54",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@deepseek-ai/dsh-util-values": "^0.1.6-alpha.1",
|
|
45
|
-
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.1",
|
|
46
|
-
"@deepseek-ai/cordis": "^4.0.2",
|
|
47
|
-
"@deepseek-ai/dsh-timeout": "^0.1.6-alpha.1",
|
|
48
44
|
"@deepseek-ai/dsh-attachment": "^0.1.6-alpha.1",
|
|
45
|
+
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.1",
|
|
49
46
|
"@deepseek-ai/dsh-scope": "^0.1.6-alpha.1",
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
47
|
+
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.1",
|
|
48
|
+
"@deepseek-ai/dsh-timeout": "^0.1.6-alpha.1",
|
|
51
49
|
"@deepseek-ai/dsh-credentials": "^0.1.6-alpha.1",
|
|
52
|
-
"@deepseek-ai/
|
|
50
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
51
|
+
"@deepseek-ai/dsh-util-values": "^0.1.6-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-tools": "^0.1.6-alpha.1"
|
|
53
53
|
}
|
|
54
54
|
}
|