@seekrit/mcp 0.4.0 → 0.5.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/dist/index.js +93 -5
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -664,7 +664,7 @@ function isServiceToken(value) {
|
|
|
664
664
|
}
|
|
665
665
|
//#endregion
|
|
666
666
|
//#region ../cli/package.json
|
|
667
|
-
var version$1 = "0.
|
|
667
|
+
var version$1 = "0.23.0";
|
|
668
668
|
const PROJECT_FILE = "seekrit.json";
|
|
669
669
|
function globalConfigPath() {
|
|
670
670
|
return join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "seekrit", "config.json");
|
|
@@ -726,13 +726,16 @@ var SeekritClient = class {
|
|
|
726
726
|
baseUrl;
|
|
727
727
|
auth;
|
|
728
728
|
fetchImpl;
|
|
729
|
+
client;
|
|
729
730
|
constructor(options) {
|
|
730
731
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
731
732
|
this.auth = options.auth;
|
|
732
733
|
this.fetchImpl = options.fetch ?? ((...args) => fetch(...args));
|
|
734
|
+
this.client = options.client;
|
|
733
735
|
}
|
|
734
736
|
async request(method, path, body) {
|
|
735
737
|
const headers = { accept: "application/json" };
|
|
738
|
+
if (this.client) headers["x-seekrit-client"] = this.client;
|
|
736
739
|
if (this.auth.type === "bearer") headers.authorization = `Bearer ${this.auth.token}`;
|
|
737
740
|
else if (this.auth.type === "dynamic") {
|
|
738
741
|
const token = await this.auth.getToken();
|
|
@@ -992,6 +995,10 @@ var SeekritClient = class {
|
|
|
992
995
|
disableKmsKey(orgId, keyId) {
|
|
993
996
|
return this.request("POST", `/v1/orgs/${orgId}/kms/keys/${keyId}/disable`);
|
|
994
997
|
}
|
|
998
|
+
/** Soft-delete a key: it drops out of every listing and read path. */
|
|
999
|
+
deleteKmsKey(orgId, keyId) {
|
|
1000
|
+
return this.request("DELETE", `/v1/orgs/${orgId}/kms/keys/${keyId}`);
|
|
1001
|
+
}
|
|
995
1002
|
/** The broker's public key — wrap the admin credential to it before registering a target. */
|
|
996
1003
|
getLeaseBrokerKey(orgId) {
|
|
997
1004
|
return this.request("GET", `/v1/orgs/${orgId}/leases/broker-key`);
|
|
@@ -1108,6 +1115,8 @@ function promptHidden(question) {
|
|
|
1108
1115
|
}
|
|
1109
1116
|
//#endregion
|
|
1110
1117
|
//#region ../cli/src/context.ts
|
|
1118
|
+
/** Sent as `x-seekrit-client` so the API attributes usage to the CLI (analytics). */
|
|
1119
|
+
const CLI_CLIENT = `cli/${version$1}`;
|
|
1111
1120
|
/**
|
|
1112
1121
|
* Build the client context from configured credentials, or return null when
|
|
1113
1122
|
* none are set. `seekrit run` uses this to degrade to a plain launcher instead
|
|
@@ -1138,7 +1147,8 @@ function tryBuildContext(dotenvVars = {}) {
|
|
|
1138
1147
|
return {
|
|
1139
1148
|
client: new SeekritClient({
|
|
1140
1149
|
baseUrl: apiUrl,
|
|
1141
|
-
auth
|
|
1150
|
+
auth,
|
|
1151
|
+
client: CLI_CLIENT
|
|
1142
1152
|
}),
|
|
1143
1153
|
auth
|
|
1144
1154
|
};
|
|
@@ -1349,7 +1359,8 @@ async function mintAdminToken(apiUrl, creds) {
|
|
|
1349
1359
|
type: "m2m",
|
|
1350
1360
|
clientId: creds.clientId,
|
|
1351
1361
|
clientSecret: creds.clientSecret
|
|
1352
|
-
}
|
|
1362
|
+
},
|
|
1363
|
+
client: `cli/${version$1}`
|
|
1353
1364
|
});
|
|
1354
1365
|
const { orgs } = await client.listOrgs();
|
|
1355
1366
|
const org = orgs[0];
|
|
@@ -1505,6 +1516,74 @@ function errText(err) {
|
|
|
1505
1516
|
isError: true
|
|
1506
1517
|
};
|
|
1507
1518
|
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Short primer surfaced as the MCP server `instructions`. Most clients show
|
|
1521
|
+
* this to the model on connect, so it has to orient an agent that lands here
|
|
1522
|
+
* with zero context in a few lines.
|
|
1523
|
+
*/
|
|
1524
|
+
function serverInstructions() {
|
|
1525
|
+
return [
|
|
1526
|
+
"seekrit is a zero-knowledge secrets manager. This is the LOCAL CRYPTO plane —",
|
|
1527
|
+
"it runs on this machine, next to your key, so it's the one server that can",
|
|
1528
|
+
"actually read or write a secret VALUE (everything else can only see structure).",
|
|
1529
|
+
"",
|
|
1530
|
+
"Auth comes from SEEKRIT_TOKEN (a skt_… token), SEEKRIT_CLIENT_ID +",
|
|
1531
|
+
"SEEKRIT_CLIENT_SECRET (machine credentials — an admin token is minted and",
|
|
1532
|
+
"cached automatically on first use), or the config saved by `seekrit login`.",
|
|
1533
|
+
"Decrypting under a user session (not a token) additionally needs",
|
|
1534
|
+
"SEEKRIT_PASSPHRASE set in this server's env — there's no TTY to prompt on.",
|
|
1535
|
+
"",
|
|
1536
|
+
"Model: org → apps/groups → environments → secrets. Call `whoami` first, then",
|
|
1537
|
+
"`get_started` for the recommended end-to-end recipe. Prefer `run_command` over",
|
|
1538
|
+
"`get_secret reveal:true` — it injects secrets into a subprocess so plaintext",
|
|
1539
|
+
"never enters your context or the transcript."
|
|
1540
|
+
].join("\n");
|
|
1541
|
+
}
|
|
1542
|
+
/** The `get_started` tool body: the recommended first-project flow end to end. */
|
|
1543
|
+
function getStartedText() {
|
|
1544
|
+
return [
|
|
1545
|
+
"# Standing up a project with seekrit (agent, end to end)",
|
|
1546
|
+
"",
|
|
1547
|
+
"This server is the crypto plane — every step below runs locally, next to your",
|
|
1548
|
+
"key, so secret values never leave this machine.",
|
|
1549
|
+
"",
|
|
1550
|
+
"## 1. Confirm identity",
|
|
1551
|
+
"`whoami` — see who you're authenticated as and which orgs you can reach. If it",
|
|
1552
|
+
"fails, check SEEKRIT_TOKEN / SEEKRIT_CLIENT_ID+SEEKRIT_CLIENT_SECRET / saved",
|
|
1553
|
+
"login in this server's env.",
|
|
1554
|
+
"",
|
|
1555
|
+
"## 2. Provision structure",
|
|
1556
|
+
"- `create_org` (user session only — a service token can't own one) if you",
|
|
1557
|
+
" don't have one yet, otherwise skip to the next step.",
|
|
1558
|
+
"- `create_app` — an application to hold environments.",
|
|
1559
|
+
"- `create_env` — generates the data key on this machine and grants it to you.",
|
|
1560
|
+
"- `create_group` + `compose_group` (optional) — a reusable secret bag layered",
|
|
1561
|
+
" under one or more app environments.",
|
|
1562
|
+
"",
|
|
1563
|
+
"## 3. Store secrets",
|
|
1564
|
+
"- `set_secret` — encrypts a value locally and stores the ciphertext.",
|
|
1565
|
+
"- `list_secrets` — confirm names + versions (never returns values).",
|
|
1566
|
+
"",
|
|
1567
|
+
"## 4. Use secrets without exposing them",
|
|
1568
|
+
"- `run_command -- <cmd>` — inject secrets into a subprocess; prefer this.",
|
|
1569
|
+
"- `export_env` — materialize a `.env` file when a tool needs one on disk.",
|
|
1570
|
+
"- `get_secret reveal:true` — only when the value itself is what's needed.",
|
|
1571
|
+
"",
|
|
1572
|
+
"## 5. Propagate access",
|
|
1573
|
+
"- `create_token` bound to an app+env — a runtime credential for CI/another",
|
|
1574
|
+
" agent to decrypt with (pass `admin:true` instead for a provisioning token).",
|
|
1575
|
+
"- `grant_env` — give another member or token access to an env's data key.",
|
|
1576
|
+
"- `configure_project` — link a directory to an org/app (writes seekrit.json)",
|
|
1577
|
+
" so a bound token can infer its target without flags.",
|
|
1578
|
+
"",
|
|
1579
|
+
"## 6. Verify",
|
|
1580
|
+
"`audit` — every write, grant, and revocation is recorded; read it back.",
|
|
1581
|
+
"",
|
|
1582
|
+
"Also available: `kms_*` (client-side managed encrypt/sign keys) and",
|
|
1583
|
+
"`create_pg_lease`/`create_mysql_lease` (short-lived database credentials whose",
|
|
1584
|
+
"password is generated here and never stored anywhere in plaintext)."
|
|
1585
|
+
].join("\n");
|
|
1586
|
+
}
|
|
1508
1587
|
/** Build the client context or throw a friendly, agent-readable error. */
|
|
1509
1588
|
function getCtx() {
|
|
1510
1589
|
const ctx = tryBuildContext();
|
|
@@ -1600,7 +1679,7 @@ async function runMcpServer(options = {}) {
|
|
|
1600
1679
|
const server = new McpServer({
|
|
1601
1680
|
name: "seekrit",
|
|
1602
1681
|
version: options.version ?? version$1
|
|
1603
|
-
});
|
|
1682
|
+
}, { instructions: serverInstructions() });
|
|
1604
1683
|
/** Register a tool whose handler returns data (serialized) or throws (→ isError). */
|
|
1605
1684
|
const tool = (name, description, shape, handler) => {
|
|
1606
1685
|
server.registerTool(name, {
|
|
@@ -1614,6 +1693,15 @@ async function runMcpServer(options = {}) {
|
|
|
1614
1693
|
}
|
|
1615
1694
|
}));
|
|
1616
1695
|
};
|
|
1696
|
+
server.registerTool("get_started", {
|
|
1697
|
+
description: "The recommended first-project recipe: provision structure, store secrets, and use them without exposing values. Call this before doing anything else.",
|
|
1698
|
+
inputSchema: {},
|
|
1699
|
+
annotations: {
|
|
1700
|
+
title: "get_started",
|
|
1701
|
+
readOnlyHint: true,
|
|
1702
|
+
openWorldHint: false
|
|
1703
|
+
}
|
|
1704
|
+
}, async () => jsonText(getStartedText()));
|
|
1617
1705
|
tool("whoami", "Show the authenticated identity, its role, and accessible orgs.", {}, async () => {
|
|
1618
1706
|
const ctx = getCtx();
|
|
1619
1707
|
if (isTokenAuth(ctx) && ctx.auth.type === "bearer") {
|
|
@@ -2314,7 +2402,7 @@ async function runMcpServer(options = {}) {
|
|
|
2314
2402
|
* `seekrit mcp`. tsdown bundles the shared server source in at build time, so the
|
|
2315
2403
|
* published package is self-contained and needs no `@seekrit/cli` install.
|
|
2316
2404
|
*/
|
|
2317
|
-
runMcpServer({ version: "0.
|
|
2405
|
+
runMcpServer({ version: "0.5.0" }).catch((err) => {
|
|
2318
2406
|
const message = err instanceof Error ? err.message : String(err);
|
|
2319
2407
|
process.stderr.write(`seekrit-mcp: fatal: ${message}\n`);
|
|
2320
2408
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seekrit/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "npx-able MCP server for seekrit — let Claude Code and other MCP clients provision, manage, and inject end-to-end encrypted secrets.",
|
|
5
|
+
"mcpName": "dev.seekrit/mcp",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"publishConfig": {
|
|
7
8
|
"access": "public"
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/node": "^26.1.0",
|
|
24
25
|
"tsdown": "^0.22.3",
|
|
25
|
-
"@seekrit/cli": "0.
|
|
26
|
+
"@seekrit/cli": "0.23.0"
|
|
26
27
|
},
|
|
27
28
|
"scripts": {
|
|
28
29
|
"build": "tsdown",
|