@truecalc/mcp-local 1.0.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/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @truecalc/mcp-local
2
+
3
+ Run **TrueCalc Local** — a native MCP server exposing TrueCalc's spreadsheet
4
+ document engine (read/edit cells, formulas, formatting, charts, pivots, and
5
+ more, over 70 tools) — with no install step:
6
+
7
+ ```sh
8
+ npx -y @truecalc/mcp-local
9
+ ```
10
+
11
+ This package is a thin wrapper: `npx` resolves it, its `optionalDependencies`
12
+ bring in the prebuilt `truecalc-mcp-local` binary for your OS/CPU
13
+ (`@truecalc/mcp-local-darwin-arm64`, `@truecalc/mcp-local-darwin-x64`,
14
+ `@truecalc/mcp-local-linux-x64`, `@truecalc/mcp-local-win32-x64`), and the
15
+ `truecalc-mcp-local` bin script execs it with stdio inherited. The server
16
+ itself is the same Rust `mcp-server` binary built from
17
+ [truecalc/pro](https://github.com/truecalc/pro) — one implementation, no
18
+ second copy of tool behavior to keep in sync.
19
+
20
+ **This is a paid product ($49, one-time license).** The binary gates every
21
+ tool call except `license:activate` behind a valid, locally-cached license —
22
+ see `license:activate` in the parent repo's README for the full activation,
23
+ device-binding, and re-validation flow. Buy a key at
24
+ <https://buy.polar.sh/polar_cl_n4cNoheqSQgeTpENhUaWOVzTA3ENvI1jkNhzC2fY6fS>
25
+ (the same URL `mcp-server` itself points an unlicensed caller at —
26
+ `TRUECALC_CHECKOUT_URL`'s default in `src/commands/license/gate.rs`).
27
+
28
+ ## MCP client configuration
29
+
30
+ Add this to your client's MCP server config (e.g. Claude Desktop's
31
+ `claude_desktop_config.json`):
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "truecalc-local": {
37
+ "command": "npx",
38
+ "args": ["-y", "@truecalc/mcp-local"]
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ Restart the client, then call the `license:activate` tool with your license
45
+ key before using any other tool.
46
+
47
+ ## Supported platforms
48
+
49
+ macOS (arm64, x64), Linux (x64), Windows (x64). Linux arm64 is a planned
50
+ fast-follow, not yet published. On an unsupported platform, running
51
+ `npx -y @truecalc/mcp-local` prints an actionable error naming the platforms
52
+ that are supported instead of failing silently or with a stack trace.
53
+
54
+ ## Learn more
55
+
56
+ - [truecalc/pro](https://github.com/truecalc/pro) — full tool documentation,
57
+ the MCP server's design, and `cargo build --release --bin mcp-server` for
58
+ building from source.
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const fs = require("node:fs");
6
+ const { spawnSync } = require("node:child_process");
7
+ const { resolveTarget } = require("../lib/resolve.js");
8
+
9
+ // Resolves the on-disk path to the platform binary. `pkgName` only ever comes
10
+ // from the fixed PLATFORM_PACKAGES map in lib/resolve.js (never from argv or
11
+ // the environment), so require.resolve here can't be steered by untrusted
12
+ // input — it either finds the real optionalDependency package or it doesn't.
13
+ function resolveBinaryPath(platform, arch) {
14
+ const { pkgName, binName } = resolveTarget(platform, arch);
15
+
16
+ let pkgJsonPath;
17
+ try {
18
+ pkgJsonPath = require.resolve(`${pkgName}/package.json`);
19
+ } catch {
20
+ throw new Error(
21
+ `@truecalc/mcp-local could not find its optional dependency '${pkgName}'.\n` +
22
+ "npm likely skipped installing it (e.g. --omit=optional, --no-optional, " +
23
+ "or an npm/yarn/pnpm version that mishandles OS/CPU-scoped optionalDependencies).\n" +
24
+ "Reinstall with optional dependencies included: npm install --include=optional @truecalc/mcp-local",
25
+ );
26
+ }
27
+
28
+ const binaryPath = path.join(path.dirname(pkgJsonPath), "bin", binName);
29
+ if (!fs.existsSync(binaryPath)) {
30
+ throw new Error(`@truecalc/mcp-local found '${pkgName}' but its binary is missing at ${binaryPath}.`);
31
+ }
32
+ return binaryPath;
33
+ }
34
+
35
+ function main() {
36
+ let binaryPath;
37
+ try {
38
+ binaryPath = resolveBinaryPath(process.platform, process.arch);
39
+ } catch (err) {
40
+ process.stderr.write(`${err.message}\n`);
41
+ process.exitCode = 1;
42
+ return;
43
+ }
44
+
45
+ // spawnSync with an argv array and no `shell: true`: process.argv and the
46
+ // resolved binary path are passed as discrete arguments to execve, never
47
+ // interpolated into a shell command line, so nothing in either can inject
48
+ // a second command. stdio is inherited because MCP speaks JSON-RPC over
49
+ // stdio — this process is a transparent relay for stdin/stdout/stderr, and
50
+ // license:activate's own network/filesystem calls happen unmodified inside
51
+ // the real binary, not this launcher.
52
+ const result = spawnSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
53
+ if (result.error) {
54
+ process.stderr.write(`@truecalc/mcp-local failed to start ${binaryPath}: ${result.error.message}\n`);
55
+ process.exitCode = 1;
56
+ return;
57
+ }
58
+ // null status means the child was killed by a signal; propagate a non-zero
59
+ // exit rather than silently reporting success.
60
+ process.exitCode = result.status === null ? 1 : result.status;
61
+ }
62
+
63
+ main();
package/lib/resolve.js ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ // Maps Node's own process.platform/process.arch values to the npm platform
4
+ // package that ships the matching truecalc-mcp-local (core-pro) binary. Keys
5
+ // use Node's naming exactly ('arm64', 'x64', 'darwin', 'win32', 'linux') —
6
+ // NOT the Rust target triple's naming ('aarch64', 'x86_64') — because
7
+ // process.arch/process.platform are what this shim actually receives at
8
+ // runtime.
9
+ //
10
+ // Four platforms at launch (darwin-arm64, darwin-x64, linux-x64, win32-x64).
11
+ // linux-arm64 is a deliberate fast-follow, not an oversight — see the
12
+ // release workflow's own comment and the wrapper README for the same note.
13
+ const PLATFORM_PACKAGES = {
14
+ "darwin-arm64": "@truecalc/mcp-local-darwin-arm64",
15
+ "darwin-x64": "@truecalc/mcp-local-darwin-x64",
16
+ "linux-x64": "@truecalc/mcp-local-linux-x64",
17
+ "win32-x64": "@truecalc/mcp-local-win32-x64",
18
+ };
19
+
20
+ const SUPPORTED = Object.keys(PLATFORM_PACKAGES).sort();
21
+
22
+ // Pure function: given (platform, arch), return which platform package and
23
+ // binary filename it maps to, or throw a clear, actionable error. No
24
+ // filesystem or require.resolve calls here — that's what makes it testable
25
+ // with mocked process.platform/process.arch values.
26
+ function resolveTarget(platform, arch) {
27
+ const key = `${platform}-${arch}`;
28
+ const pkgName = PLATFORM_PACKAGES[key];
29
+ if (!pkgName) {
30
+ throw new Error(
31
+ `@truecalc/mcp-local does not support ${platform}/${arch}.\n` +
32
+ `Supported platforms: ${SUPPORTED.join(", ")}.\n` +
33
+ (platform === "linux" && arch === "arm64"
34
+ ? "linux/arm64 is a planned fast-follow, not yet published.\n"
35
+ : "") +
36
+ "Build truecalc-core-pro's mcp-server from source instead: https://github.com/truecalc/pro",
37
+ );
38
+ }
39
+ const binName = platform === "win32" ? "truecalc-mcp-local.exe" : "truecalc-mcp-local";
40
+ return { pkgName, binName };
41
+ }
42
+
43
+ module.exports = { resolveTarget, PLATFORM_PACKAGES };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@truecalc/mcp-local",
3
+ "version": "1.0.0",
4
+ "description": "TrueCalc Local — a native MCP server exposing TrueCalc's spreadsheet document engine (read/edit cells, formulas, formatting, charts, pivots, and more) as MCP tools over stdio. Paid, one-time-license product; run via npx.",
5
+ "license": "LicenseRef-proprietary",
6
+ "homepage": "https://buy.polar.sh/polar_cl_n4cNoheqSQgeTpENhUaWOVzTA3ENvI1jkNhzC2fY6fS",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/truecalc/pro",
10
+ "directory": "npm/wrapper"
11
+ },
12
+ "keywords": [
13
+ "mcp",
14
+ "model-context-protocol",
15
+ "spreadsheet",
16
+ "truecalc",
17
+ "ai",
18
+ "claude"
19
+ ],
20
+ "bin": {
21
+ "truecalc-mcp-local": "bin/truecalc-mcp-local.js"
22
+ },
23
+ "files": [
24
+ "bin",
25
+ "lib"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "optionalDependencies": {
31
+ "@truecalc/mcp-local-darwin-arm64": "1.0.0",
32
+ "@truecalc/mcp-local-darwin-x64": "1.0.0",
33
+ "@truecalc/mcp-local-linux-x64": "1.0.0",
34
+ "@truecalc/mcp-local-win32-x64": "1.0.0"
35
+ },
36
+ "scripts": {
37
+ "test": "node --test"
38
+ }
39
+ }