@agent-id/mcp 1.0.0 → 1.0.1
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 +17 -100
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,121 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @agent-id/mcp
|
|
2
2
|
|
|
3
|
-
MCP server that gives AI agents a verified identity
|
|
3
|
+
MCP server that gives AI agents a verified identity via BankID. Authenticate once, and every HTTP request the agent makes carries a signed JWT.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Claude Desktop
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
┌──────────────────┐
|
|
11
|
-
│ agentID API │
|
|
12
|
-
│ (BankID + JWT) │
|
|
13
|
-
└──────┬───────────┘
|
|
14
|
-
│ 1. authenticate via BankID
|
|
15
|
-
│ 2. receive signed JWT
|
|
16
|
-
│
|
|
17
|
-
User ← stdio → MCP Server ← HTTP + X-AgentID-Token → any website
|
|
18
|
-
│
|
|
19
|
-
│ website verifies JWT via /api/jwks
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Authentication flow
|
|
23
|
-
|
|
24
|
-
1. Agent calls `start_authentication` → gets a BankID auth URL
|
|
25
|
-
2. Agent shows the URL to the user → user completes BankID on their phone
|
|
26
|
-
3. Agent calls `complete_authentication` → MCP server polls until done, caches the JWT
|
|
27
|
-
4. Agent calls `authenticated_fetch` → every request carries `X-AgentID-Token: <jwt>`
|
|
28
|
-
|
|
29
|
-
The JWT contains a pseudonymous identity (no PII), expires after 1 hour, and is signed with RS256.
|
|
30
|
-
|
|
31
|
-
## Quick start
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm install
|
|
35
|
-
npm run build
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Claude Desktop config
|
|
39
|
-
|
|
40
|
-
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
41
|
-
|
|
42
|
-
```json
|
|
43
|
-
{
|
|
44
|
-
"mcpServers": {
|
|
45
|
-
"agentID": {
|
|
46
|
-
"command": "node",
|
|
47
|
-
"args": ["/absolute/path/to/agentID/dist/index.js"]
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Or if published to npm:
|
|
9
|
+
Add to your config (`Settings → Developer → Edit Config`):
|
|
54
10
|
|
|
55
11
|
```json
|
|
56
12
|
{
|
|
57
13
|
"mcpServers": {
|
|
58
14
|
"agentID": {
|
|
59
15
|
"command": "npx",
|
|
60
|
-
"args": ["
|
|
16
|
+
"args": ["-y", "@agent-id/mcp"]
|
|
61
17
|
}
|
|
62
18
|
}
|
|
63
19
|
}
|
|
64
20
|
```
|
|
65
21
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
### `start_authentication`
|
|
69
|
-
|
|
70
|
-
Start a BankID authentication session. Returns an `authUrl` to show the user and a `sessionId` for polling.
|
|
71
|
-
|
|
72
|
-
No parameters.
|
|
73
|
-
|
|
74
|
-
### `complete_authentication`
|
|
75
|
-
|
|
76
|
-
Poll until BankID authentication completes. Caches the JWT automatically.
|
|
77
|
-
|
|
78
|
-
| Param | Type | Required | Description |
|
|
79
|
-
|-------|------|----------|-------------|
|
|
80
|
-
| `sessionId` | string | yes | Session ID from `start_authentication` |
|
|
81
|
-
|
|
82
|
-
### `authenticated_fetch`
|
|
83
|
-
|
|
84
|
-
Make an HTTP request with the cached agentID token attached as `X-AgentID-Token`.
|
|
85
|
-
|
|
86
|
-
| Param | Type | Required | Description |
|
|
87
|
-
|-------|------|----------|-------------|
|
|
88
|
-
| `url` | string | yes | URL to fetch |
|
|
89
|
-
| `method` | GET / POST / PUT / DELETE | no (default GET) | HTTP method |
|
|
90
|
-
| `body` | string | no | Request body for POST/PUT |
|
|
91
|
-
| `headers` | object | no | Additional headers |
|
|
92
|
-
|
|
93
|
-
Returns an error if no valid token is cached — call `start_authentication` first.
|
|
94
|
-
|
|
95
|
-
## Example server
|
|
96
|
-
|
|
97
|
-
A demo Express server that checks for the `X-AgentID-Token` header:
|
|
22
|
+
### Claude Code
|
|
98
23
|
|
|
99
24
|
```bash
|
|
100
|
-
|
|
101
|
-
npx ts-node example-server/server.ts
|
|
102
|
-
|
|
103
|
-
# Without token → 403
|
|
104
|
-
curl http://localhost:4000/whoami
|
|
105
|
-
|
|
106
|
-
# With token → 200
|
|
107
|
-
curl -H "X-AgentID-Token: any-token" http://localhost:4000/whoami
|
|
25
|
+
claude mcp add agentID -- npx -y @agent-id/mcp
|
|
108
26
|
```
|
|
109
27
|
|
|
110
|
-
|
|
111
|
-
- `GET /whoami` — agent verification status
|
|
112
|
-
- `GET /data` — sample protected data
|
|
113
|
-
- `POST /echo` — echoes request body
|
|
28
|
+
## Tools
|
|
114
29
|
|
|
115
|
-
|
|
30
|
+
| Tool | Description |
|
|
31
|
+
|------|-------------|
|
|
32
|
+
| `start_authentication` | Start a BankID session — returns a URL for the user to authenticate |
|
|
33
|
+
| `complete_authentication` | Poll until authentication completes, caches the JWT |
|
|
34
|
+
| `authenticated_fetch` | Make HTTP requests with the JWT attached as `X-AgentID-Token` |
|
|
116
35
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
npm start # run the compiled server
|
|
121
|
-
```
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
|
9
9
|
const axios_1 = __importDefault(require("axios"));
|
|
10
10
|
const zod_1 = require("zod");
|
|
11
11
|
// --- Config ---
|
|
12
|
-
const AGENTID_URL = "https://
|
|
12
|
+
const AGENTID_URL = "https://agentidapp.vercel.app";
|
|
13
13
|
// --- Token cache ---
|
|
14
14
|
let cachedToken = null;
|
|
15
15
|
let tokenExpiresAt = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-id/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "MCP server that gives AI agents a verified identity via BankID",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"@types/node": "^25.3.0",
|
|
34
34
|
"typescript": "^5.9.3"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|