quantix-mcp 0.3.7 → 0.4.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/.claude/settings.local.json +2 -1
- package/.github/agents/copilot-instructions.md +32 -32
- package/.github/copilot-instructions.md +17 -17
- package/.github/workflows/publish.yaml +28 -28
- package/.opencode/command/speckit.analyze.md +184 -184
- package/.opencode/command/speckit.checklist.md +294 -294
- package/.opencode/command/speckit.clarify.md +181 -181
- package/.opencode/command/speckit.constitution.md +84 -84
- package/.opencode/command/speckit.implement.md +135 -135
- package/.opencode/command/speckit.plan.md +89 -89
- package/.opencode/command/speckit.specify.md +258 -258
- package/.opencode/command/speckit.tasks.md +137 -137
- package/.opencode/command/speckit.taskstoissues.md +30 -30
- package/.specify/memory/constitution.md +58 -58
- package/.specify/templates/constitution-template.md +50 -50
- package/.vscode/launch.json +14 -14
- package/CLAUDE.md +70 -64
- package/GEMINI.md +58 -0
- package/README.md +176 -176
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/tools/accounts.d.ts.map +1 -1
- package/dist/tools/accounts.js +55 -34
- package/dist/tools/accounts.js.map +1 -1
- package/dist/tools/categories.d.ts.map +1 -1
- package/dist/tools/categories.js +46 -20
- package/dist/tools/categories.js.map +1 -1
- package/dist/tools/credit-cards.d.ts.map +1 -1
- package/dist/tools/credit-cards.js +104 -33
- package/dist/tools/credit-cards.js.map +1 -1
- package/dist/tools/data.d.ts.map +1 -1
- package/dist/tools/data.js +19 -8
- package/dist/tools/data.js.map +1 -1
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +28 -12
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/subscriptions.d.ts +3 -0
- package/dist/tools/subscriptions.d.ts.map +1 -0
- package/dist/tools/subscriptions.js +128 -0
- package/dist/tools/subscriptions.js.map +1 -0
- package/dist/tools/summary.d.ts.map +1 -1
- package/dist/tools/summary.js +17 -11
- package/dist/tools/summary.js.map +1 -1
- package/dist/tools/transactions.d.ts.map +1 -1
- package/dist/tools/transactions.js +85 -50
- package/dist/tools/transactions.js.map +1 -1
- package/dist/tools/transfers.d.ts +3 -0
- package/dist/tools/transfers.d.ts.map +1 -0
- package/dist/tools/transfers.js +107 -0
- package/dist/tools/transfers.js.map +1 -0
- package/dist/types/schemas.d.ts +65 -0
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +69 -3
- package/dist/types/schemas.js.map +1 -1
- package/dist/utils/toolHelpers.d.ts +7 -0
- package/dist/utils/toolHelpers.d.ts.map +1 -0
- package/dist/utils/toolHelpers.js +11 -0
- package/dist/utils/toolHelpers.js.map +1 -0
- package/openapi.yaml +2279 -1828
- package/package.json +41 -41
- package/specs/001-mcp-api-integration/checklists/requirements.md +34 -34
- package/specs/001-mcp-api-integration/contracts/openapi.yaml +635 -635
- package/specs/001-mcp-api-integration/data-model.md +106 -106
- package/specs/001-mcp-api-integration/plan.md +73 -73
- package/specs/001-mcp-api-integration/quickstart.md +74 -74
- package/specs/001-mcp-api-integration/research.md +58 -58
- package/specs/001-mcp-api-integration/spec.md +119 -119
- package/specs/001-mcp-api-integration/tasks.md +64 -64
- package/src/config.ts +36 -36
- package/src/index.ts +60 -47
- package/src/services/apiClient.ts +49 -49
- package/src/tools/accounts.ts +122 -111
- package/src/tools/categories.ts +102 -81
- package/src/tools/credit-cards.ts +203 -147
- package/src/tools/data.ts +45 -36
- package/src/tools/settings.ts +64 -51
- package/src/tools/subscriptions.ts +159 -0
- package/src/tools/summary.ts +29 -24
- package/src/tools/transactions.ts +156 -128
- package/src/tools/transfers.ts +122 -0
- package/src/types/schemas.ts +304 -235
- package/src/utils/toolHelpers.ts +11 -0
- package/tests/benchmark.test.d.ts +1 -1
- package/tests/benchmark.test.js +32 -32
- package/tests/benchmark.test.ts +38 -38
- package/tests/server.test.d.ts +1 -1
- package/tests/server.test.js +12 -12
- package/tests/server.test.ts +14 -14
- package/tests/setup.d.ts +3 -3
- package/tests/setup.js +16 -16
- package/tests/setup.ts +20 -20
- package/tests/tools/accounts.test.ts +159 -118
- package/tests/tools/categories.test.d.ts +1 -1
- package/tests/tools/categories.test.js +62 -62
- package/tests/tools/categories.test.ts +120 -78
- package/tests/tools/credit-cards.test.d.ts +1 -1
- package/tests/tools/credit-cards.test.js +70 -70
- package/tests/tools/credit-cards.test.ts +131 -89
- package/tests/tools/data.test.ts +100 -0
- package/tests/tools/settings.test.ts +116 -0
- package/tests/tools/subscriptions.test.ts +173 -0
- package/tests/tools/summary.test.d.ts +1 -1
- package/tests/tools/summary.test.js +35 -35
- package/tests/tools/summary.test.ts +63 -42
- package/tests/tools/transactions.test.d.ts +1 -1
- package/tests/tools/transactions.test.js +66 -66
- package/tests/tools/transactions.test.ts +133 -82
- package/tests/tools/transfers.test.ts +141 -0
- package/tsconfig.json +52 -52
- package/vitest.config.d.ts +2 -2
- package/vitest.config.js +13 -13
- package/vitest.config.ts +14 -14
package/CLAUDE.md
CHANGED
|
@@ -1,64 +1,70 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Commands
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm run build # Compile TypeScript → dist/
|
|
9
|
-
npm run dev # Run with tsx (no build required)
|
|
10
|
-
npm start # Run compiled dist/index.js
|
|
11
|
-
npm test # Run all tests with vitest
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Run a single test file:
|
|
15
|
-
```bash
|
|
16
|
-
npx vitest run tests/tools/categories.test.ts
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Inspect the MCP server interactively (requires a build first):
|
|
20
|
-
```bash
|
|
21
|
-
npx @modelcontextprotocol/inspector node dist/index.js
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Environment
|
|
25
|
-
|
|
26
|
-
Create `.env` in the project root:
|
|
27
|
-
```
|
|
28
|
-
QUANTIX_API_URL=https://api.quantix.example.com
|
|
29
|
-
QUANTIX_API_KEY=your_api_key_here
|
|
30
|
-
MCPPORT=3001
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
`QUANTIX_API_KEY` is required. `QUANTIX_API_URL` defaults to `https://api.quantix.example.com`.
|
|
34
|
-
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run build # Compile TypeScript → dist/
|
|
9
|
+
npm run dev # Run with tsx (no build required)
|
|
10
|
+
npm start # Run compiled dist/index.js
|
|
11
|
+
npm test # Run all tests with vitest
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Run a single test file:
|
|
15
|
+
```bash
|
|
16
|
+
npx vitest run tests/tools/categories.test.ts
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Inspect the MCP server interactively (requires a build first):
|
|
20
|
+
```bash
|
|
21
|
+
npx @modelcontextprotocol/inspector node dist/index.js
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Environment
|
|
25
|
+
|
|
26
|
+
Create `.env` in the project root:
|
|
27
|
+
```
|
|
28
|
+
QUANTIX_API_URL=https://api.quantix.example.com
|
|
29
|
+
QUANTIX_API_KEY=your_api_key_here
|
|
30
|
+
MCPPORT=3001
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`QUANTIX_API_KEY` is required. `QUANTIX_API_URL` defaults to `https://api.quantix.example.com`.
|
|
34
|
+
|
|
35
|
+
## Authentication
|
|
36
|
+
|
|
37
|
+
The MCP server uses **API Key authentication** via the `x-api-key` header for all requests to the Quantix API.
|
|
38
|
+
|
|
39
|
+
While the Quantix web application uses JWT (Bearer) tokens, they expire in 15 minutes, which is unsuitable for a persistent MCP server. Users **must** generate an API Key in the Quantix web settings to use with this server.
|
|
40
|
+
|
|
41
|
+
## Architecture
|
|
42
|
+
|
|
43
|
+
This is an MCP server that proxies Quantix Personal Finance API endpoints as MCP tools. It runs in **stdio mode** (for Claude Desktop / `npx quantix-mcp`).
|
|
44
|
+
|
|
45
|
+
**Data flow:** MCP client → `src/index.ts` (McpServer + StdioTransport) → tool handler → `src/services/apiClient.ts` → Quantix REST API
|
|
46
|
+
|
|
47
|
+
### Key files
|
|
48
|
+
|
|
49
|
+
| File | Role |
|
|
50
|
+
|------|------|
|
|
51
|
+
| `src/index.ts` | Creates `McpServer`, registers all tool groups, connects via `StdioServerTransport` |
|
|
52
|
+
| `src/config.ts` | Zod-validated env vars; exports `config` object |
|
|
53
|
+
| `src/services/apiClient.ts` | Thin `fetch` wrapper; injects `x-api-key` header; exports `apiClient.get/post/patch/put/delete` |
|
|
54
|
+
| `src/types/schemas.ts` | All Zod schemas — both domain entity schemas and tool input schemas |
|
|
55
|
+
| `src/tools/*.ts` | Each file exports a `register*Tools(server: McpServer)` function |
|
|
56
|
+
| `tests/setup.ts` | Vitest setup — mocks `global.fetch` and mocks `config` module |
|
|
57
|
+
|
|
58
|
+
### Adding a new tool group
|
|
59
|
+
|
|
60
|
+
1. Create `src/tools/mymodule.ts` exporting `registerMyModuleTools(server: McpServer)`.
|
|
61
|
+
2. Define input schemas in `src/types/schemas.ts`.
|
|
62
|
+
3. Import and call `registerMyModuleTools(mcpServer)` in `src/index.ts`.
|
|
63
|
+
4. Add a test file at `tests/tools/mymodule.test.ts` — mock `apiClient` (not `fetch`), create a mock server to capture registered handlers, then call handlers directly.
|
|
64
|
+
|
|
65
|
+
### Conventions
|
|
66
|
+
|
|
67
|
+
- All imports use `.js` extension (ESM `nodenext` module resolution), even for `.ts` source files.
|
|
68
|
+
- Tool handlers return `{ content: [{ type: 'text', text: '...' }] }`.
|
|
69
|
+
- The `mode` query param (`SINGLE` | `PENDING` | `ALL`) on transaction update/delete controls scope for recurring transactions.
|
|
70
|
+
- `ApiClientError` (from `apiClient.ts`) is thrown on non-2xx responses and includes `status` and `statusText`.
|
package/GEMINI.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Quantix MCP Server Context
|
|
2
|
+
|
|
3
|
+
This project is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that provides a bridge between AI models and the **Quantix Personal Finance API**. It allows AI assistants to manage accounts, transactions, categories, credit cards, and financial summaries.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
- **Purpose**: Expose Quantix API endpoints as MCP tools for personal finance management.
|
|
8
|
+
- **Authentication**: Uses **API Key authentication** (`x-api-key` header). Although the Quantix API supports JWT/Bearer tokens for web use, they expire every 15 minutes. For persistent MCP access, a long-lived API Key is required.
|
|
9
|
+
- **Architecture**:
|
|
10
|
+
- **Modular Tools**: Tools are categorized by domain (e.g., `accounts.ts`, `transactions.ts`) in `src/tools/`.
|
|
11
|
+
- **Centralized API Client**: `src/services/apiClient.ts` handles communication with the Quantix API using a singleton `apiClient`.
|
|
12
|
+
- **Schema Validation**: Extensive use of [Zod](https://zod.dev/) in `src/types/schemas.ts` to ensure input/output safety and provide descriptive metadata for the AI.
|
|
13
|
+
- **Configuration**: Managed via `dotenv` and validated with Zod in `src/config.ts`.
|
|
14
|
+
- **Key Technologies**: TypeScript, Node.js, @modelcontextprotocol/sdk, Zod, Vitest.
|
|
15
|
+
|
|
16
|
+
## Building and Running
|
|
17
|
+
|
|
18
|
+
### Prerequisites
|
|
19
|
+
- Node.js (v18+)
|
|
20
|
+
- Valid `QUANTIX_API_URL` and `QUANTIX_API_KEY` in a `.env` file.
|
|
21
|
+
|
|
22
|
+
### Commands
|
|
23
|
+
- **Install Dependencies**: `npm install`
|
|
24
|
+
- **Build**: `npm run build` (Compiles TypeScript to `dist/`)
|
|
25
|
+
- **Development**: `npm run dev` (Runs directly from source using `tsx`)
|
|
26
|
+
- **Production**: `npm start` (Runs the compiled `dist/index.js`)
|
|
27
|
+
- **Test**: `npm test` (Runs the test suite using Vitest)
|
|
28
|
+
- **MCP Inspector**: `npx @modelcontextprotocol/inspector node dist/index.js` (Recommended for interactive tool testing)
|
|
29
|
+
|
|
30
|
+
## Development Conventions
|
|
31
|
+
|
|
32
|
+
### Adding New Tools
|
|
33
|
+
1. Define the input/output schemas in `src/types/schemas.ts`.
|
|
34
|
+
2. Create or update the relevant domain file in `src/tools/`.
|
|
35
|
+
3. Use the `registerTool` method on the `McpServer` instance.
|
|
36
|
+
4. Export a registration function (e.g., `registerNewDomainTools`) and call it in `src/index.ts`.
|
|
37
|
+
|
|
38
|
+
### Error Handling
|
|
39
|
+
- Use the `handleToolError` helper from `src/utils/toolHelpers.ts` to provide consistent error messages to the AI.
|
|
40
|
+
- The `apiClient` throws `ApiClientError` for non-2xx responses, which includes the status code and status text.
|
|
41
|
+
|
|
42
|
+
### Tool Guidelines
|
|
43
|
+
- **Descriptions**: Always provide clear, detailed descriptions for tools and their arguments in the Zod schemas (using `.describe()`). This helps the AI understand when and how to use the tool.
|
|
44
|
+
- **Idempotency**: Ensure that "Get" operations are read-only and mutations follow standard REST patterns.
|
|
45
|
+
- **Validation**: Rely on Zod for input validation. If a required field is missing, the MCP SDK will automatically inform the user/AI.
|
|
46
|
+
|
|
47
|
+
### Testing
|
|
48
|
+
- Place tests in the `tests/` directory.
|
|
49
|
+
- Use `tests/setup.ts` to mock the global `fetch` and the project `config`.
|
|
50
|
+
- Aim for high coverage of tool logic by mocking various API responses.
|
|
51
|
+
|
|
52
|
+
## Environment Variables
|
|
53
|
+
| Variable | Description | Default |
|
|
54
|
+
|----------|-------------|---------|
|
|
55
|
+
| `QUANTIX_API_URL` | Base URL for the Quantix API | `https://api.quantix.example.com` |
|
|
56
|
+
| `QUANTIX_API_KEY` | Your secret API Key | (Required) |
|
|
57
|
+
| `MCPPORT` | Port for HTTP transport (if used) | `3001` |
|
|
58
|
+
| `NODE_ENV` | Environment mode | `development` |
|
package/README.md
CHANGED
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
# Quantix Personal Finance MCP Server
|
|
3
|
-
|
|
4
|
-
MCP (Model Context Protocol) server for the Quantix Personal Finance API. Exposes all endpoints as MCP tools with full input validation and modular architecture.
|
|
5
|
-
|
|
6
|
-
## Features
|
|
7
|
-
|
|
8
|
-
- **Accounts**: Manage bank accounts, wallets, savings, and investments.
|
|
9
|
-
- **Categories**: Create, list, update, and delete financial categories (INCOME/EXPENSE).
|
|
10
|
-
- **Credit Cards**: Manage cards, view/pay statements, and track statement status.
|
|
11
|
-
- **Transactions**: Full CRUD with filters (month, date range, account, category, card, type, paid status), recurring payments, and installment handling.
|
|
12
|
-
- **Transactions (paid status)**: Mark transactions as paid or unpaid.
|
|
13
|
-
- **Settings**: Manage global user preferences (name, currency, language).
|
|
14
|
-
- **Summary**: Financial summary by month or custom date range — income, expenses, balance, credit card totals, and category breakdowns.
|
|
15
|
-
- **Data**: Export and import a full backup of all user data.
|
|
16
|
-
|
|
17
|
-
All tool inputs are validated using [Zod](https://zod.dev/) schemas matching the OpenAPI spec.
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
|
|
21
|
-
- Node.js (v18 or higher)
|
|
22
|
-
- npm
|
|
23
|
-
- Access to Quantix API and API Key
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
26
|
-
|
|
27
|
-
1. Clone or navigate to the project repository.
|
|
28
|
-
2. Install dependencies:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Configuration
|
|
35
|
-
|
|
36
|
-
Create a `.env` file in the project root:
|
|
37
|
-
|
|
38
|
-
```env
|
|
39
|
-
QUANTIX_API_URL=https://api.quantix.example.com
|
|
40
|
-
QUANTIX_API_KEY=your_api_key_here
|
|
41
|
-
MCPPORT=3001
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Building the Project
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npm run build
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
The compiled output will be in the `dist` directory.
|
|
51
|
-
|
|
52
|
-
## Usage
|
|
53
|
-
|
|
54
|
-
### Quick Start (npx)
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npx quantix-mcp
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Make sure the environment variables (`QUANTIX_API_URL`, `QUANTIX_API_KEY`) are set in your environment.
|
|
61
|
-
|
|
62
|
-
### Development
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm run dev
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Production
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
npm start
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### MCP Inspector (Recommended for Testing)
|
|
75
|
-
|
|
76
|
-
1. Build the project:
|
|
77
|
-
```bash
|
|
78
|
-
npm run build
|
|
79
|
-
```
|
|
80
|
-
2. Run the inspector:
|
|
81
|
-
```bash
|
|
82
|
-
npx @modelcontextprotocol/inspector node dist/index.js
|
|
83
|
-
```
|
|
84
|
-
3. Open the provided URL to interact with your server.
|
|
85
|
-
|
|
86
|
-
## Exposed MCP Tools
|
|
87
|
-
|
|
88
|
-
| Category | Tool Name | Description |
|
|
89
|
-
|----------|-----------|-------------|
|
|
90
|
-
| **Accounts** | `create_account` | Create a new financial account |
|
|
91
|
-
| | `get_accounts` | List all accounts with current balances |
|
|
92
|
-
| | `get_account` | Get details of a specific account |
|
|
93
|
-
| | `update_account` | Update account name or type |
|
|
94
|
-
| | `delete_account` | Delete an account |
|
|
95
|
-
| | `get_account_balance` | Get current balance for an account |
|
|
96
|
-
| | `get_account_transactions` | List all transactions linked to an account |
|
|
97
|
-
| **Categories** | `create_category` | Create a new financial category (INCOME/EXPENSE) |
|
|
98
|
-
| | `get_categories` | List all categories |
|
|
99
|
-
| | `get_category` | Get a category by ID |
|
|
100
|
-
| | `update_category` | Update category name or color |
|
|
101
|
-
| | `delete_category` | Delete a category |
|
|
102
|
-
| **Credit Cards** | `create_credit_card` | Create a new credit card |
|
|
103
|
-
| | `get_credit_cards` | List all credit cards |
|
|
104
|
-
| | `get_credit_card` | Get a credit card by ID |
|
|
105
|
-
| | `update_credit_card` | Update credit card details |
|
|
106
|
-
| | `delete_credit_card` | Delete a credit card |
|
|
107
|
-
| | `get_statement` | Get statement for a specific month (`YYYY-MM`) |
|
|
108
|
-
| | `get_statement_status` | Get payment status of a statement |
|
|
109
|
-
| | `pay_statement` | Mark all statement transactions as paid |
|
|
110
|
-
| **Transactions** | `create_transaction` | Record a new income or expense |
|
|
111
|
-
| | `get_transactions` | List transactions — filters: `month`, `startDate`, `endDate`, `accountId`, `categoryId`, `creditCardId`, `type`, `paid` |
|
|
112
|
-
| | `get_transaction` | Get transaction details by ID |
|
|
113
|
-
| | `update_transaction` | Update a transaction (supports `mode`: SINGLE / PENDING / ALL for recurring/installments) |
|
|
114
|
-
| | `pay_transaction` | Mark a transaction as paid/received |
|
|
115
|
-
| | `unpay_transaction` | Mark a transaction as unpaid |
|
|
116
|
-
| | `delete_transaction` | Delete a transaction (supports `mode`: SINGLE / PENDING / ALL) |
|
|
117
|
-
| **Settings** | `create_settings` | Create global user settings (only if not yet created) |
|
|
118
|
-
| | `get_settings` | Get global settings |
|
|
119
|
-
| | `update_settings` | Update global settings |
|
|
120
|
-
| **Summary** | `get_summary` | Financial summary — provide `month` (YYYY-MM) **or** `startDate` + `endDate` (YYYY-MM-DD) |
|
|
121
|
-
| **Data** | `export_data` | Export all user data as a complete backup |
|
|
122
|
-
| | `import_data` | Import a backup (`mode`: `reset` clears all data first, `increment` skips existing IDs) |
|
|
123
|
-
|
|
124
|
-
See `openapi.yaml` at the project root for full endpoint and schema details.
|
|
125
|
-
|
|
126
|
-
## Setup with Claude Desktop
|
|
127
|
-
|
|
128
|
-
1. Locate your Claude Desktop configuration file:
|
|
129
|
-
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
130
|
-
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
131
|
-
|
|
132
|
-
2. Add the server configuration:
|
|
133
|
-
|
|
134
|
-
**Using npx (Recommended):**
|
|
135
|
-
|
|
136
|
-
```json
|
|
137
|
-
{
|
|
138
|
-
"mcpServers": {
|
|
139
|
-
"quantix": {
|
|
140
|
-
"command": "npx",
|
|
141
|
-
"args": ["-y", "quantix-mcp"],
|
|
142
|
-
"env": {
|
|
143
|
-
"QUANTIX_API_URL": "https://api.quantix.example.com",
|
|
144
|
-
"QUANTIX_API_KEY": "your_api_key_here"
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**Using local build (For developers):**
|
|
152
|
-
|
|
153
|
-
```json
|
|
154
|
-
{
|
|
155
|
-
"mcpServers": {
|
|
156
|
-
"quantix": {
|
|
157
|
-
"command": "node",
|
|
158
|
-
"args": ["/absolute/path/to/dist/index.js"],
|
|
159
|
-
"env": {
|
|
160
|
-
"QUANTIX_API_URL": "https://api.quantix.example.com",
|
|
161
|
-
"QUANTIX_API_KEY": "your_api_key_here"
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Testing
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
npm test
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## License
|
|
175
|
-
|
|
176
|
-
ISC
|
|
1
|
+
|
|
2
|
+
# Quantix Personal Finance MCP Server
|
|
3
|
+
|
|
4
|
+
MCP (Model Context Protocol) server for the Quantix Personal Finance API. Exposes all endpoints as MCP tools with full input validation and modular architecture.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **Accounts**: Manage bank accounts, wallets, savings, and investments.
|
|
9
|
+
- **Categories**: Create, list, update, and delete financial categories (INCOME/EXPENSE).
|
|
10
|
+
- **Credit Cards**: Manage cards, view/pay statements, and track statement status.
|
|
11
|
+
- **Transactions**: Full CRUD with filters (month, date range, account, category, card, type, paid status), recurring payments, and installment handling.
|
|
12
|
+
- **Transactions (paid status)**: Mark transactions as paid or unpaid.
|
|
13
|
+
- **Settings**: Manage global user preferences (name, currency, language).
|
|
14
|
+
- **Summary**: Financial summary by month or custom date range — income, expenses, balance, credit card totals, and category breakdowns.
|
|
15
|
+
- **Data**: Export and import a full backup of all user data.
|
|
16
|
+
|
|
17
|
+
All tool inputs are validated using [Zod](https://zod.dev/) schemas matching the OpenAPI spec.
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js (v18 or higher)
|
|
22
|
+
- npm
|
|
23
|
+
- Access to Quantix API and API Key
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
1. Clone or navigate to the project repository.
|
|
28
|
+
2. Install dependencies:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
Create a `.env` file in the project root:
|
|
37
|
+
|
|
38
|
+
```env
|
|
39
|
+
QUANTIX_API_URL=https://api.quantix.example.com
|
|
40
|
+
QUANTIX_API_KEY=your_api_key_here
|
|
41
|
+
MCPPORT=3001
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Building the Project
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm run build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The compiled output will be in the `dist` directory.
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
### Quick Start (npx)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx quantix-mcp
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Make sure the environment variables (`QUANTIX_API_URL`, `QUANTIX_API_KEY`) are set in your environment.
|
|
61
|
+
|
|
62
|
+
### Development
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm run dev
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Production
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm start
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### MCP Inspector (Recommended for Testing)
|
|
75
|
+
|
|
76
|
+
1. Build the project:
|
|
77
|
+
```bash
|
|
78
|
+
npm run build
|
|
79
|
+
```
|
|
80
|
+
2. Run the inspector:
|
|
81
|
+
```bash
|
|
82
|
+
npx @modelcontextprotocol/inspector node dist/index.js
|
|
83
|
+
```
|
|
84
|
+
3. Open the provided URL to interact with your server.
|
|
85
|
+
|
|
86
|
+
## Exposed MCP Tools
|
|
87
|
+
|
|
88
|
+
| Category | Tool Name | Description |
|
|
89
|
+
|----------|-----------|-------------|
|
|
90
|
+
| **Accounts** | `create_account` | Create a new financial account |
|
|
91
|
+
| | `get_accounts` | List all accounts with current balances |
|
|
92
|
+
| | `get_account` | Get details of a specific account |
|
|
93
|
+
| | `update_account` | Update account name or type |
|
|
94
|
+
| | `delete_account` | Delete an account |
|
|
95
|
+
| | `get_account_balance` | Get current balance for an account |
|
|
96
|
+
| | `get_account_transactions` | List all transactions linked to an account |
|
|
97
|
+
| **Categories** | `create_category` | Create a new financial category (INCOME/EXPENSE) |
|
|
98
|
+
| | `get_categories` | List all categories |
|
|
99
|
+
| | `get_category` | Get a category by ID |
|
|
100
|
+
| | `update_category` | Update category name or color |
|
|
101
|
+
| | `delete_category` | Delete a category |
|
|
102
|
+
| **Credit Cards** | `create_credit_card` | Create a new credit card |
|
|
103
|
+
| | `get_credit_cards` | List all credit cards |
|
|
104
|
+
| | `get_credit_card` | Get a credit card by ID |
|
|
105
|
+
| | `update_credit_card` | Update credit card details |
|
|
106
|
+
| | `delete_credit_card` | Delete a credit card |
|
|
107
|
+
| | `get_statement` | Get statement for a specific month (`YYYY-MM`) |
|
|
108
|
+
| | `get_statement_status` | Get payment status of a statement |
|
|
109
|
+
| | `pay_statement` | Mark all statement transactions as paid |
|
|
110
|
+
| **Transactions** | `create_transaction` | Record a new income or expense |
|
|
111
|
+
| | `get_transactions` | List transactions — filters: `month`, `startDate`, `endDate`, `accountId`, `categoryId`, `creditCardId`, `type`, `paid` |
|
|
112
|
+
| | `get_transaction` | Get transaction details by ID |
|
|
113
|
+
| | `update_transaction` | Update a transaction (supports `mode`: SINGLE / PENDING / ALL for recurring/installments) |
|
|
114
|
+
| | `pay_transaction` | Mark a transaction as paid/received |
|
|
115
|
+
| | `unpay_transaction` | Mark a transaction as unpaid |
|
|
116
|
+
| | `delete_transaction` | Delete a transaction (supports `mode`: SINGLE / PENDING / ALL) |
|
|
117
|
+
| **Settings** | `create_settings` | Create global user settings (only if not yet created) |
|
|
118
|
+
| | `get_settings` | Get global settings |
|
|
119
|
+
| | `update_settings` | Update global settings |
|
|
120
|
+
| **Summary** | `get_summary` | Financial summary — provide `month` (YYYY-MM) **or** `startDate` + `endDate` (YYYY-MM-DD) |
|
|
121
|
+
| **Data** | `export_data` | Export all user data as a complete backup |
|
|
122
|
+
| | `import_data` | Import a backup (`mode`: `reset` clears all data first, `increment` skips existing IDs) |
|
|
123
|
+
|
|
124
|
+
See `openapi.yaml` at the project root for full endpoint and schema details.
|
|
125
|
+
|
|
126
|
+
## Setup with Claude Desktop
|
|
127
|
+
|
|
128
|
+
1. Locate your Claude Desktop configuration file:
|
|
129
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
130
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
131
|
+
|
|
132
|
+
2. Add the server configuration:
|
|
133
|
+
|
|
134
|
+
**Using npx (Recommended):**
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"mcpServers": {
|
|
139
|
+
"quantix": {
|
|
140
|
+
"command": "npx",
|
|
141
|
+
"args": ["-y", "quantix-mcp"],
|
|
142
|
+
"env": {
|
|
143
|
+
"QUANTIX_API_URL": "https://api.quantix.example.com",
|
|
144
|
+
"QUANTIX_API_KEY": "your_api_key_here"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Using local build (For developers):**
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"mcpServers": {
|
|
156
|
+
"quantix": {
|
|
157
|
+
"command": "node",
|
|
158
|
+
"args": ["/absolute/path/to/dist/index.js"],
|
|
159
|
+
"env": {
|
|
160
|
+
"QUANTIX_API_URL": "https://api.quantix.example.com",
|
|
161
|
+
"QUANTIX_API_KEY": "your_api_key_here"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Testing
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
npm test
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
ISC
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAwBpE,wBAAgB,SAAS,cAsBxB"}
|
package/dist/index.js
CHANGED
|
@@ -11,13 +11,22 @@ import { registerTransactionTools } from './tools/transactions.js';
|
|
|
11
11
|
import { registerSummaryTools } from './tools/summary.js';
|
|
12
12
|
import { registerAccountTools } from './tools/accounts.js';
|
|
13
13
|
import { registerSettingsTools } from './tools/settings.js';
|
|
14
|
+
import { registerTransferTools } from './tools/transfers.js';
|
|
14
15
|
import { registerDataTools } from './tools/data.js';
|
|
16
|
+
import { registerSubscriptionTools } from './tools/subscriptions.js';
|
|
17
|
+
import { readFileSync } from 'fs';
|
|
18
|
+
import { fileURLToPath } from 'url';
|
|
19
|
+
import { dirname, join } from 'path';
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = dirname(__filename);
|
|
22
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
15
23
|
export function getServer() {
|
|
16
24
|
const mcpServer = new McpServer({
|
|
17
25
|
name: 'quantix_mcp_server',
|
|
18
|
-
version:
|
|
26
|
+
version: pkg.version,
|
|
27
|
+
description: 'MCP server for Quantix personal finance management',
|
|
19
28
|
});
|
|
20
|
-
console.
|
|
29
|
+
console.error('Quantix MCP server started');
|
|
21
30
|
// Register Tools here
|
|
22
31
|
registerCategoryTools(mcpServer);
|
|
23
32
|
registerCreditCardTools(mcpServer);
|
|
@@ -25,14 +34,16 @@ export function getServer() {
|
|
|
25
34
|
registerSummaryTools(mcpServer);
|
|
26
35
|
registerAccountTools(mcpServer);
|
|
27
36
|
registerSettingsTools(mcpServer);
|
|
37
|
+
registerTransferTools(mcpServer);
|
|
28
38
|
registerDataTools(mcpServer);
|
|
39
|
+
registerSubscriptionTools(mcpServer);
|
|
29
40
|
return mcpServer;
|
|
30
41
|
}
|
|
31
42
|
async function main() {
|
|
32
43
|
const transport = new StdioServerTransport();
|
|
33
44
|
const mcpServer = getServer();
|
|
34
45
|
await mcpServer.connect(transport);
|
|
35
|
-
console.log('MCP server is running...');
|
|
46
|
+
console.log('Quantix MCP server is running...');
|
|
36
47
|
}
|
|
37
48
|
main().catch(error => {
|
|
38
49
|
console.error('Server error:', error);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,OAAO,EAAE,EAA+B,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,OAAO,EAAE,EAA+B,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAElF,MAAM,UAAU,SAAS;IACrB,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;QAC5B,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,WAAW,EAAE,oDAAoD;KACpE,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAE5C,sBAAsB;IACtB,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACjC,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACnC,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACpC,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAChC,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAChC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAEjC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACjC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7B,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAErC,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,KAAK,UAAU,IAAI;IACf,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;IAC9B,MAAM,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AACpD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/tools/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/tools/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,QAmHrD"}
|