@spotsccc/finance-bundle 0.1.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/.mcp.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "assistant-db": {
4
+ "command": "npx",
5
+ "args": ["-y", "@spotsccc/finance-mcp"],
6
+ "env": {
7
+ "DATABASE_URL": "${DATABASE_URL}"
8
+ }
9
+ }
10
+ }
11
+ }
package/package.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@spotsccc/finance-bundle",
3
+ "version": "0.1.0",
4
+ "description": "OpenClaw finance skill bundle — personal finance tracking via MCP server",
5
+ "files": [".mcp.json", "skills", "schema.sql"],
6
+ "keywords": ["openclaw", "mcp", "finance", "skill"]
7
+ }
package/schema.sql ADDED
@@ -0,0 +1,41 @@
1
+ -- Finance MCP Server — Database Schema
2
+ -- PostgreSQL 14+
3
+
4
+ CREATE TYPE transaction_type AS ENUM ('income', 'expense', 'transfer');
5
+
6
+ CREATE TABLE currencies (
7
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
8
+ code VARCHAR(10) UNIQUE NOT NULL,
9
+ name VARCHAR(50) NOT NULL,
10
+ symbol VARCHAR(5),
11
+ created_at TIMESTAMP NOT NULL DEFAULT now()
12
+ );
13
+
14
+ CREATE TABLE categories (
15
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
16
+ name VARCHAR(100) UNIQUE NOT NULL,
17
+ created_at TIMESTAMP NOT NULL DEFAULT now()
18
+ );
19
+
20
+ CREATE TABLE wallets (
21
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
22
+ name VARCHAR(100) NOT NULL,
23
+ created_at TIMESTAMP NOT NULL DEFAULT now()
24
+ );
25
+
26
+ CREATE TABLE transactions (
27
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
28
+ description VARCHAR(500) NOT NULL,
29
+ type transaction_type NOT NULL,
30
+ category_id UUID REFERENCES categories(id),
31
+ created_at TIMESTAMP NOT NULL DEFAULT now()
32
+ );
33
+
34
+ CREATE TABLE transaction_entries (
35
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
36
+ transaction_id UUID NOT NULL REFERENCES transactions(id) ON DELETE CASCADE,
37
+ wallet_id UUID NOT NULL REFERENCES wallets(id),
38
+ currency_id UUID NOT NULL REFERENCES currencies(id),
39
+ amount NUMERIC(36, 18) NOT NULL,
40
+ created_at TIMESTAMP NOT NULL DEFAULT now()
41
+ );
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: finance
3
+ description: >
4
+ Manage personal finances: record expenses, income, transfers, check balances, and generate reports.
5
+ TRIGGER when: user asks to record a transaction, expense, income, transfer between wallets, check balance,
6
+ or get a spending report. Keywords: трата, расход, доход, перевод, баланс, отчёт, потратил, заработал,
7
+ купил, оплатил, списание, пополнение, кошелёк, expense, income, transfer, balance, report.
8
+ Do NOT trigger for: creating/modifying database structure.
9
+ allowed-tools:
10
+ - Read
11
+ - Grep
12
+ - assistant-db__create_transaction
13
+ - assistant-db__list_transactions
14
+ - assistant-db__delete_transaction
15
+ - assistant-db__get_wallets
16
+ - assistant-db__get_wallet_balance
17
+ - assistant-db__create_wallet
18
+ - assistant-db__get_categories
19
+ - assistant-db__create_category
20
+ - assistant-db__spending_report
21
+ ---
22
+
23
+ # Finance Skill
24
+
25
+ Record and query personal financial data stored in PostgreSQL via the `assistant-db` MCP server.
26
+
27
+ ## Transaction Types
28
+
29
+ ### 1. Expense (Трата)
30
+ - Use `create_transaction` with `type: "expense"`
31
+ - Amount is always positive — the system negates it automatically
32
+ - Requires: description, amount, walletId, categoryId
33
+
34
+ ### 2. Income (Пополнение)
35
+ - Use `create_transaction` with `type: "income"`
36
+ - Amount is positive
37
+ - Requires: description, amount, walletId, categoryId
38
+
39
+ ### 3. Transfer (Перевод)
40
+ - Use `create_transaction` with `type: "transfer"`, `walletId` (source), `toWalletId` (destination)
41
+ - The system creates two linked transactions automatically
42
+ - Category is optional for transfers
43
+
44
+ ## Workflow
45
+
46
+ ### Step 1: Parse the Request
47
+
48
+ Extract from the user's message:
49
+ - **Amount** — number (always positive)
50
+ - **Description** — what was bought / reason for transaction
51
+ - **Wallet** — which wallet to use
52
+ - **Category** — spending/income category
53
+ - **Type** — expense, income, or transfer (infer from context)
54
+
55
+ ### Step 2: Resolve References
56
+
57
+ Before creating a transaction:
58
+ 1. Call `get_wallets` to find the correct wallet ID
59
+ 2. Call `get_categories` to find the correct category ID
60
+ 3. If category doesn't exist, ask the user or create it with `create_category`
61
+
62
+ ### Step 3: Handle Ambiguity
63
+
64
+ If any required field is unclear or missing, ask the user **one concise clarifying question**. Common cases:
65
+ - Wallet not specified and user has multiple wallets
66
+ - Category is ambiguous
67
+ - Amount is missing
68
+ - Transfer destination unclear
69
+
70
+ Do NOT guess — ask. But do NOT over-ask if the context is obvious.
71
+
72
+ ### Step 4: Create the Transaction
73
+
74
+ Call `create_transaction` with the resolved data.
75
+
76
+ ### Step 5: Report Back
77
+
78
+ After creating the transaction, call `get_wallet_balance` and reply with a **concise confirmation** including:
79
+ - What was created (description, amount, wallet, category)
80
+ - Updated wallet balance
81
+
82
+ Example reply format for an expense:
83
+ ```
84
+ Записал: Булочка -200 ARS (Наличка ARS, Продукты)
85
+ Баланс Наличка ARS: 15 300 $
86
+ ```
87
+
88
+ Example reply format for a transfer:
89
+ ```
90
+ Перевод: 100 USD Tinkoff → Наличка
91
+ Баланс Tinkoff: 500 $
92
+ Баланс Наличка: 300 $
93
+ ```
94
+
95
+ ## Constraints
96
+
97
+ - NEVER create transactions without confirming ambiguous details first
98
+ - Always respond in the same language as the user's message (default: Russian)
99
+ - Keep responses short and action-oriented — no unnecessary explanations