quantix-mcp 0.4.5 → 0.4.8
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/commands/opsx/apply.md +152 -0
- package/.claude/commands/opsx/archive.md +157 -0
- package/.claude/commands/opsx/bulk-archive.md +242 -0
- package/.claude/commands/opsx/continue.md +114 -0
- package/.claude/commands/opsx/explore.md +174 -0
- package/.claude/commands/opsx/ff.md +94 -0
- package/.claude/commands/opsx/new.md +69 -0
- package/.claude/commands/opsx/onboard.md +525 -0
- package/.claude/commands/opsx/sync.md +134 -0
- package/.claude/commands/opsx/verify.md +164 -0
- package/.claude/settings.local.json +2 -1
- package/.claude/skills/openspec-apply-change/SKILL.md +156 -0
- package/.claude/skills/openspec-archive-change/SKILL.md +114 -0
- package/.claude/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.claude/skills/openspec-continue-change/SKILL.md +118 -0
- package/.claude/skills/openspec-explore/SKILL.md +290 -0
- package/.claude/skills/openspec-ff-change/SKILL.md +101 -0
- package/.claude/skills/openspec-new-change/SKILL.md +74 -0
- package/.claude/skills/openspec-onboard/SKILL.md +529 -0
- package/.claude/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.claude/skills/openspec-verify-change/SKILL.md +168 -0
- package/.dockerignore +8 -0
- package/.gemini/commands/opsx/apply.toml +149 -0
- package/.gemini/commands/opsx/archive.toml +154 -0
- package/.gemini/commands/opsx/bulk-archive.toml +239 -0
- package/.gemini/commands/opsx/continue.toml +111 -0
- package/.gemini/commands/opsx/explore.toml +171 -0
- package/.gemini/commands/opsx/ff.toml +91 -0
- package/.gemini/commands/opsx/new.toml +66 -0
- package/.gemini/commands/opsx/onboard.toml +522 -0
- package/.gemini/commands/opsx/sync.toml +131 -0
- package/.gemini/commands/opsx/verify.toml +161 -0
- package/.gemini/skills/openspec-apply-change/SKILL.md +156 -0
- package/.gemini/skills/openspec-archive-change/SKILL.md +114 -0
- package/.gemini/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.gemini/skills/openspec-continue-change/SKILL.md +118 -0
- package/.gemini/skills/openspec-explore/SKILL.md +290 -0
- package/.gemini/skills/openspec-ff-change/SKILL.md +101 -0
- package/.gemini/skills/openspec-new-change/SKILL.md +74 -0
- package/.gemini/skills/openspec-onboard/SKILL.md +529 -0
- package/.gemini/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.gemini/skills/openspec-verify-change/SKILL.md +168 -0
- package/.qwen/commands/opsx-apply.toml +149 -0
- package/.qwen/commands/opsx-archive.toml +154 -0
- package/.qwen/commands/opsx-bulk-archive.toml +239 -0
- package/.qwen/commands/opsx-continue.toml +111 -0
- package/.qwen/commands/opsx-explore.toml +171 -0
- package/.qwen/commands/opsx-ff.toml +91 -0
- package/.qwen/commands/opsx-new.toml +66 -0
- package/.qwen/commands/opsx-onboard.toml +522 -0
- package/.qwen/commands/opsx-sync.toml +131 -0
- package/.qwen/commands/opsx-verify.toml +161 -0
- package/.qwen/skills/openspec-apply-change/SKILL.md +156 -0
- package/.qwen/skills/openspec-archive-change/SKILL.md +114 -0
- package/.qwen/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.qwen/skills/openspec-continue-change/SKILL.md +118 -0
- package/.qwen/skills/openspec-explore/SKILL.md +290 -0
- package/.qwen/skills/openspec-ff-change/SKILL.md +101 -0
- package/.qwen/skills/openspec-new-change/SKILL.md +74 -0
- package/.qwen/skills/openspec-onboard/SKILL.md +529 -0
- package/.qwen/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.qwen/skills/openspec-verify-change/SKILL.md +168 -0
- package/AGENTS.md +117 -0
- package/Dockerfile +30 -0
- package/GEMINI.md +59 -0
- package/QWEN.md +117 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/dist/tools/transactions.d.ts.map +1 -1
- package/dist/tools/transactions.js +33 -3
- package/dist/tools/transactions.js.map +1 -1
- package/dist/types/schemas.d.ts +66 -7
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +36 -10
- package/dist/types/schemas.js.map +1 -1
- package/docker-compose.yml +9 -0
- package/openapi.yaml +212 -54
- package/openspec/README.md +33 -0
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/.openspec.yaml +2 -0
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/design.md +60 -0
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/proposal.md +25 -0
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/specs/credit-card-transactions/spec.md +46 -0
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/specs/transactions/spec.md +42 -0
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/tasks.md +22 -0
- package/openspec/config.yaml +20 -0
- package/openspec/specs/accounts/spec.md +86 -0
- package/openspec/specs/categories/spec.md +78 -0
- package/openspec/specs/credit-card-transactions/spec.md +64 -0
- package/openspec/specs/credit-cards/spec.md +109 -0
- package/openspec/specs/data/spec.md +49 -0
- package/openspec/specs/settings/spec.md +48 -0
- package/openspec/specs/subscriptions/spec.md +85 -0
- package/openspec/specs/summary/spec.md +49 -0
- package/openspec/specs/transactions/spec.md +113 -0
- package/openspec/specs/transfers/spec.md +74 -0
- package/package.json +1 -1
- package/src/config.ts +4 -1
- package/src/index.ts +35 -5
- package/src/tools/transactions.ts +47 -3
- package/src/types/schemas.ts +40 -10
- package/tests/tools/accounts.test.ts +1 -1
- package/tests/tools/credit-cards.test.ts +1 -1
- package/tests/tools/transactions.test.ts +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openspec-verify-change
|
|
3
|
+
description: Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires openspec CLI.
|
|
6
|
+
metadata:
|
|
7
|
+
author: openspec
|
|
8
|
+
version: "1.0"
|
|
9
|
+
generatedBy: "1.1.1"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Verify that an implementation matches the change artifacts (specs, tasks, design).
|
|
13
|
+
|
|
14
|
+
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
|
|
18
|
+
1. **If no change name provided, prompt for selection**
|
|
19
|
+
|
|
20
|
+
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
21
|
+
|
|
22
|
+
Show changes that have implementation tasks (tasks artifact exists).
|
|
23
|
+
Include the schema used for each change if available.
|
|
24
|
+
Mark changes with incomplete tasks as "(In Progress)".
|
|
25
|
+
|
|
26
|
+
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
27
|
+
|
|
28
|
+
2. **Check status to understand the schema**
|
|
29
|
+
```bash
|
|
30
|
+
openspec status --change "<name>" --json
|
|
31
|
+
```
|
|
32
|
+
Parse the JSON to understand:
|
|
33
|
+
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
|
34
|
+
- Which artifacts exist for this change
|
|
35
|
+
|
|
36
|
+
3. **Get the change directory and load artifacts**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
openspec instructions apply --change "<name>" --json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This returns the change directory and context files. Read all available artifacts from `contextFiles`.
|
|
43
|
+
|
|
44
|
+
4. **Initialize verification report structure**
|
|
45
|
+
|
|
46
|
+
Create a report structure with three dimensions:
|
|
47
|
+
- **Completeness**: Track tasks and spec coverage
|
|
48
|
+
- **Correctness**: Track requirement implementation and scenario coverage
|
|
49
|
+
- **Coherence**: Track design adherence and pattern consistency
|
|
50
|
+
|
|
51
|
+
Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
|
|
52
|
+
|
|
53
|
+
5. **Verify Completeness**
|
|
54
|
+
|
|
55
|
+
**Task Completion**:
|
|
56
|
+
- If tasks.md exists in contextFiles, read it
|
|
57
|
+
- Parse checkboxes: `- [ ]` (incomplete) vs `- [x]` (complete)
|
|
58
|
+
- Count complete vs total tasks
|
|
59
|
+
- If incomplete tasks exist:
|
|
60
|
+
- Add CRITICAL issue for each incomplete task
|
|
61
|
+
- Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
|
|
62
|
+
|
|
63
|
+
**Spec Coverage**:
|
|
64
|
+
- If delta specs exist in `openspec/changes/<name>/specs/`:
|
|
65
|
+
- Extract all requirements (marked with "### Requirement:")
|
|
66
|
+
- For each requirement:
|
|
67
|
+
- Search codebase for keywords related to the requirement
|
|
68
|
+
- Assess if implementation likely exists
|
|
69
|
+
- If requirements appear unimplemented:
|
|
70
|
+
- Add CRITICAL issue: "Requirement not found: <requirement name>"
|
|
71
|
+
- Recommendation: "Implement requirement X: <description>"
|
|
72
|
+
|
|
73
|
+
6. **Verify Correctness**
|
|
74
|
+
|
|
75
|
+
**Requirement Implementation Mapping**:
|
|
76
|
+
- For each requirement from delta specs:
|
|
77
|
+
- Search codebase for implementation evidence
|
|
78
|
+
- If found, note file paths and line ranges
|
|
79
|
+
- Assess if implementation matches requirement intent
|
|
80
|
+
- If divergence detected:
|
|
81
|
+
- Add WARNING: "Implementation may diverge from spec: <details>"
|
|
82
|
+
- Recommendation: "Review <file>:<lines> against requirement X"
|
|
83
|
+
|
|
84
|
+
**Scenario Coverage**:
|
|
85
|
+
- For each scenario in delta specs (marked with "#### Scenario:"):
|
|
86
|
+
- Check if conditions are handled in code
|
|
87
|
+
- Check if tests exist covering the scenario
|
|
88
|
+
- If scenario appears uncovered:
|
|
89
|
+
- Add WARNING: "Scenario not covered: <scenario name>"
|
|
90
|
+
- Recommendation: "Add test or implementation for scenario: <description>"
|
|
91
|
+
|
|
92
|
+
7. **Verify Coherence**
|
|
93
|
+
|
|
94
|
+
**Design Adherence**:
|
|
95
|
+
- If design.md exists in contextFiles:
|
|
96
|
+
- Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
|
|
97
|
+
- Verify implementation follows those decisions
|
|
98
|
+
- If contradiction detected:
|
|
99
|
+
- Add WARNING: "Design decision not followed: <decision>"
|
|
100
|
+
- Recommendation: "Update implementation or revise design.md to match reality"
|
|
101
|
+
- If no design.md: Skip design adherence check, note "No design.md to verify against"
|
|
102
|
+
|
|
103
|
+
**Code Pattern Consistency**:
|
|
104
|
+
- Review new code for consistency with project patterns
|
|
105
|
+
- Check file naming, directory structure, coding style
|
|
106
|
+
- If significant deviations found:
|
|
107
|
+
- Add SUGGESTION: "Code pattern deviation: <details>"
|
|
108
|
+
- Recommendation: "Consider following project pattern: <example>"
|
|
109
|
+
|
|
110
|
+
8. **Generate Verification Report**
|
|
111
|
+
|
|
112
|
+
**Summary Scorecard**:
|
|
113
|
+
```
|
|
114
|
+
## Verification Report: <change-name>
|
|
115
|
+
|
|
116
|
+
### Summary
|
|
117
|
+
| Dimension | Status |
|
|
118
|
+
|--------------|------------------|
|
|
119
|
+
| Completeness | X/Y tasks, N reqs|
|
|
120
|
+
| Correctness | M/N reqs covered |
|
|
121
|
+
| Coherence | Followed/Issues |
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Issues by Priority**:
|
|
125
|
+
|
|
126
|
+
1. **CRITICAL** (Must fix before archive):
|
|
127
|
+
- Incomplete tasks
|
|
128
|
+
- Missing requirement implementations
|
|
129
|
+
- Each with specific, actionable recommendation
|
|
130
|
+
|
|
131
|
+
2. **WARNING** (Should fix):
|
|
132
|
+
- Spec/design divergences
|
|
133
|
+
- Missing scenario coverage
|
|
134
|
+
- Each with specific recommendation
|
|
135
|
+
|
|
136
|
+
3. **SUGGESTION** (Nice to fix):
|
|
137
|
+
- Pattern inconsistencies
|
|
138
|
+
- Minor improvements
|
|
139
|
+
- Each with specific recommendation
|
|
140
|
+
|
|
141
|
+
**Final Assessment**:
|
|
142
|
+
- If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
|
|
143
|
+
- If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
|
|
144
|
+
- If all clear: "All checks passed. Ready for archive."
|
|
145
|
+
|
|
146
|
+
**Verification Heuristics**
|
|
147
|
+
|
|
148
|
+
- **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
|
|
149
|
+
- **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
|
|
150
|
+
- **Coherence**: Look for glaring inconsistencies, don't nitpick style
|
|
151
|
+
- **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
|
|
152
|
+
- **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
|
|
153
|
+
|
|
154
|
+
**Graceful Degradation**
|
|
155
|
+
|
|
156
|
+
- If only tasks.md exists: verify task completion only, skip spec/design checks
|
|
157
|
+
- If tasks + specs exist: verify completeness and correctness, skip design
|
|
158
|
+
- If full artifacts: verify all three dimensions
|
|
159
|
+
- Always note which checks were skipped and why
|
|
160
|
+
|
|
161
|
+
**Output Format**
|
|
162
|
+
|
|
163
|
+
Use clear markdown with:
|
|
164
|
+
- Table for summary scorecard
|
|
165
|
+
- Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
|
|
166
|
+
- Code references in format: `file.ts:123`
|
|
167
|
+
- Specific, actionable recommendations
|
|
168
|
+
- No vague suggestions like "consider reviewing"
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
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` |
|
|
59
|
+
|
|
60
|
+
# context-mode — MANDATORY routing rules
|
|
61
|
+
|
|
62
|
+
You have context-mode MCP tools available. These rules are NOT optional — they protect your context window from flooding. A single unrouted command can dump 56 KB into context and waste the entire session.
|
|
63
|
+
|
|
64
|
+
## BLOCKED commands — do NOT attempt these
|
|
65
|
+
|
|
66
|
+
### curl / wget — BLOCKED
|
|
67
|
+
Any shell command containing `curl` or `wget` will be intercepted and blocked. Do NOT retry.
|
|
68
|
+
Instead use:
|
|
69
|
+
- `mcp__context-mode__ctx_fetch_and_index(url, source)` to fetch and index web pages
|
|
70
|
+
- `mcp__context-mode__ctx_execute(language: "javascript", code: "const r = await fetch(...)")` to run HTTP calls in sandbox
|
|
71
|
+
|
|
72
|
+
### Inline HTTP — BLOCKED
|
|
73
|
+
Any shell command containing `fetch('http`, `requests.get(`, `requests.post(`, `http.get(`, or `http.request(` will be intercepted and blocked. Do NOT retry with shell.
|
|
74
|
+
Instead use:
|
|
75
|
+
- `mcp__context-mode__ctx_execute(language, code)` to run HTTP calls in sandbox — only stdout enters context
|
|
76
|
+
|
|
77
|
+
### WebFetch / web browsing — BLOCKED
|
|
78
|
+
Direct web fetching is blocked. Use the sandbox equivalent.
|
|
79
|
+
Instead use:
|
|
80
|
+
- `mcp__context-mode__ctx_fetch_and_index(url, source)` then `mcp__context-mode__ctx_search(queries)` to query the indexed content
|
|
81
|
+
|
|
82
|
+
## REDIRECTED tools — use sandbox equivalents
|
|
83
|
+
|
|
84
|
+
### Shell (>20 lines output)
|
|
85
|
+
Shell is ONLY for: `git`, `mkdir`, `rm`, `mv`, `cd`, `ls`, `npm install`, `pip install`, and other short-output commands.
|
|
86
|
+
For everything else, use:
|
|
87
|
+
- `mcp__context-mode__ctx_batch_execute(commands, queries)` — run multiple commands + search in ONE call
|
|
88
|
+
- `mcp__context-mode__ctx_execute(language: "shell", code: "...")` — run in sandbox, only stdout enters context
|
|
89
|
+
|
|
90
|
+
### read_file (for analysis)
|
|
91
|
+
If you are reading a file to **edit** it → read_file is correct (edit needs content in context).
|
|
92
|
+
If you are reading to **analyze, explore, or summarize** → use `mcp__context-mode__ctx_execute_file(path, language, code)` instead. Only your printed summary enters context.
|
|
93
|
+
|
|
94
|
+
### grep / search (large results)
|
|
95
|
+
Search results can flood context. Use `mcp__context-mode__ctx_execute(language: "shell", code: "grep ...")` to run searches in sandbox. Only your printed summary enters context.
|
|
96
|
+
|
|
97
|
+
## Tool selection hierarchy
|
|
98
|
+
|
|
99
|
+
1. **GATHER**: `mcp__context-mode__ctx_batch_execute(commands, queries)` — Primary tool. Runs all commands, auto-indexes output, returns search results. ONE call replaces 30+ individual calls.
|
|
100
|
+
2. **FOLLOW-UP**: `mcp__context-mode__ctx_search(queries: ["q1", "q2", ...])` — Query indexed content. Pass ALL questions as array in ONE call.
|
|
101
|
+
3. **PROCESSING**: `mcp__context-mode__ctx_execute(language, code)` | `mcp__context-mode__ctx_execute_file(path, language, code)` — Sandbox execution. Only stdout enters context.
|
|
102
|
+
4. **WEB**: `mcp__context-mode__ctx_fetch_and_index(url, source)` then `mcp__context-mode__ctx_search(queries)` — Fetch, chunk, index, query. Raw HTML never enters context.
|
|
103
|
+
5. **INDEX**: `mcp__context-mode__ctx_index(content, source)` — Store content in FTS5 knowledge base for later search.
|
|
104
|
+
|
|
105
|
+
## Output constraints
|
|
106
|
+
|
|
107
|
+
- Keep responses under 500 words.
|
|
108
|
+
- Write artifacts (code, configs, PRDs) to FILES — never return them as inline text. Return only: file path + 1-line description.
|
|
109
|
+
- When indexing content, use descriptive source labels so others can `search(source: "label")` later.
|
|
110
|
+
|
|
111
|
+
## ctx commands
|
|
112
|
+
|
|
113
|
+
| Command | Action |
|
|
114
|
+
|---------|--------|
|
|
115
|
+
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
116
|
+
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
117
|
+
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
package/Dockerfile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Build stage
|
|
2
|
+
FROM node:22-alpine AS builder
|
|
3
|
+
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
|
|
6
|
+
COPY package*.json ./
|
|
7
|
+
RUN npm ci
|
|
8
|
+
|
|
9
|
+
COPY tsconfig.json ./
|
|
10
|
+
COPY src/ ./src/
|
|
11
|
+
|
|
12
|
+
RUN npm run build
|
|
13
|
+
|
|
14
|
+
# Production stage
|
|
15
|
+
FROM node:22-alpine AS runner
|
|
16
|
+
|
|
17
|
+
WORKDIR /app
|
|
18
|
+
|
|
19
|
+
COPY package*.json ./
|
|
20
|
+
RUN npm ci --omit=dev
|
|
21
|
+
|
|
22
|
+
COPY --from=builder /app/dist ./dist
|
|
23
|
+
|
|
24
|
+
ENV TRANSPORT=http
|
|
25
|
+
ENV MCPPORT=3001
|
|
26
|
+
ENV NODE_ENV=production
|
|
27
|
+
|
|
28
|
+
EXPOSE 3001
|
|
29
|
+
|
|
30
|
+
CMD ["node", "dist/index.js"]
|
package/GEMINI.md
CHANGED
|
@@ -56,3 +56,62 @@ This project is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io
|
|
|
56
56
|
| `QUANTIX_API_KEY` | Your secret API Key | (Required) |
|
|
57
57
|
| `MCPPORT` | Port for HTTP transport (if used) | `3001` |
|
|
58
58
|
| `NODE_ENV` | Environment mode | `development` |
|
|
59
|
+
|
|
60
|
+
# context-mode — MANDATORY routing rules
|
|
61
|
+
|
|
62
|
+
You have context-mode MCP tools available. These rules are NOT optional — they protect your context window from flooding. A single unrouted command can dump 56 KB into context and waste the entire session.
|
|
63
|
+
|
|
64
|
+
## BLOCKED commands — do NOT attempt these
|
|
65
|
+
|
|
66
|
+
### curl / wget — BLOCKED
|
|
67
|
+
Any shell command containing `curl` or `wget` will be intercepted and blocked. Do NOT retry.
|
|
68
|
+
Instead use:
|
|
69
|
+
- `mcp__context-mode__ctx_fetch_and_index(url, source)` to fetch and index web pages
|
|
70
|
+
- `mcp__context-mode__ctx_execute(language: "javascript", code: "const r = await fetch(...)")` to run HTTP calls in sandbox
|
|
71
|
+
|
|
72
|
+
### Inline HTTP — BLOCKED
|
|
73
|
+
Any shell command containing `fetch('http`, `requests.get(`, `requests.post(`, `http.get(`, or `http.request(` will be intercepted and blocked. Do NOT retry with shell.
|
|
74
|
+
Instead use:
|
|
75
|
+
- `mcp__context-mode__ctx_execute(language, code)` to run HTTP calls in sandbox — only stdout enters context
|
|
76
|
+
|
|
77
|
+
### WebFetch / web browsing — BLOCKED
|
|
78
|
+
Direct web fetching is blocked. Use the sandbox equivalent.
|
|
79
|
+
Instead use:
|
|
80
|
+
- `mcp__context-mode__ctx_fetch_and_index(url, source)` then `mcp__context-mode__ctx_search(queries)` to query the indexed content
|
|
81
|
+
|
|
82
|
+
## REDIRECTED tools — use sandbox equivalents
|
|
83
|
+
|
|
84
|
+
### Shell (>20 lines output)
|
|
85
|
+
Shell is ONLY for: `git`, `mkdir`, `rm`, `mv`, `cd`, `ls`, `npm install`, `pip install`, and other short-output commands.
|
|
86
|
+
For everything else, use:
|
|
87
|
+
- `mcp__context-mode__ctx_batch_execute(commands, queries)` — run multiple commands + search in ONE call
|
|
88
|
+
- `mcp__context-mode__ctx_execute(language: "shell", code: "...")` — run in sandbox, only stdout enters context
|
|
89
|
+
|
|
90
|
+
### read_file (for analysis)
|
|
91
|
+
If you are reading a file to **edit** it → read_file is correct (edit needs content in context).
|
|
92
|
+
If you are reading to **analyze, explore, or summarize** → use `mcp__context-mode__ctx_execute_file(path, language, code)` instead. Only your printed summary enters context.
|
|
93
|
+
|
|
94
|
+
### grep / search (large results)
|
|
95
|
+
Search results can flood context. Use `mcp__context-mode__ctx_execute(language: "shell", code: "grep ...")` to run searches in sandbox. Only your printed summary enters context.
|
|
96
|
+
|
|
97
|
+
## Tool selection hierarchy
|
|
98
|
+
|
|
99
|
+
1. **GATHER**: `mcp__context-mode__ctx_batch_execute(commands, queries)` — Primary tool. Runs all commands, auto-indexes output, returns search results. ONE call replaces 30+ individual calls.
|
|
100
|
+
2. **FOLLOW-UP**: `mcp__context-mode__ctx_search(queries: ["q1", "q2", ...])` — Query indexed content. Pass ALL questions as array in ONE call.
|
|
101
|
+
3. **PROCESSING**: `mcp__context-mode__ctx_execute(language, code)` | `mcp__context-mode__ctx_execute_file(path, language, code)` — Sandbox execution. Only stdout enters context.
|
|
102
|
+
4. **WEB**: `mcp__context-mode__ctx_fetch_and_index(url, source)` then `mcp__context-mode__ctx_search(queries)` — Fetch, chunk, index, query. Raw HTML never enters context.
|
|
103
|
+
5. **INDEX**: `mcp__context-mode__ctx_index(content, source)` — Store content in FTS5 knowledge base for later search.
|
|
104
|
+
|
|
105
|
+
## Output constraints
|
|
106
|
+
|
|
107
|
+
- Keep responses under 500 words.
|
|
108
|
+
- Write artifacts (code, configs, PRDs) to FILES — never return them as inline text. Return only: file path + 1-line description.
|
|
109
|
+
- When indexing content, use descriptive source labels so others can `search(source: "label")` later.
|
|
110
|
+
|
|
111
|
+
## ctx commands
|
|
112
|
+
|
|
113
|
+
| Command | Action |
|
|
114
|
+
|---------|--------|
|
|
115
|
+
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
116
|
+
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
117
|
+
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
package/QWEN.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
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` |
|
|
59
|
+
|
|
60
|
+
# context-mode — MANDATORY routing rules
|
|
61
|
+
|
|
62
|
+
You have context-mode MCP tools available. These rules are NOT optional — they protect your context window from flooding. A single unrouted command can dump 56 KB into context and waste the entire session.
|
|
63
|
+
|
|
64
|
+
## BLOCKED commands — do NOT attempt these
|
|
65
|
+
|
|
66
|
+
### curl / wget — BLOCKED
|
|
67
|
+
Any shell command containing `curl` or `wget` will be intercepted and blocked. Do NOT retry.
|
|
68
|
+
Instead use:
|
|
69
|
+
- `mcp__context-mode__ctx_fetch_and_index(url, source)` to fetch and index web pages
|
|
70
|
+
- `mcp__context-mode__ctx_execute(language: "javascript", code: "const r = await fetch(...)")` to run HTTP calls in sandbox
|
|
71
|
+
|
|
72
|
+
### Inline HTTP — BLOCKED
|
|
73
|
+
Any shell command containing `fetch('http`, `requests.get(`, `requests.post(`, `http.get(`, or `http.request(` will be intercepted and blocked. Do NOT retry with shell.
|
|
74
|
+
Instead use:
|
|
75
|
+
- `mcp__context-mode__ctx_execute(language, code)` to run HTTP calls in sandbox — only stdout enters context
|
|
76
|
+
|
|
77
|
+
### WebFetch / web browsing — BLOCKED
|
|
78
|
+
Direct web fetching is blocked. Use the sandbox equivalent.
|
|
79
|
+
Instead use:
|
|
80
|
+
- `mcp__context-mode__ctx_fetch_and_index(url, source)` then `mcp__context-mode__ctx_search(queries)` to query the indexed content
|
|
81
|
+
|
|
82
|
+
## REDIRECTED tools — use sandbox equivalents
|
|
83
|
+
|
|
84
|
+
### Shell (>20 lines output)
|
|
85
|
+
Shell is ONLY for: `git`, `mkdir`, `rm`, `mv`, `cd`, `ls`, `npm install`, `pip install`, and other short-output commands.
|
|
86
|
+
For everything else, use:
|
|
87
|
+
- `mcp__context-mode__ctx_batch_execute(commands, queries)` — run multiple commands + search in ONE call
|
|
88
|
+
- `mcp__context-mode__ctx_execute(language: "shell", code: "...")` — run in sandbox, only stdout enters context
|
|
89
|
+
|
|
90
|
+
### read_file (for analysis)
|
|
91
|
+
If you are reading a file to **edit** it → read_file is correct (edit needs content in context).
|
|
92
|
+
If you are reading to **analyze, explore, or summarize** → use `mcp__context-mode__ctx_execute_file(path, language, code)` instead. Only your printed summary enters context.
|
|
93
|
+
|
|
94
|
+
### grep / search (large results)
|
|
95
|
+
Search results can flood context. Use `mcp__context-mode__ctx_execute(language: "shell", code: "grep ...")` to run searches in sandbox. Only your printed summary enters context.
|
|
96
|
+
|
|
97
|
+
## Tool selection hierarchy
|
|
98
|
+
|
|
99
|
+
1. **GATHER**: `mcp__context-mode__ctx_batch_execute(commands, queries)` — Primary tool. Runs all commands, auto-indexes output, returns search results. ONE call replaces 30+ individual calls.
|
|
100
|
+
2. **FOLLOW-UP**: `mcp__context-mode__ctx_search(queries: ["q1", "q2", ...])` — Query indexed content. Pass ALL questions as array in ONE call.
|
|
101
|
+
3. **PROCESSING**: `mcp__context-mode__ctx_execute(language, code)` | `mcp__context-mode__ctx_execute_file(path, language, code)` — Sandbox execution. Only stdout enters context.
|
|
102
|
+
4. **WEB**: `mcp__context-mode__ctx_fetch_and_index(url, source)` then `mcp__context-mode__ctx_search(queries)` — Fetch, chunk, index, query. Raw HTML never enters context.
|
|
103
|
+
5. **INDEX**: `mcp__context-mode__ctx_index(content, source)` — Store content in FTS5 knowledge base for later search.
|
|
104
|
+
|
|
105
|
+
## Output constraints
|
|
106
|
+
|
|
107
|
+
- Keep responses under 500 words.
|
|
108
|
+
- Write artifacts (code, configs, PRDs) to FILES — never return them as inline text. Return only: file path + 1-line description.
|
|
109
|
+
- When indexing content, use descriptive source labels so others can `search(source: "label")` later.
|
|
110
|
+
|
|
111
|
+
## ctx commands
|
|
112
|
+
|
|
113
|
+
| Command | Action |
|
|
114
|
+
|---------|--------|
|
|
115
|
+
| `ctx stats` | Call the `stats` MCP tool and display the full output verbatim |
|
|
116
|
+
| `ctx doctor` | Call the `doctor` MCP tool, run the returned shell command, display as checklist |
|
|
117
|
+
| `ctx upgrade` | Call the `upgrade` MCP tool, run the returned shell command, display as checklist |
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAgCvB,eAAO,MAAM,MAAM;;;;;;CAMlB,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -5,12 +5,14 @@ const envSchema = z.object({
|
|
|
5
5
|
QUANTIX_API_KEY: z.string().min(1, "QUANTIX_API_KEY is required"),
|
|
6
6
|
MCPPORT: z.string().optional().default('3001'),
|
|
7
7
|
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
|
8
|
+
TRANSPORT: z.enum(['stdio', 'http']).default('stdio'),
|
|
8
9
|
});
|
|
9
10
|
const processEnv = {
|
|
10
11
|
QUANTIX_API_URL: process.env.QUANTIX_API_URL,
|
|
11
12
|
QUANTIX_API_KEY: process.env.QUANTIX_API_KEY,
|
|
12
13
|
MCPPORT: process.env.MCPPORT,
|
|
13
14
|
NODE_ENV: process.env.NODE_ENV,
|
|
15
|
+
TRANSPORT: process.env.TRANSPORT,
|
|
14
16
|
};
|
|
15
17
|
// Parse and validate environment variables
|
|
16
18
|
const parsedEnv = envSchema.safeParse(processEnv);
|
|
@@ -26,6 +28,7 @@ export const config = parsedEnv.success ? parsedEnv.data : {
|
|
|
26
28
|
QUANTIX_API_URL: process.env.QUANTIX_API_URL || 'https://api.quantix.example.com',
|
|
27
29
|
QUANTIX_API_KEY: process.env.QUANTIX_API_KEY || 'your_api_key_here',
|
|
28
30
|
MCPPORT: process.env.MCPPORT || '3001',
|
|
29
|
-
NODE_ENV: process.env.NODE_ENV || 'development'
|
|
31
|
+
NODE_ENV: process.env.NODE_ENV || 'development',
|
|
32
|
+
TRANSPORT: process.env.TRANSPORT || 'stdio',
|
|
30
33
|
};
|
|
31
34
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,iCAAiC,CAAC;IACtE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,6BAA6B,CAAC;IACjE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,SAAS,GAAG,CA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AAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,iCAAiC;IACjF,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,mBAAmB;IACnE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,MAAM;IACtC,QAAQ,EAAG,OAAO,CAAC,GAAG,CAAC,QAAkD,IAAI,aAAa;IAC1F,SAAS,EAAG,OAAO,CAAC,GAAG,CAAC,SAA8B,IAAI,OAAO;CACpE,CAAC"}
|
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;AAsBpE,wBAAgB,SAAS,cAsBxB"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
4
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
5
|
import express, {} from 'express';
|
|
5
6
|
import { config } from './config.js';
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
7
|
import { registerCategoryTools } from './tools/categories.js';
|
|
9
8
|
import { registerCreditCardTools } from './tools/credit-cards.js';
|
|
10
9
|
import { registerTransactionTools } from './tools/transactions.js';
|
|
@@ -39,11 +38,38 @@ export function getServer() {
|
|
|
39
38
|
registerSubscriptionTools(mcpServer);
|
|
40
39
|
return mcpServer;
|
|
41
40
|
}
|
|
42
|
-
async function
|
|
41
|
+
async function startStdio() {
|
|
43
42
|
const transport = new StdioServerTransport();
|
|
44
43
|
const mcpServer = getServer();
|
|
45
44
|
await mcpServer.connect(transport);
|
|
46
|
-
console.
|
|
45
|
+
console.error('Quantix MCP server running in stdio mode');
|
|
46
|
+
}
|
|
47
|
+
async function startHttp() {
|
|
48
|
+
const app = express();
|
|
49
|
+
app.use(express.json());
|
|
50
|
+
const port = parseInt(config.MCPPORT, 10);
|
|
51
|
+
app.post('/mcp', async (req, res) => {
|
|
52
|
+
const transport = new StreamableHTTPServerTransport({});
|
|
53
|
+
const mcpServer = getServer();
|
|
54
|
+
// Cast needed: exactOptionalPropertyTypes causes onclose incompatibility with Transport interface
|
|
55
|
+
await mcpServer.connect(transport);
|
|
56
|
+
await transport.handleRequest(req, res, req.body);
|
|
57
|
+
});
|
|
58
|
+
app.get('/health', (_req, res) => {
|
|
59
|
+
res.json({ status: 'ok', transport: 'http' });
|
|
60
|
+
});
|
|
61
|
+
app.listen(port, () => {
|
|
62
|
+
console.error(`Quantix MCP server running in HTTP mode on port ${port}`);
|
|
63
|
+
console.error(`Endpoint: http://0.0.0.0:${port}/mcp`);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async function main() {
|
|
67
|
+
if (config.TRANSPORT === 'http') {
|
|
68
|
+
await startHttp();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
await startStdio();
|
|
72
|
+
}
|
|
47
73
|
}
|
|
48
74
|
main().catch(error => {
|
|
49
75
|
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,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AAS,GAAG,SAAS,EAAE,CAAC;QAC9B,kGAAkG;QAClG,MAAM,SAAS,CAAC,OAAO,CAAC,SAAkB,CAAC,CAAC;QAC5C,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAa,EAAE,GAAa,EAAE,EAAE;QAChD,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;QAClB,OAAO,CAAC,KAAK,CAAC,mDAAmD,IAAI,EAAE,CAAC,CAAC;QACzE,OAAO,CAAC,KAAK,CAAC,4BAA4B,IAAI,MAAM,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,UAAU,IAAI;IACf,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;QAC9B,MAAM,SAAS,EAAE,CAAC;IACtB,CAAC;SAAM,CAAC;QACJ,MAAM,UAAU,EAAE,CAAC;IACvB,CAAC;AACL,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":"transactions.d.ts","sourceRoot":"","sources":["../../src/tools/transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../src/tools/transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYpE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,QA2LzD"}
|