apple-tools-mcp 3.2.0 → 3.2.2
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/lib/httpAuth.js +6 -14
- package/lib/keychainWrite.js +17 -0
- package/package.json +8 -3
package/lib/httpAuth.js
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* a bearer token.
|
|
9
9
|
*
|
|
10
10
|
* The token is a random secret generated once and stored in the macOS
|
|
11
|
-
* Keychain — never in a config file, the repo, or logs
|
|
12
|
-
*
|
|
11
|
+
* Keychain — never in a config file, the repo, argv, or logs.
|
|
12
|
+
* Print it only with the explicit http-token command. There is no external account, no
|
|
13
13
|
* OAuth flow, and no cost: it's a self-issued password, like an SSH key.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import crypto from "crypto";
|
|
17
|
+
import { writeKeychainSecret } from "./keychainWrite.js";
|
|
17
18
|
import { execFileSync as defaultExecFileSync } from "child_process";
|
|
18
19
|
|
|
19
20
|
export const KEYCHAIN_SERVICE = "apple-tools-mcp-http";
|
|
@@ -34,11 +35,7 @@ function readFromKeychain(exec) {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
function writeToKeychain(exec, token) {
|
|
37
|
-
exec
|
|
38
|
-
"/usr/bin/security",
|
|
39
|
-
["add-generic-password", "-s", KEYCHAIN_SERVICE, "-a", KEYCHAIN_ACCOUNT, "-w", token, "-U"],
|
|
40
|
-
{ stdio: ["ignore", "ignore", "pipe"] }
|
|
41
|
-
);
|
|
38
|
+
writeKeychainSecret(KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT, token, exec);
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
function generateToken(randomBytes) {
|
|
@@ -71,13 +68,8 @@ export function loadOrCreateHttpAuthToken(options = {}) {
|
|
|
71
68
|
|
|
72
69
|
const token = generateToken(randomBytes);
|
|
73
70
|
writeToKeychain(exec, token);
|
|
74
|
-
log("
|
|
75
|
-
log("
|
|
76
|
-
log(token);
|
|
77
|
-
log("Use this as a Bearer token when configuring remote MCP clients,");
|
|
78
|
-
log("e.g. claude mcp add ... -H \"Authorization: Bearer " + token + "\"");
|
|
79
|
-
log("Retrieve it again later with: apple-tools-mcp http-token");
|
|
80
|
-
log("============================================================");
|
|
71
|
+
log("Generated a new HTTP auth token and stored it in Keychain.");
|
|
72
|
+
log("Retrieve it with: apple-tools-mcp http-token");
|
|
81
73
|
return { token, generated: true };
|
|
82
74
|
}
|
|
83
75
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
/** The security utility parses one stdin line; credential bytes never enter process argv. */
|
|
4
|
+
export function writeKeychainSecret(service, account, value, exec = execFileSync) {
|
|
5
|
+
try {
|
|
6
|
+
const quote = (text) => {
|
|
7
|
+
if (!text || /[\r\n\0]/.test(text)) throw new Error("Invalid Keychain field");
|
|
8
|
+
return '"' + text.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"';
|
|
9
|
+
};
|
|
10
|
+
const command = "add-generic-password -U -s " + quote(service) + " -a " + quote(account) + " -w " + quote(value) + "\n";
|
|
11
|
+
// Apple's interactive command buffer is 4096 bytes. Reject before any truncated write.
|
|
12
|
+
if (Buffer.byteLength(command, "utf8") >= 4095) throw new Error("Keychain field too large");
|
|
13
|
+
exec("/usr/bin/security", ["-i"], { input: command, stdio: ["pipe", "ignore", "ignore"], timeout: 15000 });
|
|
14
|
+
} catch {
|
|
15
|
+
throw new Error("Keychain write failed; credential values omitted.");
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apple-tools-mcp",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "MCP server for semantic search and write actions across Apple Mail, Messages, Calendar, and Contacts. Speaks stdio (local) or bearer-token-authenticated Streamable HTTP (LAN / Tailscale).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -88,17 +88,22 @@
|
|
|
88
88
|
"perf:lancedb": "vitest run tests/perf/lancedb.perf.test.js",
|
|
89
89
|
"perf:background": "vitest run tests/perf/background-indexing.perf.test.js",
|
|
90
90
|
"perf:dates": "vitest run tests/perf/date-parsing.perf.test.js",
|
|
91
|
-
"scan:package": "node scripts/scan-package.js"
|
|
91
|
+
"scan:package": "node scripts/scan-package.js",
|
|
92
|
+
"security:check": "python3 .security/scan.py all",
|
|
93
|
+
"prepublishOnly": "npm run security:check && npm run scan:package"
|
|
92
94
|
},
|
|
93
95
|
"dependencies": {
|
|
94
96
|
"@huggingface/transformers": "^4.3.0",
|
|
95
97
|
"@lancedb/lancedb": "^0.22.3",
|
|
96
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
98
|
+
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
97
99
|
"chrono-node": "^2.9.0"
|
|
98
100
|
},
|
|
99
101
|
"devDependencies": {
|
|
100
102
|
"@vitest/coverage-v8": "^2.1.0",
|
|
101
103
|
"fast-check": "^3.22.0",
|
|
102
104
|
"vitest": "^2.1.0"
|
|
105
|
+
},
|
|
106
|
+
"overrides": {
|
|
107
|
+
"sharp": "^0.35.5"
|
|
103
108
|
}
|
|
104
109
|
}
|