@datacules/agent-identity-mcp-client 0.9.0 → 0.10.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/README.md +31 -74
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,57 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="../../../assets/logo.svg" alt="Agent Identity — by Datacules LLC" width="360"/>
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# `@datacules/agent-identity-mcp-client`
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
MCP client adapter for the agent-identity framework. Implements `CredentialStore` against any external MCP server, so the router can pull credentials from a Vault MCP server, 1Password MCP, or any custom credential MCP server as a drop-in backend.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|--------|-------------|
|
|
9
|
-
| `McpCredentialStore` | `CredentialStore` impl — fetches via MCP `list_credentials` tool |
|
|
10
|
-
| `McpToolCaller` | Direct tool caller — `resolveCredential`, `health`, arbitrary tools |
|
|
9
|
+
## Install
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
```bash
|
|
12
|
+
npm install @datacules/agent-identity-mcp-client @datacules/agent-identity
|
|
13
|
+
```
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
## Usage
|
|
17
16
|
|
|
18
17
|
```typescript
|
|
19
|
-
import { McpCredentialStore }
|
|
18
|
+
import { McpCredentialStore } from '@datacules/agent-identity-mcp-client';
|
|
20
19
|
import { createRouterFromStore } from '@datacules/agent-identity';
|
|
21
20
|
|
|
22
|
-
// HTTP
|
|
21
|
+
// HTTP + SSE — connect to a running MCP server
|
|
23
22
|
const store = new McpCredentialStore({
|
|
24
23
|
transport: 'http',
|
|
25
|
-
serverUrl: 'http://
|
|
26
|
-
authToken: process.env.MCP_AUTH_TOKEN, // optional
|
|
27
|
-
cacheTtlMs: 30_000, // optional, default 60s
|
|
24
|
+
serverUrl: 'http://localhost:3002',
|
|
28
25
|
});
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Credential resolution is now backed by the remote MCP server
|
|
33
|
-
const resolved = router.resolve(ctx);
|
|
34
|
-
|
|
35
|
-
// Disconnect on shutdown
|
|
36
|
-
process.on('SIGTERM', () => store.disconnect());
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
// stdio transport (spawn a local server process)
|
|
27
|
+
// stdio — spawn a local MCP server process
|
|
41
28
|
const store = new McpCredentialStore({
|
|
42
29
|
transport: 'stdio',
|
|
43
|
-
command:
|
|
44
|
-
args:
|
|
30
|
+
command: 'npx',
|
|
31
|
+
args: ['@datacules/agent-identity-mcp'],
|
|
45
32
|
env: {
|
|
46
33
|
AGENT_IDENTITY_CREDENTIALS: process.env.AGENT_IDENTITY_CREDENTIALS!,
|
|
47
|
-
AGENT_IDENTITY_RULES:
|
|
34
|
+
AGENT_IDENTITY_RULES: process.env.AGENT_IDENTITY_RULES!,
|
|
48
35
|
},
|
|
49
36
|
});
|
|
37
|
+
|
|
38
|
+
const router = createRouterFromStore(store, rules, logger);
|
|
39
|
+
const resolved = await router.resolveAsync(ctx);
|
|
50
40
|
```
|
|
51
41
|
|
|
52
|
-
##
|
|
42
|
+
## Direct tool calls: `McpToolCaller`
|
|
53
43
|
|
|
54
|
-
For
|
|
44
|
+
For typed access to MCP tools without a local router:
|
|
55
45
|
|
|
56
46
|
```typescript
|
|
57
47
|
import { McpToolCaller } from '@datacules/agent-identity-mcp-client';
|
|
@@ -61,49 +51,16 @@ const caller = new McpToolCaller({
|
|
|
61
51
|
serverUrl: 'http://localhost:3002',
|
|
62
52
|
});
|
|
63
53
|
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
console.log(result.credentialId, result.resolvedFor);
|
|
71
|
-
|
|
72
|
-
const health = await caller.health();
|
|
73
|
-
console.log(health.credentialsLoaded, health.rulesLoaded);
|
|
54
|
+
const resolved = await caller.resolveCredential(ctx);
|
|
55
|
+
const pair = await caller.resolveMigrationCredential(migCtx);
|
|
56
|
+
const alive = await caller.health();
|
|
57
|
+
const rules = await caller.callTool('list_rules', {}); // generic escape hatch
|
|
58
|
+
```
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
const rules = await caller.callTool('list_rules', {});
|
|
60
|
+
## Lazy connect + caching
|
|
77
61
|
|
|
78
|
-
|
|
79
|
-
```
|
|
62
|
+
Both `McpCredentialStore` and `McpToolCaller` connect lazily on the first call and maintain an in-memory cache with the same TTL semantics as the local `MemoryCredentialStore`. The connection is shared across requests for the lifetime of the store instance.
|
|
80
63
|
|
|
81
|
-
|
|
64
|
+
---
|
|
82
65
|
|
|
83
|
-
|
|
84
|
-
┌──────────────────────────────────────────┐
|
|
85
|
-
│ MCP Client │
|
|
86
|
-
│ (Claude Desktop / Claude Code / │
|
|
87
|
-
│ Cursor / custom agent) │
|
|
88
|
-
└──────────────────────────────────────────┘
|
|
89
|
-
│ MCP tools (resolve_credential etc.)
|
|
90
|
-
▼ INBOUND
|
|
91
|
-
┌──────────────────────────────────────────┐
|
|
92
|
-
│ @datacules/agent-identity-mcp │
|
|
93
|
-
│ (MCP Server — stdio or HTTP+SSE) │
|
|
94
|
-
└──────────────────────────────────────────┘
|
|
95
|
-
│ CredentialStore interface
|
|
96
|
-
▼
|
|
97
|
-
┌──────────────────────────────────────────┐
|
|
98
|
-
│ @datacules/agent-identity-mcp-client │
|
|
99
|
-
│ McpCredentialStore │ OUTBOUND
|
|
100
|
-
│ (fetches from external MCP servers) │
|
|
101
|
-
└──────────────────────────────────────────┘
|
|
102
|
-
│ MCP tools (list_credentials)
|
|
103
|
-
▼
|
|
104
|
-
┌──────────────────────────────────────────┐
|
|
105
|
-
│ External MCP Credential Server │
|
|
106
|
-
│ (Vault MCP / 1Password MCP / │
|
|
107
|
-
│ custom secrets server) │
|
|
108
|
-
└──────────────────────────────────────────┘
|
|
109
|
-
```
|
|
66
|
+
Part of the [agent-identity monorepo](https://github.com/hvrcharon1/agent-identity) by [Datacules LLC](https://datacules.com).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datacules/agent-identity-mcp-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "MCP client adapter for @datacules/agent-identity — consume external MCP servers as CredentialStores",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|