@sirrlock/mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024–2026 Sirr contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @sirrlock/mcp — Sirr MCP Server
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@sirrlock/mcp)](https://www.npmjs.com/package/@sirrlock/mcp)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@sirrlock/mcp)](https://www.npmjs.com/package/@sirrlock/mcp)
5
+ [![CI](https://github.com/sirrlock/mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/sirrlock/mcp/actions)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/)
7
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/sirrlock/mcp/blob/main/LICENSE)
9
+ [![GitHub stars](https://img.shields.io/github/stars/sirrlock/mcp)](https://github.com/sirrlock/mcp)
10
+ [![Last commit](https://img.shields.io/github/last-commit/sirrlock/mcp)](https://github.com/sirrlock/mcp)
11
+
3
12
  Gives AI assistants like Claude direct access to your [Sirr](https://sirr.dev) secret vault. Push, read, and manage ephemeral secrets without leaving a conversation.
4
13
 
5
14
  ## Demo
@@ -50,7 +59,7 @@ Or use `npx` without a global install — see the configuration block below.
50
59
  ## Quick start
51
60
 
52
61
  1. **Start Sirr** — run the Sirr server and note the `SIRR_MASTER_KEY` you set (or the one it printed on first launch).
53
- 2. **Set your token** — `SIRR_TOKEN` in your MCP config must equal that `SIRR_MASTER_KEY` value exactly.
62
+ 2. **Set your token** — `SIRR_TOKEN` in your MCP config must equal that `SIRR_MASTER_KEY` value (or a principal key for org-scoped access).
54
63
  3. **Add to `.mcp.json`** — paste the config block below, substituting your server URL and key.
55
64
  4. **Verify** — run `sirr-mcp --health` to confirm the connection before starting your AI session.
56
65
 
@@ -89,14 +98,15 @@ Using `npx` without a global install:
89
98
  }
90
99
  ```
91
100
 
92
- > **What is `SIRR_TOKEN`?** It is the value of `SIRR_MASTER_KEY` that you set (or that was generated) when you started the Sirr server. These two values must match exactly — a mismatch is the most common cause of 401 errors. See [sirr.dev/errors#401](https://sirr.dev/errors#401).
101
+ > **What is `SIRR_TOKEN`?** For single-tenant usage, set it to `SIRR_MASTER_KEY` (full access). For multi-tenant org-scoped usage, set it to a principal key. A mismatch is the most common cause of 401 errors. See [sirr.dev/errors#401](https://sirr.dev/errors#401).
93
102
 
94
103
  ### Environment variables
95
104
 
96
105
  | Variable | Default | Description |
97
106
  |---|---|---|
98
107
  | `SIRR_SERVER` | `http://localhost:39999` | Sirr server URL |
99
- | `SIRR_TOKEN` | — | Bearer token — must equal `SIRR_MASTER_KEY` on the server |
108
+ | `SIRR_TOKEN` | — | Bearer token — `SIRR_MASTER_KEY` for full access, or a principal key for org-scoped access |
109
+ | `SIRR_ORG` | — | Organization ID for multi-tenant mode. When set, all secret/audit/webhook/prune paths are prefixed with `/orgs/{id}/`. Leave unset for single-tenant usage. |
100
110
 
101
111
  ## CLI flags
102
112
 
@@ -116,8 +126,10 @@ SIRR_SERVER=http://localhost:39999 SIRR_TOKEN=mykey sirr-mcp --health
116
126
 
117
127
  | Tool | Description |
118
128
  |---|---|
129
+ | `check_secret(key)` | Check if a secret exists and inspect its metadata — **without consuming a read** |
119
130
  | `get_secret(key)` | Retrieve a secret value (increments read counter; burns if max_reads reached) |
120
- | `push_secret(key, value, ttl_seconds?, max_reads?)` | Store a secret with optional expiry and read limit |
131
+ | `push_secret(key, value, ttl_seconds?, max_reads?, delete?)` | Store a secret with optional expiry, read limit, and seal behavior |
132
+ | `patch_secret(key, value?, ttl_seconds?, max_reads?)` | Update an existing secret's value, TTL, or read limit |
121
133
  | `list_secrets()` | List all active secrets — metadata only, values never returned |
122
134
  | `delete_secret(key)` | Burn a secret immediately, regardless of TTL or read count |
123
135
  | `prune_secrets()` | Delete all expired secrets in one sweep |
@@ -127,7 +139,7 @@ SIRR_SERVER=http://localhost:39999 SIRR_TOKEN=mykey sirr-mcp --health
127
139
 
128
140
  | Tool | Description |
129
141
  |---|---|
130
- | `sirr_audit(since?, action?, limit?)` | Query the audit log — secret creates, reads, deletes, and key events |
142
+ | `sirr_audit(since?, until?, action?, limit?)` | Query the audit log — secret creates, reads, deletes, and key events |
131
143
 
132
144
  ### Webhooks
133
145
 
@@ -137,13 +149,44 @@ SIRR_SERVER=http://localhost:39999 SIRR_TOKEN=mykey sirr-mcp --health
137
149
  | `sirr_webhook_list()` | List all registered webhooks (signing secrets redacted) |
138
150
  | `sirr_webhook_delete(id)` | Remove a webhook by ID |
139
151
 
140
- ### API keys
152
+ ### Principal keys
153
+
154
+ | Tool | Description |
155
+ |---|---|
156
+ | `sirr_key_list()` | List all API keys for the current principal |
157
+ | `sirr_create_key(name, valid_for_seconds?, valid_before?)` | Create a new API key; raw key returned once — save it |
158
+ | `sirr_delete_key(keyId)` | Revoke an API key by ID |
159
+
160
+ ### Account (principal-scoped)
161
+
162
+ | Tool | Description |
163
+ |---|---|
164
+ | `sirr_me()` | Get the current principal's profile, role, and key list |
165
+ | `sirr_update_me(metadata)` | Replace the current principal's metadata |
166
+
167
+ ### Organizations
168
+
169
+ | Tool | Description |
170
+ |---|---|
171
+ | `sirr_org_create(name, metadata?)` | Create a new organization |
172
+ | `sirr_org_list()` | List all organizations (master key only) |
173
+ | `sirr_org_delete(org_id)` | Delete an organization — must have no principals |
174
+
175
+ ### Principals
176
+
177
+ | Tool | Description |
178
+ |---|---|
179
+ | `sirr_principal_create(org_id, name, role, metadata?)` | Create a principal (user or service account) in an org |
180
+ | `sirr_principal_list(org_id)` | List all principals in an org |
181
+ | `sirr_principal_delete(org_id, principal_id)` | Delete a principal — must have no active keys |
182
+
183
+ ### Roles
141
184
 
142
185
  | Tool | Description |
143
186
  |---|---|
144
- | `sirr_key_create(label, permissions, prefix?)` | Create a scoped API key; raw key returned once save it |
145
- | `sirr_key_list()` | List all scoped API keys (key hashes never returned) |
146
- | `sirr_key_delete(id)` | Delete an API key by ID |
187
+ | `sirr_role_create(org_id, name, permissions)` | Create a custom role. Permissions: C=create R=read P=patch D=delete L=list M=manage A=admin |
188
+ | `sirr_role_list(org_id)` | List all roles in an org (built-in and custom) |
189
+ | `sirr_role_delete(org_id, role_name)` | Delete a custom role must not be in use |
147
190
 
148
191
  ## Inline secret references
149
192
 
@@ -156,6 +199,19 @@ You can reference secrets inline in any prompt:
156
199
 
157
200
  The `sirr:KEYNAME` prefix tells Claude to fetch from the vault automatically.
158
201
 
202
+ ## Secret lifecycle
203
+
204
+ Sirr secrets expire by design. The `push_secret` tool lets you control exactly how:
205
+
206
+ | Option | Behavior |
207
+ |---|---|
208
+ | `ttl_seconds: 3600` | Secret expires after 1 hour, regardless of reads |
209
+ | `max_reads: 1` | Secret is deleted after the first read |
210
+ | `max_reads: 5, delete: false` | After 5 reads the secret is **sealed** (returns 410, stays in DB) instead of deleted |
211
+ | No options | Secret persists until explicitly deleted |
212
+
213
+ Use `check_secret` to inspect a secret's status without consuming a read — useful when you want to verify a secret is still available before fetching it.
214
+
159
215
  ## Security notes
160
216
 
161
217
  - Claude only sees secret **values** when you explicitly ask it to fetch via `get_secret`
@@ -169,9 +225,10 @@ The `sirr:KEYNAME` prefix tells Claude to fetch from the vault automatically.
169
225
 
170
226
  | Symptom | Cause | Fix |
171
227
  |---|---|---|
172
- | `Error: Sirr 401` | `SIRR_TOKEN` doesn't match `SIRR_MASTER_KEY` | Verify both values match exactly — no extra spaces or newlines. [sirr.dev/errors#401](https://sirr.dev/errors#401) |
173
- | `Error: Sirr 402` | Free-tier limit of 100 secrets reached | Delete unused secrets or add a `SIRR_LICENSE_KEY`. [sirr.dev/errors#402](https://sirr.dev/errors#402) |
174
- | `Error: Sirr 403` | Scoped API key lacks the required permission | Re-create the key with the needed permissions. [sirr.dev/errors#403](https://sirr.dev/errors#403) |
228
+ | `Error: Sirr 401` | `SIRR_TOKEN` doesn't match server key | Verify both values match exactly — no extra spaces or newlines. [sirr.dev/errors#401](https://sirr.dev/errors#401) |
229
+ | `Error: Sirr 402` | Free-tier limit reached | Delete unused secrets or upgrade. [sirr.dev/errors#402](https://sirr.dev/errors#402) |
230
+ | `Error: Sirr 403` | Token lacks the required permission | Use a token with the needed scope. [sirr.dev/errors#403](https://sirr.dev/errors#403) |
231
+ | `Error: Sirr 409` | Resource has dependencies | Remove dependents first (e.g. delete principals before org). [sirr.dev/errors#409](https://sirr.dev/errors#409) |
175
232
  | `Secret '…' not found` | Secret expired, was burned, or key was mistyped | Re-push the secret if you still need it. [sirr.dev/errors#404](https://sirr.dev/errors#404) |
176
233
  | `did not respond within 10s` | Sirr server is unreachable | Check `SIRR_SERVER` URL and confirm Sirr is running (`sirr-mcp --health`). |
177
234
  | `[sirr-mcp] Warning: SIRR_TOKEN is not set` | Token missing from MCP config | Add `SIRR_TOKEN` to the `env` block in `.mcp.json`. |
package/dist/helpers.d.ts CHANGED
@@ -8,6 +8,10 @@
8
8
  * "KEYNAME" → "KEYNAME"
9
9
  */
10
10
  export declare function parseKeyRef(ref: string): string;
11
+ export declare function secretsPath(key?: string): string;
12
+ export declare function auditPath(): string;
13
+ export declare function webhooksPath(id?: string): string;
14
+ export declare function prunePath(): string;
11
15
  /**
12
16
  * Format a Unix timestamp (seconds) as a human-readable TTL string
13
17
  * relative to now. Returns "no expiry" for null, "expired" for past timestamps.
package/dist/helpers.js CHANGED
@@ -4,6 +4,10 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseKeyRef = parseKeyRef;
7
+ exports.secretsPath = secretsPath;
8
+ exports.auditPath = auditPath;
9
+ exports.webhooksPath = webhooksPath;
10
+ exports.prunePath = prunePath;
7
11
  exports.formatTtl = formatTtl;
8
12
  /**
9
13
  * Parse a secret key reference from natural language.
@@ -18,6 +22,25 @@ function parseKeyRef(ref) {
18
22
  return ref.split("#")[0];
19
23
  return ref.trim();
20
24
  }
25
+ // ── Org-aware path helpers ────────────────────────────────────────────────────
26
+ function secretsPath(key) {
27
+ const org = process.env.SIRR_ORG;
28
+ const base = org ? `/orgs/${org}/secrets` : '/secrets';
29
+ return key ? `${base}/${key}` : base;
30
+ }
31
+ function auditPath() {
32
+ const org = process.env.SIRR_ORG;
33
+ return org ? `/orgs/${org}/audit` : '/audit';
34
+ }
35
+ function webhooksPath(id) {
36
+ const org = process.env.SIRR_ORG;
37
+ const base = org ? `/orgs/${org}/webhooks` : '/webhooks';
38
+ return id ? `${base}/${id}` : base;
39
+ }
40
+ function prunePath() {
41
+ const org = process.env.SIRR_ORG;
42
+ return org ? `/orgs/${org}/prune` : '/prune';
43
+ }
21
44
  /**
22
45
  * Format a Unix timestamp (seconds) as a human-readable TTL string
23
46
  * relative to now. Returns "no expiry" for null, "expired" for past timestamps.
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAQH,kCAIC;AAMD,8BASC;AAzBD;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjD,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC;IACjD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,SAAwB;IAChD,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,WAAW,CAAC;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,SAAS,GAAG,GAAG,CAAC;IAC7B,IAAI,IAAI,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAChC,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,GAAG,CAAC;IACjC,IAAI,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC;IACpD,IAAI,IAAI,GAAG,KAAK;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;IACvD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC;AACxC,CAAC"}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.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AS;IACvB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IACjC,OAAO,GAAG,CAAC,CAAC,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,SAAwB;IAChD,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,WAAW,CAAC;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,SAAS,GAAG,GAAG,CAAC;IAC7B,IAAI,IAAI,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAChC,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,GAAG,CAAC;IACjC,IAAI,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC;IACpD,IAAI,IAAI,GAAG,KAAK;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;IACvD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC;AACxC,CAAC"}
@@ -22,6 +22,74 @@ const helpers_1 = require("./helpers");
22
22
  (0, globals_1.expect)((0, helpers_1.parseKeyRef)("KEY#a#b")).toBe("KEY");
23
23
  });
24
24
  });
25
+ (0, globals_1.describe)("secretsPath", () => {
26
+ (0, globals_1.afterEach)(() => {
27
+ delete process.env.SIRR_ORG;
28
+ });
29
+ (0, globals_1.it)("returns /secrets without SIRR_ORG", () => {
30
+ delete process.env.SIRR_ORG;
31
+ (0, globals_1.expect)((0, helpers_1.secretsPath)()).toBe("/secrets");
32
+ });
33
+ (0, globals_1.it)("returns /secrets/{key} without SIRR_ORG", () => {
34
+ delete process.env.SIRR_ORG;
35
+ (0, globals_1.expect)((0, helpers_1.secretsPath)("MY_KEY")).toBe("/secrets/MY_KEY");
36
+ });
37
+ (0, globals_1.it)("returns /orgs/{org}/secrets with SIRR_ORG", () => {
38
+ process.env.SIRR_ORG = "acme";
39
+ (0, globals_1.expect)((0, helpers_1.secretsPath)()).toBe("/orgs/acme/secrets");
40
+ });
41
+ (0, globals_1.it)("returns /orgs/{org}/secrets/{key} with SIRR_ORG", () => {
42
+ process.env.SIRR_ORG = "acme";
43
+ (0, globals_1.expect)((0, helpers_1.secretsPath)("MY_KEY")).toBe("/orgs/acme/secrets/MY_KEY");
44
+ });
45
+ });
46
+ (0, globals_1.describe)("auditPath", () => {
47
+ (0, globals_1.afterEach)(() => {
48
+ delete process.env.SIRR_ORG;
49
+ });
50
+ (0, globals_1.it)("returns /audit without SIRR_ORG", () => {
51
+ delete process.env.SIRR_ORG;
52
+ (0, globals_1.expect)((0, helpers_1.auditPath)()).toBe("/audit");
53
+ });
54
+ (0, globals_1.it)("returns /orgs/{org}/audit with SIRR_ORG", () => {
55
+ process.env.SIRR_ORG = "acme";
56
+ (0, globals_1.expect)((0, helpers_1.auditPath)()).toBe("/orgs/acme/audit");
57
+ });
58
+ });
59
+ (0, globals_1.describe)("webhooksPath", () => {
60
+ (0, globals_1.afterEach)(() => {
61
+ delete process.env.SIRR_ORG;
62
+ });
63
+ (0, globals_1.it)("returns /webhooks without SIRR_ORG", () => {
64
+ delete process.env.SIRR_ORG;
65
+ (0, globals_1.expect)((0, helpers_1.webhooksPath)()).toBe("/webhooks");
66
+ });
67
+ (0, globals_1.it)("returns /webhooks/{id} without SIRR_ORG", () => {
68
+ delete process.env.SIRR_ORG;
69
+ (0, globals_1.expect)((0, helpers_1.webhooksPath)("wh_123")).toBe("/webhooks/wh_123");
70
+ });
71
+ (0, globals_1.it)("returns /orgs/{org}/webhooks with SIRR_ORG", () => {
72
+ process.env.SIRR_ORG = "acme";
73
+ (0, globals_1.expect)((0, helpers_1.webhooksPath)()).toBe("/orgs/acme/webhooks");
74
+ });
75
+ (0, globals_1.it)("returns /orgs/{org}/webhooks/{id} with SIRR_ORG", () => {
76
+ process.env.SIRR_ORG = "acme";
77
+ (0, globals_1.expect)((0, helpers_1.webhooksPath)("wh_123")).toBe("/orgs/acme/webhooks/wh_123");
78
+ });
79
+ });
80
+ (0, globals_1.describe)("prunePath", () => {
81
+ (0, globals_1.afterEach)(() => {
82
+ delete process.env.SIRR_ORG;
83
+ });
84
+ (0, globals_1.it)("returns /prune without SIRR_ORG", () => {
85
+ delete process.env.SIRR_ORG;
86
+ (0, globals_1.expect)((0, helpers_1.prunePath)()).toBe("/prune");
87
+ });
88
+ (0, globals_1.it)("returns /orgs/{org}/prune with SIRR_ORG", () => {
89
+ process.env.SIRR_ORG = "acme";
90
+ (0, globals_1.expect)((0, helpers_1.prunePath)()).toBe("/orgs/acme/prune");
91
+ });
92
+ });
25
93
  (0, globals_1.describe)("formatTtl", () => {
26
94
  const realDateNow = Date.now;
27
95
  (0, globals_1.beforeEach)(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.test.js","sourceRoot":"","sources":["../src/helpers.test.ts"],"names":[],"mappings":";;AAAA,2CAAkF;AAClF,uCAAmD;AAEnD,IAAA,kBAAQ,EAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAA,YAAE,EAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,IAAA,gBAAM,EAAC,IAAA,qBAAW,EAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,IAAA,gBAAM,EAAC,IAAA,qBAAW,EAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,IAAA,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AAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,IAAA,gBAAM,EAAC,IAAA,mBAAS,EAAC,OAAS,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAA,gBAAM,EAAC,IAAA,mBAAS,EAAC,OAAS,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,IAAA,gBAAM,EAAC,IAAA,mBAAS,EAAC,OAAS,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,IAAA,gBAAM,EAAC,IAAA,mBAAS,EAAC,OAAS,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Configuration (env vars):
8
8
  * SIRR_SERVER — Sirr server URL (default: http://localhost:39999)
9
- * SIRR_TOKEN — Bearer token (SIRR_MASTER_KEY on the server)
9
+ * SIRR_TOKEN — Bearer token: SIRR_MASTER_KEY for full access, or a principal key for org-scoped access
10
10
  *
11
11
  * Install: npm install -g @sirrlock/mcp
12
12
  * Configure in .mcp.json: