quantix-mcp 0.3.6
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/.claude/settings.local.json +7 -0
- package/.github/agents/copilot-instructions.md +32 -0
- package/.github/agents/speckit.analyze.agent.md +184 -0
- package/.github/agents/speckit.checklist.agent.md +294 -0
- package/.github/agents/speckit.clarify.agent.md +181 -0
- package/.github/agents/speckit.constitution.agent.md +82 -0
- package/.github/agents/speckit.implement.agent.md +135 -0
- package/.github/agents/speckit.plan.agent.md +89 -0
- package/.github/agents/speckit.specify.agent.md +258 -0
- package/.github/agents/speckit.tasks.agent.md +137 -0
- package/.github/agents/speckit.taskstoissues.agent.md +30 -0
- package/.github/copilot-instructions.md +17 -0
- package/.github/prompts/speckit.analyze.prompt.md +3 -0
- package/.github/prompts/speckit.checklist.prompt.md +3 -0
- package/.github/prompts/speckit.clarify.prompt.md +3 -0
- package/.github/prompts/speckit.constitution.prompt.md +3 -0
- package/.github/prompts/speckit.implement.prompt.md +3 -0
- package/.github/prompts/speckit.plan.prompt.md +3 -0
- package/.github/prompts/speckit.specify.prompt.md +3 -0
- package/.github/prompts/speckit.tasks.prompt.md +3 -0
- package/.github/prompts/speckit.taskstoissues.prompt.md +3 -0
- package/.github/workflows/publish.yaml +28 -0
- package/.opencode/command/speckit.analyze.md +184 -0
- package/.opencode/command/speckit.checklist.md +294 -0
- package/.opencode/command/speckit.clarify.md +181 -0
- package/.opencode/command/speckit.constitution.md +84 -0
- package/.opencode/command/speckit.implement.md +135 -0
- package/.opencode/command/speckit.plan.md +89 -0
- package/.opencode/command/speckit.specify.md +258 -0
- package/.opencode/command/speckit.tasks.md +137 -0
- package/.opencode/command/speckit.taskstoissues.md +30 -0
- package/.specify/memory/constitution.md +58 -0
- package/.specify/scripts/powershell/check-prerequisites.ps1 +148 -0
- package/.specify/scripts/powershell/common.ps1 +137 -0
- package/.specify/scripts/powershell/create-new-feature.ps1 +283 -0
- package/.specify/scripts/powershell/setup-plan.ps1 +61 -0
- package/.specify/scripts/powershell/update-agent-context.ps1 +448 -0
- package/.specify/templates/agent-file-template.md +28 -0
- package/.specify/templates/checklist-template.md +40 -0
- package/.specify/templates/constitution-template.md +50 -0
- package/.specify/templates/plan-template.md +104 -0
- package/.specify/templates/spec-template.md +115 -0
- package/.specify/templates/tasks-template.md +251 -0
- package/.vscode/launch.json +14 -0
- package/.vscode/settings.json +14 -0
- package/.vscode/tasks.json +15 -0
- package/CLAUDE.md +64 -0
- package/README.md +176 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +31 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/services/apiClient.d.ts +14 -0
- package/dist/services/apiClient.d.ts.map +1 -0
- package/dist/services/apiClient.js +41 -0
- package/dist/services/apiClient.js.map +1 -0
- package/dist/tools/accounts.d.ts +3 -0
- package/dist/tools/accounts.d.ts.map +1 -0
- package/dist/tools/accounts.js +77 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/categories.d.ts +3 -0
- package/dist/tools/categories.d.ts.map +1 -0
- package/dist/tools/categories.js +57 -0
- package/dist/tools/categories.js.map +1 -0
- package/dist/tools/credit-cards.d.ts +3 -0
- package/dist/tools/credit-cards.d.ts.map +1 -0
- package/dist/tools/credit-cards.js +93 -0
- package/dist/tools/credit-cards.js.map +1 -0
- package/dist/tools/data.d.ts +3 -0
- package/dist/tools/data.d.ts.map +1 -0
- package/dist/tools/data.js +27 -0
- package/dist/tools/data.js.map +1 -0
- package/dist/tools/settings.d.ts +3 -0
- package/dist/tools/settings.d.ts.map +1 -0
- package/dist/tools/settings.js +37 -0
- package/dist/tools/settings.js.map +1 -0
- package/dist/tools/summary.d.ts +3 -0
- package/dist/tools/summary.d.ts.map +1 -0
- package/dist/tools/summary.js +23 -0
- package/dist/tools/summary.js.map +1 -0
- package/dist/tools/transactions.d.ts +3 -0
- package/dist/tools/transactions.d.ts.map +1 -0
- package/dist/tools/transactions.js +102 -0
- package/dist/tools/transactions.js.map +1 -0
- package/dist/types/schemas.d.ts +330 -0
- package/dist/types/schemas.d.ts.map +1 -0
- package/dist/types/schemas.js +206 -0
- package/dist/types/schemas.js.map +1 -0
- package/openapi.yaml +1786 -0
- package/package.json +41 -0
- package/specs/001-mcp-api-integration/checklists/requirements.md +34 -0
- package/specs/001-mcp-api-integration/contracts/openapi.yaml +636 -0
- package/specs/001-mcp-api-integration/data-model.md +106 -0
- package/specs/001-mcp-api-integration/plan.md +73 -0
- package/specs/001-mcp-api-integration/quickstart.md +74 -0
- package/specs/001-mcp-api-integration/research.md +58 -0
- package/specs/001-mcp-api-integration/spec.md +119 -0
- package/specs/001-mcp-api-integration/tasks.md +64 -0
- package/src/config.ts +36 -0
- package/src/index.ts +47 -0
- package/src/services/apiClient.ts +49 -0
- package/src/tools/accounts.ts +111 -0
- package/src/tools/categories.ts +81 -0
- package/src/tools/credit-cards.ts +132 -0
- package/src/tools/data.ts +36 -0
- package/src/tools/settings.ts +51 -0
- package/src/tools/summary.ts +24 -0
- package/src/tools/transactions.ts +128 -0
- package/src/types/schemas.ts +230 -0
- package/tests/benchmark.test.d.ts +2 -0
- package/tests/benchmark.test.d.ts.map +1 -0
- package/tests/benchmark.test.js +33 -0
- package/tests/benchmark.test.js.map +1 -0
- package/tests/benchmark.test.ts +38 -0
- package/tests/server.test.d.ts +2 -0
- package/tests/server.test.d.ts.map +1 -0
- package/tests/server.test.js +13 -0
- package/tests/server.test.js.map +1 -0
- package/tests/server.test.ts +14 -0
- package/tests/setup.d.ts +4 -0
- package/tests/setup.d.ts.map +1 -0
- package/tests/setup.js +17 -0
- package/tests/setup.js.map +1 -0
- package/tests/setup.ts +20 -0
- package/tests/tools/accounts.test.ts +118 -0
- package/tests/tools/categories.test.d.ts +2 -0
- package/tests/tools/categories.test.d.ts.map +1 -0
- package/tests/tools/categories.test.js +63 -0
- package/tests/tools/categories.test.js.map +1 -0
- package/tests/tools/categories.test.ts +78 -0
- package/tests/tools/credit-cards.test.d.ts +2 -0
- package/tests/tools/credit-cards.test.d.ts.map +1 -0
- package/tests/tools/credit-cards.test.js +71 -0
- package/tests/tools/credit-cards.test.js.map +1 -0
- package/tests/tools/credit-cards.test.ts +89 -0
- package/tests/tools/summary.test.d.ts +2 -0
- package/tests/tools/summary.test.d.ts.map +1 -0
- package/tests/tools/summary.test.js +36 -0
- package/tests/tools/summary.test.js.map +1 -0
- package/tests/tools/summary.test.ts +42 -0
- package/tests/tools/transactions.test.d.ts +2 -0
- package/tests/tools/transactions.test.d.ts.map +1 -0
- package/tests/tools/transactions.test.js +67 -0
- package/tests/tools/transactions.test.js.map +1 -0
- package/tests/tools/transactions.test.ts +82 -0
- package/tsconfig.json +52 -0
- package/vitest.config.d.ts +3 -0
- package/vitest.config.d.ts.map +1 -0
- package/vitest.config.js +14 -0
- package/vitest.config.js.map +1 -0
- package/vitest.config.ts +14 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CreateAccountInput, UpdateAccountInput } from '../types/schemas.js';
|
|
4
|
+
import { apiClient } from '../services/apiClient.js';
|
|
5
|
+
|
|
6
|
+
export function registerAccountTools(server: McpServer) {
|
|
7
|
+
server.registerTool(
|
|
8
|
+
'create_account',
|
|
9
|
+
{
|
|
10
|
+
title: 'Create Account',
|
|
11
|
+
description: 'Create a new financial account (BANK_ACCOUNT, WALLET, etc.)',
|
|
12
|
+
inputSchema: CreateAccountInput
|
|
13
|
+
},
|
|
14
|
+
async (args) => {
|
|
15
|
+
const account = await apiClient.post('/accounts', args);
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: 'text', text: `Account created: ${JSON.stringify(account, null, 2)}` }]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
server.registerTool(
|
|
23
|
+
'get_accounts',
|
|
24
|
+
{
|
|
25
|
+
title: 'Get Accounts',
|
|
26
|
+
description: 'List all financial accounts with current balances',
|
|
27
|
+
inputSchema: z.object({})
|
|
28
|
+
},
|
|
29
|
+
async () => {
|
|
30
|
+
const accounts = await apiClient.get('/accounts');
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: 'text', text: `Accounts: ${JSON.stringify(accounts, null, 2)}` }]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
server.registerTool(
|
|
38
|
+
'get_account',
|
|
39
|
+
{
|
|
40
|
+
title: 'Get Account Details',
|
|
41
|
+
description: 'Get details of a specific account by ID',
|
|
42
|
+
inputSchema: z.object({ id: z.string() })
|
|
43
|
+
},
|
|
44
|
+
async ({ id }) => {
|
|
45
|
+
const account = await apiClient.get(`/accounts/${id}`);
|
|
46
|
+
return {
|
|
47
|
+
content: [{ type: 'text', text: `Account details: ${JSON.stringify(account, null, 2)}` }]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
server.registerTool(
|
|
53
|
+
'update_account',
|
|
54
|
+
{
|
|
55
|
+
title: 'Update Account',
|
|
56
|
+
description: 'Update an existing account',
|
|
57
|
+
inputSchema: UpdateAccountInput
|
|
58
|
+
},
|
|
59
|
+
async ({ id, ...data }) => {
|
|
60
|
+
const account = await apiClient.patch(`/accounts/${id}`, data);
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: 'text', text: `Account updated: ${JSON.stringify(account, null, 2)}` }]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
server.registerTool(
|
|
68
|
+
'delete_account',
|
|
69
|
+
{
|
|
70
|
+
title: 'Delete Account',
|
|
71
|
+
description: 'Delete an account by ID',
|
|
72
|
+
inputSchema: z.object({ id: z.string() })
|
|
73
|
+
},
|
|
74
|
+
async ({ id }) => {
|
|
75
|
+
await apiClient.delete(`/accounts/${id}`);
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: 'text', text: `Account deleted successfully (ID: ${id})` }]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
server.registerTool(
|
|
83
|
+
'get_account_balance',
|
|
84
|
+
{
|
|
85
|
+
title: 'Get Account Balance',
|
|
86
|
+
description: 'Get the current balance for a specific account',
|
|
87
|
+
inputSchema: z.object({ id: z.string() })
|
|
88
|
+
},
|
|
89
|
+
async ({ id }) => {
|
|
90
|
+
const balance = await apiClient.get(`/accounts/${id}/balance`);
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: 'text', text: `Account balance: ${JSON.stringify(balance, null, 2)}` }]
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
server.registerTool(
|
|
98
|
+
'get_account_transactions',
|
|
99
|
+
{
|
|
100
|
+
title: 'Get Account Transactions',
|
|
101
|
+
description: 'Get all transactions linked to an account',
|
|
102
|
+
inputSchema: z.object({ id: z.string() })
|
|
103
|
+
},
|
|
104
|
+
async ({ id }) => {
|
|
105
|
+
const transactions = await apiClient.get(`/accounts/${id}/transactions`);
|
|
106
|
+
return {
|
|
107
|
+
content: [{ type: 'text', text: `Account transactions: ${JSON.stringify(transactions, null, 2)}` }]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CreateCategoryInput, UpdateCategoryInput } from '../types/schemas.js';
|
|
4
|
+
import { apiClient } from '../services/apiClient.js';
|
|
5
|
+
|
|
6
|
+
export function registerCategoryTools(server: McpServer) {
|
|
7
|
+
server.registerTool(
|
|
8
|
+
'create_category',
|
|
9
|
+
{
|
|
10
|
+
title: 'Create Category',
|
|
11
|
+
description: 'Create a new financial category (INCOME or EXPENSE)',
|
|
12
|
+
inputSchema: CreateCategoryInput
|
|
13
|
+
},
|
|
14
|
+
async (args) => {
|
|
15
|
+
const category = await apiClient.post('/categories', args);
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: 'text', text: `Category created: ${JSON.stringify(category, null, 2)}` }]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
server.registerTool(
|
|
23
|
+
'get_categories',
|
|
24
|
+
{
|
|
25
|
+
title: 'Get Categories',
|
|
26
|
+
description: 'List all financial categories',
|
|
27
|
+
inputSchema: z.object({})
|
|
28
|
+
},
|
|
29
|
+
async () => {
|
|
30
|
+
const categories = await apiClient.get('/categories');
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: 'text', text: `Categories: ${JSON.stringify(categories, null, 2)}` }]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
server.registerTool(
|
|
38
|
+
'get_category',
|
|
39
|
+
{
|
|
40
|
+
title: 'Get Category',
|
|
41
|
+
description: 'Get a category by ID',
|
|
42
|
+
inputSchema: z.object({ id: z.string() })
|
|
43
|
+
},
|
|
44
|
+
async ({ id }) => {
|
|
45
|
+
const category = await apiClient.get(`/categories/${id}`);
|
|
46
|
+
return {
|
|
47
|
+
content: [{ type: 'text', text: `Category: ${JSON.stringify(category, null, 2)}` }]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
server.registerTool(
|
|
53
|
+
'update_category',
|
|
54
|
+
{
|
|
55
|
+
title: 'Update Category',
|
|
56
|
+
description: 'Update a category',
|
|
57
|
+
inputSchema: UpdateCategoryInput
|
|
58
|
+
},
|
|
59
|
+
async ({ id, ...data }) => {
|
|
60
|
+
const category = await apiClient.patch(`/categories/${id}`, data);
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: 'text', text: `Category updated: ${JSON.stringify(category, null, 2)}` }]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
server.registerTool(
|
|
68
|
+
'delete_category',
|
|
69
|
+
{
|
|
70
|
+
title: 'Delete Category',
|
|
71
|
+
description: 'Delete a category by ID',
|
|
72
|
+
inputSchema: z.object({ id: z.string() })
|
|
73
|
+
},
|
|
74
|
+
async ({ id }) => {
|
|
75
|
+
await apiClient.delete(`/categories/${id}`);
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: 'text', text: `Category deleted successfully (ID: ${id})` }]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CreateCreditCardInput, UpdateCreditCardInput, PayStatementInput } from '../types/schemas.js';
|
|
4
|
+
import { apiClient } from '../services/apiClient.js';
|
|
5
|
+
|
|
6
|
+
export function registerCreditCardTools(server: McpServer) {
|
|
7
|
+
server.registerTool(
|
|
8
|
+
'create_credit_card',
|
|
9
|
+
{
|
|
10
|
+
title: 'Create Credit Card',
|
|
11
|
+
description: 'Create a new credit card account',
|
|
12
|
+
inputSchema: CreateCreditCardInput
|
|
13
|
+
},
|
|
14
|
+
async (args) => {
|
|
15
|
+
const card = await apiClient.post('/credit-cards', args);
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: 'text', text: `Credit Card created: ${JSON.stringify(card, null, 2)}` }]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
server.registerTool(
|
|
23
|
+
'get_credit_cards',
|
|
24
|
+
{
|
|
25
|
+
title: 'Get Credit Cards',
|
|
26
|
+
description: 'List all credit cards',
|
|
27
|
+
inputSchema: z.object({})
|
|
28
|
+
},
|
|
29
|
+
async () => {
|
|
30
|
+
const cards = await apiClient.get('/credit-cards');
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: 'text', text: `Credit Cards: ${JSON.stringify(cards, null, 2)}` }]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
server.registerTool(
|
|
38
|
+
'get_credit_card',
|
|
39
|
+
{
|
|
40
|
+
title: 'Get Credit Card',
|
|
41
|
+
description: 'Get a credit card by ID',
|
|
42
|
+
inputSchema: z.object({ id: z.string() })
|
|
43
|
+
},
|
|
44
|
+
async ({ id }) => {
|
|
45
|
+
const card = await apiClient.get(`/credit-cards/${id}`);
|
|
46
|
+
return {
|
|
47
|
+
content: [{ type: 'text', text: `Credit Card: ${JSON.stringify(card, null, 2)}` }]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
server.registerTool(
|
|
53
|
+
'update_credit_card',
|
|
54
|
+
{
|
|
55
|
+
title: 'Update Credit Card',
|
|
56
|
+
description: 'Update a credit card',
|
|
57
|
+
inputSchema: UpdateCreditCardInput
|
|
58
|
+
},
|
|
59
|
+
async ({ id, ...data }) => {
|
|
60
|
+
const card = await apiClient.patch(`/credit-cards/${id}`, data);
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: 'text', text: `Credit Card updated: ${JSON.stringify(card, null, 2)}` }]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
server.registerTool(
|
|
68
|
+
'delete_credit_card',
|
|
69
|
+
{
|
|
70
|
+
title: 'Delete Credit Card',
|
|
71
|
+
description: 'Delete a credit card by ID',
|
|
72
|
+
inputSchema: z.object({ id: z.string() })
|
|
73
|
+
},
|
|
74
|
+
async ({ id }) => {
|
|
75
|
+
await apiClient.delete(`/credit-cards/${id}`);
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: 'text', text: `Credit Card deleted successfully (ID: ${id})` }]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
server.registerTool(
|
|
83
|
+
'get_statement',
|
|
84
|
+
{
|
|
85
|
+
title: 'Get Statement',
|
|
86
|
+
description: 'Get credit card statement for a specific month',
|
|
87
|
+
inputSchema: z.object({
|
|
88
|
+
id: z.string().describe('Credit Card ID'),
|
|
89
|
+
month: z.string().describe('Month in YYYY-MM format')
|
|
90
|
+
})
|
|
91
|
+
},
|
|
92
|
+
async ({ id, month }) => {
|
|
93
|
+
const statement = await apiClient.get(`/credit-cards/${id}/statement?month=${month}`);
|
|
94
|
+
return {
|
|
95
|
+
content: [{ type: 'text', text: `Statement: ${JSON.stringify(statement, null, 2)}` }]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
server.registerTool(
|
|
101
|
+
'pay_statement',
|
|
102
|
+
{
|
|
103
|
+
title: 'Pay Statement',
|
|
104
|
+
description: 'Mark all transactions in a credit card statement as paid',
|
|
105
|
+
inputSchema: PayStatementInput
|
|
106
|
+
},
|
|
107
|
+
async ({ cardId, month, paymentAccountId }) => {
|
|
108
|
+
await apiClient.post(`/credit-cards/${cardId}/pay-statement`, { month, paymentAccountId });
|
|
109
|
+
return {
|
|
110
|
+
content: [{ type: 'text', text: `Statement for ${month} paid successfully.` }]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
server.registerTool(
|
|
116
|
+
'get_statement_status',
|
|
117
|
+
{
|
|
118
|
+
title: 'Get Statement Status',
|
|
119
|
+
description: 'Get credit card statement payment status',
|
|
120
|
+
inputSchema: z.object({
|
|
121
|
+
id: z.string().describe('Credit Card ID'),
|
|
122
|
+
month: z.string().describe('Month in YYYY-MM format')
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
async ({ id, month }) => {
|
|
126
|
+
const status = await apiClient.get(`/credit-cards/${id}/statement-status?month=${month}`);
|
|
127
|
+
return {
|
|
128
|
+
content: [{ type: 'text', text: `Statement Status: ${JSON.stringify(status, null, 2)}` }]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ImportDataInput } from '../types/schemas.js';
|
|
4
|
+
import { apiClient } from '../services/apiClient.js';
|
|
5
|
+
|
|
6
|
+
export function registerDataTools(server: McpServer) {
|
|
7
|
+
server.registerTool(
|
|
8
|
+
'export_data',
|
|
9
|
+
{
|
|
10
|
+
title: 'Export Data',
|
|
11
|
+
description: 'Export all user data (settings, categories, accounts, credit cards, recurrence rules, transactions) as a complete backup',
|
|
12
|
+
inputSchema: z.object({})
|
|
13
|
+
},
|
|
14
|
+
async () => {
|
|
15
|
+
const data = await apiClient.get('/export');
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: 'text', text: `Export: ${JSON.stringify(data, null, 2)}` }]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
server.registerTool(
|
|
23
|
+
'import_data',
|
|
24
|
+
{
|
|
25
|
+
title: 'Import Data',
|
|
26
|
+
description: 'Import a previously exported backup. Mode "reset" clears all existing data first; mode "increment" adds new records and skips existing IDs.',
|
|
27
|
+
inputSchema: ImportDataInput
|
|
28
|
+
},
|
|
29
|
+
async (args) => {
|
|
30
|
+
const result = await apiClient.post('/import', args);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: 'text', text: `Import result: ${JSON.stringify(result, null, 2)}` }]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CreateSettingsInput, UpdateSettingsInput } from '../types/schemas.js';
|
|
4
|
+
import { apiClient } from '../services/apiClient.js';
|
|
5
|
+
|
|
6
|
+
export function registerSettingsTools(server: McpServer) {
|
|
7
|
+
server.registerTool(
|
|
8
|
+
'create_settings',
|
|
9
|
+
{
|
|
10
|
+
title: 'Create Settings',
|
|
11
|
+
description: 'Create global settings (only if not exists)',
|
|
12
|
+
inputSchema: CreateSettingsInput
|
|
13
|
+
},
|
|
14
|
+
async (args) => {
|
|
15
|
+
const settings = await apiClient.post('/settings', args);
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: 'text', text: `Settings created: ${JSON.stringify(settings, null, 2)}` }]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
server.registerTool(
|
|
23
|
+
'get_settings',
|
|
24
|
+
{
|
|
25
|
+
title: 'Get Settings',
|
|
26
|
+
description: 'Get global settings',
|
|
27
|
+
inputSchema: z.object({})
|
|
28
|
+
},
|
|
29
|
+
async () => {
|
|
30
|
+
const settings = await apiClient.get('/settings');
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: 'text', text: `Settings: ${JSON.stringify(settings, null, 2)}` }]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
server.registerTool(
|
|
38
|
+
'update_settings',
|
|
39
|
+
{
|
|
40
|
+
title: 'Update Settings',
|
|
41
|
+
description: 'Update global settings',
|
|
42
|
+
inputSchema: UpdateSettingsInput
|
|
43
|
+
},
|
|
44
|
+
async (args) => {
|
|
45
|
+
const settings = await apiClient.put('/settings', args);
|
|
46
|
+
return {
|
|
47
|
+
content: [{ type: 'text', text: `Settings updated: ${JSON.stringify(settings, null, 2)}` }]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { GetSummaryInput } from '../types/schemas.js';
|
|
3
|
+
import { apiClient } from '../services/apiClient.js';
|
|
4
|
+
|
|
5
|
+
export function registerSummaryTools(server: McpServer) {
|
|
6
|
+
server.registerTool(
|
|
7
|
+
'get_summary',
|
|
8
|
+
{
|
|
9
|
+
title: 'Get Financial Summary',
|
|
10
|
+
description: 'Get financial summary (income, expenses, balance, credit cards, category breakdowns). Provide either month (YYYY-MM) or startDate+endDate (YYYY-MM-DD).',
|
|
11
|
+
inputSchema: GetSummaryInput
|
|
12
|
+
},
|
|
13
|
+
async ({ month, startDate, endDate }) => {
|
|
14
|
+
const params = new URLSearchParams();
|
|
15
|
+
if (month) params.append('month', month);
|
|
16
|
+
if (startDate) params.append('startDate', startDate);
|
|
17
|
+
if (endDate) params.append('endDate', endDate);
|
|
18
|
+
const summary = await apiClient.get(`/summary?${params.toString()}`);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: 'text', text: `Summary: ${JSON.stringify(summary, null, 2)}` }]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CreateTransactionInput, GetTransactionsInput, UpdateTransactionInput } from '../types/schemas.js';
|
|
4
|
+
import { apiClient } from '../services/apiClient.js';
|
|
5
|
+
|
|
6
|
+
export function registerTransactionTools(server: McpServer) {
|
|
7
|
+
server.registerTool(
|
|
8
|
+
'create_transaction',
|
|
9
|
+
{
|
|
10
|
+
title: 'Create Transaction',
|
|
11
|
+
description: 'Record a new income or expense',
|
|
12
|
+
inputSchema: CreateTransactionInput
|
|
13
|
+
},
|
|
14
|
+
async (args) => {
|
|
15
|
+
const transaction = await apiClient.post('/transactions', args);
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: 'text', text: `Transaction created: ${JSON.stringify(transaction, null, 2)}` }]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
server.registerTool(
|
|
23
|
+
'get_transactions',
|
|
24
|
+
{
|
|
25
|
+
title: 'Get Transactions',
|
|
26
|
+
description: 'List transactions with optional filters (month, date range, account, category, credit card, type, paid status)',
|
|
27
|
+
inputSchema: GetTransactionsInput
|
|
28
|
+
},
|
|
29
|
+
async (args) => {
|
|
30
|
+
const params = new URLSearchParams();
|
|
31
|
+
if (args.month) params.append('month', args.month);
|
|
32
|
+
if (args.accountId) params.append('accountId', args.accountId);
|
|
33
|
+
if (args.categoryId) params.append('categoryId', args.categoryId);
|
|
34
|
+
if (args.creditCardId) params.append('creditCardId', args.creditCardId);
|
|
35
|
+
if (args.type) params.append('type', args.type);
|
|
36
|
+
if (args.startDate) params.append('startDate', args.startDate);
|
|
37
|
+
if (args.endDate) params.append('endDate', args.endDate);
|
|
38
|
+
if (args.paid !== undefined) params.append('paid', String(args.paid));
|
|
39
|
+
const qs = params.toString();
|
|
40
|
+
const url = qs ? `/transactions?${qs}` : '/transactions';
|
|
41
|
+
const transactions = await apiClient.get(url);
|
|
42
|
+
return {
|
|
43
|
+
content: [{ type: 'text', text: `Transactions: ${JSON.stringify(transactions, null, 2)}` }]
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
server.registerTool(
|
|
49
|
+
'get_transaction',
|
|
50
|
+
{
|
|
51
|
+
title: 'Get Transaction',
|
|
52
|
+
description: 'Get a transaction by ID',
|
|
53
|
+
inputSchema: z.object({ id: z.string().describe("Transaction ID") })
|
|
54
|
+
},
|
|
55
|
+
async ({ id }) => {
|
|
56
|
+
const transaction = await apiClient.get(`/transactions/${id}`);
|
|
57
|
+
return {
|
|
58
|
+
content: [{ type: 'text', text: `Transaction: ${JSON.stringify(transaction, null, 2)}` }]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
server.registerTool(
|
|
64
|
+
'update_transaction',
|
|
65
|
+
{
|
|
66
|
+
title: 'Update Transaction',
|
|
67
|
+
description: 'Update a transaction',
|
|
68
|
+
inputSchema: UpdateTransactionInput
|
|
69
|
+
},
|
|
70
|
+
async ({ id, mode, ...data }) => {
|
|
71
|
+
const url = mode ? `/transactions/${id}?mode=${mode}` : `/transactions/${id}`;
|
|
72
|
+
const transaction = await apiClient.patch(url, data);
|
|
73
|
+
return {
|
|
74
|
+
content: [{ type: 'text', text: `Transaction updated: ${JSON.stringify(transaction, null, 2)}` }]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
server.registerTool(
|
|
80
|
+
'pay_transaction',
|
|
81
|
+
{
|
|
82
|
+
title: 'Pay Transaction',
|
|
83
|
+
description: 'Mark a transaction as paid/received',
|
|
84
|
+
inputSchema: z.object({ id: z.string().describe("Transaction ID") })
|
|
85
|
+
},
|
|
86
|
+
async ({ id }) => {
|
|
87
|
+
// PATCH /transactions/{id}/pay
|
|
88
|
+
await apiClient.patch(`/transactions/${id}/pay`);
|
|
89
|
+
return {
|
|
90
|
+
content: [{ type: 'text', text: `Transaction ${id} marked as paid.` }]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
server.registerTool(
|
|
96
|
+
'unpay_transaction',
|
|
97
|
+
{
|
|
98
|
+
title: 'Unpay Transaction',
|
|
99
|
+
description: 'Mark a transaction as unpaid',
|
|
100
|
+
inputSchema: z.object({ id: z.string().describe("Transaction ID") })
|
|
101
|
+
},
|
|
102
|
+
async ({ id }) => {
|
|
103
|
+
await apiClient.patch(`/transactions/${id}/unpay`);
|
|
104
|
+
return {
|
|
105
|
+
content: [{ type: 'text', text: `Transaction ${id} marked as unpaid.` }]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
server.registerTool(
|
|
111
|
+
'delete_transaction',
|
|
112
|
+
{
|
|
113
|
+
title: 'Delete Transaction',
|
|
114
|
+
description: 'Delete a transaction by ID',
|
|
115
|
+
inputSchema: z.object({
|
|
116
|
+
id: z.string().describe("Transaction ID"),
|
|
117
|
+
mode: z.enum(["SINGLE", "PENDING", "ALL"]).default("SINGLE").optional()
|
|
118
|
+
})
|
|
119
|
+
},
|
|
120
|
+
async ({ id, mode }) => {
|
|
121
|
+
const url = mode ? `/transactions/${id}?mode=${mode}` : `/transactions/${id}`;
|
|
122
|
+
await apiClient.delete(url);
|
|
123
|
+
return {
|
|
124
|
+
content: [{ type: 'text', text: `Transaction ${id} deleted.` }]
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|