splitwise-mcp 2.0.1 → 2.0.3

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/client.js CHANGED
@@ -4,26 +4,60 @@ import { fileURLToPath } from 'url';
4
4
  try {
5
5
  const { config } = await import('dotenv');
6
6
  const __dirname = dirname(fileURLToPath(import.meta.url));
7
- config({ path: join(__dirname, '..', '.env'), override: false });
7
+ config({ path: join(__dirname, '..', '.env'), override: false, quiet: true });
8
8
  }
9
9
  catch {
10
10
  // not available — rely on process.env (mcpb sets credentials via mcp_config.env)
11
11
  }
12
+ /**
13
+ * Read an env var, trim whitespace, and treat as unset if blank or if the value
14
+ * looks like an unsubstituted shell placeholder (e.g. `${FOO}`) — defends
15
+ * against MCP hosts that pass .mcp.json env blocks through unexpanded.
16
+ */
17
+ function readVar(key) {
18
+ const raw = process.env[key];
19
+ if (typeof raw !== 'string')
20
+ return undefined;
21
+ const trimmed = raw.trim();
22
+ if (trimmed.length === 0)
23
+ return undefined;
24
+ if (trimmed === 'undefined' || trimmed === 'null')
25
+ return undefined;
26
+ if (/^\$\{[^}]*\}$/.test(trimmed))
27
+ return undefined;
28
+ return trimmed;
29
+ }
12
30
  const BASE_URL = 'https://secure.splitwise.com/api/v3.0';
13
31
  export class SplitwiseClient {
14
32
  apiKey;
33
+ configError;
34
+ /**
35
+ * Defer the config error so the server can still start (and respond to the
36
+ * host's install-time smoke test) when SPLITWISE_API_KEY isn't set yet.
37
+ * Tool calls re-raise the error at request time.
38
+ */
15
39
  constructor() {
16
- const key = process.env.SPLITWISE_API_KEY;
17
- if (!key)
18
- throw new Error('SPLITWISE_API_KEY environment variable is required');
19
- this.apiKey = key;
40
+ const key = readVar('SPLITWISE_API_KEY');
41
+ if (!key) {
42
+ this.apiKey = null;
43
+ this.configError = new Error('SPLITWISE_API_KEY environment variable is required');
44
+ }
45
+ else {
46
+ this.apiKey = key;
47
+ this.configError = null;
48
+ }
49
+ }
50
+ requireKey() {
51
+ if (this.configError)
52
+ throw this.configError;
53
+ return this.apiKey;
20
54
  }
21
55
  async request(method, path, body) {
22
56
  return this.doRequest(method, path, body, false);
23
57
  }
24
58
  async doRequest(method, path, body, isRetry) {
25
59
  const headers = {
26
- Authorization: `Bearer ${this.apiKey}`,
60
+ Authorization: `Bearer ${this.requireKey()}`,
27
61
  'Content-Type': 'application/json',
28
62
  Accept: 'application/json',
29
63
  };
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { registerFriendTools } from './tools/friends.js';
8
8
  import { registerExpenseTools } from './tools/expenses.js';
9
9
  import { registerUtilityTools } from './tools/utilities.js';
10
10
  const client = new SplitwiseClient();
11
- const server = new McpServer({ name: 'splitwise-mcp', version: '2.0.2' });
11
+ const server = new McpServer({ name: 'splitwise-mcp', version: '2.0.3' });
12
12
  registerUserTools(server, client);
13
13
  registerGroupTools(server, client);
14
14
  registerFriendTools(server, client);
package/package.json CHANGED
@@ -1,12 +1,28 @@
1
1
  {
2
2
  "name": "splitwise-mcp",
3
- "version": "2.0.1",
4
- "description": "Splitwise MCP server for Claude — developed and maintained by AI (Claude Sonnet 4.6)",
5
- "author": "Claude Sonnet 4.6 (AI) <https://www.anthropic.com/claude>",
3
+ "version": "2.0.3",
4
+ "mcpName": "io.github.chrischall/splitwise-mcp",
5
+ "description": "Splitwise MCP server for Claude — developed and maintained by AI (Claude Code)",
6
+ "author": "Claude Code (AI) <https://www.anthropic.com/claude>",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/chrischall/splitwise-mcp.git"
9
10
  },
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "mcp",
14
+ "model-context-protocol",
15
+ "claude",
16
+ "ai",
17
+ "splitwise",
18
+ "expenses",
19
+ "expense-tracking",
20
+ "groups",
21
+ "friends",
22
+ "split-bills",
23
+ "finance",
24
+ "shared-expenses"
25
+ ],
10
26
  "type": "module",
11
27
  "bin": {
12
28
  "splitwise-mcp": "dist/index.js"
@@ -15,7 +31,8 @@
15
31
  "dist",
16
32
  ".claude-plugin",
17
33
  "SKILL.md",
18
- ".mcp.json"
34
+ ".mcp.json",
35
+ "server.json"
19
36
  ],
20
37
  "scripts": {
21
38
  "build": "tsc && npm run bundle",
@@ -28,7 +45,7 @@
28
45
  "dependencies": {
29
46
  "@modelcontextprotocol/sdk": "^1.29.0",
30
47
  "dotenv": "^17.4.0",
31
- "zod": "^4.3.6"
48
+ "zod": "^4.4.2"
32
49
  },
33
50
  "devDependencies": {
34
51
  "@types/node": "^25.5.2",
package/server.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.chrischall/splitwise-mcp",
4
+ "description": "Splitwise expense and group management for Claude — shared expenses, settle up, friends",
5
+ "repository": {
6
+ "url": "https://github.com/chrischall/splitwise-mcp",
7
+ "source": "github"
8
+ },
9
+ "version": "2.0.3",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "splitwise-mcp",
14
+ "version": "2.0.3",
15
+ "transport": {
16
+ "type": "stdio"
17
+ },
18
+ "environmentVariables": [
19
+ {
20
+ "name": "SPLITWISE_API_KEY",
21
+ "description": "Your Splitwise API key (splitwise.com/apps/api)",
22
+ "isRequired": true,
23
+ "format": "string",
24
+ "isSecret": true
25
+ }
26
+ ]
27
+ }
28
+ ]
29
+ }