@ziggs-ai/ziggs-mcp 0.1.6 → 0.1.8
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/dist/operatorKey.d.ts
CHANGED
package/dist/operatorKey.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const MINT_KEY_HELP = 'Mint a key in the Ziggs app: Developer Portal → Operator keys (fleet key + set ZIGGS_AGENT_ID), ' +
|
|
2
2
|
'or open your delegate agent → Issue operator key (agent-scoped — no ZIGGS_AGENT_ID needed). ' +
|
|
3
|
-
'Docs: https://
|
|
3
|
+
'Docs: https://ziggsai.com/docs (Claude Code MCP tier).';
|
|
4
4
|
/** Decode operator JWT payload without verifying signature (ZIG-279 boundAgentId). */
|
|
5
5
|
export function decodeOperatorKeyClaims(token) {
|
|
6
6
|
const trimmed = token.trim();
|
|
@@ -13,7 +13,9 @@ export function decodeOperatorKeyClaims(token) {
|
|
|
13
13
|
return {
|
|
14
14
|
type: payload.type,
|
|
15
15
|
keyId: payload.keyId,
|
|
16
|
+
ownerId: payload.ownerId,
|
|
16
17
|
boundAgentId: payload.boundAgentId ?? null,
|
|
18
|
+
boundOrgId: payload.boundOrgId ?? null,
|
|
17
19
|
exp: payload.exp,
|
|
18
20
|
};
|
|
19
21
|
}
|
package/dist/tools.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { getAgreement, getMyAgreements, listMyChats, openConversation, proposeDirectTo, respondToAgreement, ScopeClient, MessagesClient, sendChatMessage, ContextDiscoveryClient, ContextReadClient, InboxClient, ArtifactsClient, getBackendUrl, } from '@ziggs-ai/api-client';
|
|
4
|
+
import { decodeOperatorKeyClaims } from './operatorKey.js';
|
|
4
5
|
import { registerTrustTools } from './trustTools.js';
|
|
5
6
|
import { formatInboxToolResult } from './inboxToolResult.js';
|
|
6
7
|
function textResult(data) {
|
|
@@ -46,6 +47,24 @@ async function writeArtifactStrict(creds, input) {
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
export function registerZiggsTools(server, creds, cfg) {
|
|
50
|
+
server.tool('ziggs_connection_status', 'ZIG-503 — Verify MCP OAuth binding: delegate agent id, owner user id, and org scope. Call after connect before inbox/chats.', {}, async () => {
|
|
51
|
+
const claims = decodeOperatorKeyClaims(creds.operatorKey);
|
|
52
|
+
const boundOrgId = claims?.boundOrgId?.trim() || null;
|
|
53
|
+
return textResult({
|
|
54
|
+
ok: true,
|
|
55
|
+
agentId: creds.agentId,
|
|
56
|
+
ownerId: claims?.ownerId ?? cfg.ZIGGS_OWNER_USER_ID ?? null,
|
|
57
|
+
keyId: claims?.keyId ?? null,
|
|
58
|
+
tokenType: claims?.type ?? 'operator',
|
|
59
|
+
orgId: boundOrgId,
|
|
60
|
+
orgBinding: boundOrgId ? 'selected' : 'personal',
|
|
61
|
+
orgBindingNote: boundOrgId
|
|
62
|
+
? 'MCP OAuth is bound to the organization you chose at consent (ZIG-504).'
|
|
63
|
+
: 'MCP OAuth binds to your personal org when no org was specified at consent.',
|
|
64
|
+
apiBase: getBackendUrl(),
|
|
65
|
+
docs: 'https://ziggsai.com/docs',
|
|
66
|
+
});
|
|
67
|
+
});
|
|
49
68
|
server.tool('ziggs_smoke_impersonation', 'ZIG-222 smoke (1): list agreements and optionally resolve scope from the first chat.', {}, async () => {
|
|
50
69
|
try {
|
|
51
70
|
const agreements = await getMyAgreements({}, creds);
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Claude Code + Ziggs remote MCP (OAuth — ZIG-500 V4)
|
|
2
|
+
|
|
3
|
+
Verify the **fresh Claude Code** journey: empty repo, `.mcp.json` only (no operator key), OAuth → real Ziggs tools.
|
|
4
|
+
|
|
5
|
+
Automated prerequisites + Path A parity (no UI):
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd agentplus
|
|
9
|
+
node scripts/smoke-zig-500-v4-path.mjs --discovery-only
|
|
10
|
+
node scripts/smoke-zig-500-v4-path.mjs --auto
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What V4 proves
|
|
16
|
+
|
|
17
|
+
| Layer | Automated script | Manual Claude Code |
|
|
18
|
+
|-------|------------------|-------------------|
|
|
19
|
+
| ZIG-496 discovery (well-known, 401 docs) | `--discovery-only` | Client uses same URLs |
|
|
20
|
+
| OAuth → Bearer → full tool surface | `--auto` or smoke creds | Connect in IDE |
|
|
21
|
+
| No stub-only tools | fails if only `authenticate` / `complete_authentication` | Tool picker shows `ziggs_*` |
|
|
22
|
+
| Restart not required | N/A | Tools visible right after OAuth |
|
|
23
|
+
|
|
24
|
+
**Path A (pass):** Native MCP OAuth — client discovers metadata, gets Bearer, `tools/list` returns ≥12 `ziggs_*` tools.
|
|
25
|
+
|
|
26
|
+
**Path B (fail → epic children 501–502):** OAuth succeeds but only stub auth tools appear — needs unauth MCP + `tools/list_changed` design in backend.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Manual setup (empty repo)
|
|
31
|
+
|
|
32
|
+
### 1. Create `.mcp.json` at repo root
|
|
33
|
+
|
|
34
|
+
Copy [`claude-code-remote-mcp.json`](claude-code-remote-mcp.json):
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"ziggs": {
|
|
40
|
+
"url": "https://mcp.ziggsai.com/mcp"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
No `ZIGGS_OPERATOR_KEY`, no `command` / `npx` — URL + OAuth only.
|
|
47
|
+
|
|
48
|
+
### 2. Open in Claude Code
|
|
49
|
+
|
|
50
|
+
Use a **throwaway directory** (no existing Ziggs plugin or stdio MCP).
|
|
51
|
+
|
|
52
|
+
### 3. Connect / authorize
|
|
53
|
+
|
|
54
|
+
1. Claude Code should prompt for MCP OAuth (or open MCP settings).
|
|
55
|
+
2. Browser → Ziggs consent (`/app/oauth/mcp-consent`) → **Allow**.
|
|
56
|
+
3. Return to Claude Code — check tool list.
|
|
57
|
+
|
|
58
|
+
### 4. Smoke tools (no restart)
|
|
59
|
+
|
|
60
|
+
Ask Claude to call in order:
|
|
61
|
+
|
|
62
|
+
1. `ziggs_list_chats` or `ziggs_inbox`
|
|
63
|
+
2. `ziggs_send_message` (chat you belong to)
|
|
64
|
+
|
|
65
|
+
**Pass:** both succeed; tool picker shows many `ziggs_*` tools (not just 2 auth stubs).
|
|
66
|
+
|
|
67
|
+
**Fail:** only `authenticate` / `complete_authentication`; or OAuth OK but tools empty until restart → comment on [ZIG-500](https://linear.app/ziggsai/issue/ZIG-500) with Path B.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Discovery URLs (same as Cursor / claude.ai)
|
|
72
|
+
|
|
73
|
+
| Resource | URL |
|
|
74
|
+
|----------|-----|
|
|
75
|
+
| MCP endpoint | `https://mcp.ziggsai.com/mcp` |
|
|
76
|
+
| Protected resource (RFC 9728) | `https://mcp.ziggsai.com/.well-known/oauth-protected-resource/mcp` |
|
|
77
|
+
| Authorization server | `https://api.ziggsai.com/.well-known/oauth-authorization-server` |
|
|
78
|
+
| Docs (401 hint) | `https://ziggsai.com/docs` |
|
|
79
|
+
|
|
80
|
+
Localhost redirect (Claude Code default): `https://localhost/oauth/callback`
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Operator-key fallback (not V4)
|
|
85
|
+
|
|
86
|
+
For dev or when OAuth is blocked, use [claude-code.md](claude-code.md) Option B (`ZIGGS_OPERATOR_KEY` + `npx @ziggs-ai/ziggs-mcp`). That path is **not** the ZIG-500 epic acceptance target.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Troubleshooting
|
|
91
|
+
|
|
92
|
+
| Symptom | Check |
|
|
93
|
+
|---------|--------|
|
|
94
|
+
| OAuth loop / 401 on tools | Re-run `smoke-zig-500-v4-path.mjs --auto`; revoke MCP in Agents dashboard → reconnect |
|
|
95
|
+
| Only 2 stub tools | Path B — epic needs 501/502; paste tool list in Linear |
|
|
96
|
+
| `app.ziggsai.com` in 401 `error` text | ZIG-496 fixed `docs` field; `error` string comes from pinned `@ziggs-ai/ziggs-mcp` npm — bump backend dep after publish |
|
|
97
|
+
| Tools after restart only | ZIG-502 `tools/list_changed` candidate |
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Sign-off template (paste in ZIG-500)
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
ZIG-500 V4 — fresh Claude Code
|
|
105
|
+
Date:
|
|
106
|
+
Claude Code version:
|
|
107
|
+
Repo: empty + .mcp.json only (Y/N)
|
|
108
|
+
Automated: smoke-zig-500-v4-path.mjs --discovery-only → pass/fail
|
|
109
|
+
Automated: smoke-zig-500-v4-path.mjs --auto → Path A/B, N tools
|
|
110
|
+
Manual OAuth connect: pass/fail
|
|
111
|
+
Tool count after OAuth (no restart): __
|
|
112
|
+
ziggs_inbox or ziggs_list_chats: pass/fail
|
|
113
|
+
Notes:
|
|
114
|
+
```
|
package/examples/claude-code.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
# Claude Code + Ziggs MCP (ZIG-430 / ZIG-437)
|
|
1
|
+
# Claude Code + Ziggs MCP (ZIG-430 / ZIG-437 / ZIG-500)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Recommended:** [Remote OAuth](claude-code-remote-oauth.md) — `.mcp.json` with `https://mcp.ziggsai.com/mcp` only, no operator key.
|
|
4
|
+
|
|
5
|
+
One-command boarding with an operator key against production (`https://api.ziggsai.com`).
|
|
4
6
|
|
|
5
7
|
## Option A — Plugin (ZIG-437, recommended)
|
|
6
8
|
|