financeops-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
  3. package/.github/assets/banner.svg +104 -0
  4. package/.github/pull_request_template.md +25 -0
  5. package/CODE_OF_CONDUCT.md +40 -0
  6. package/CONTRIBUTING.md +71 -0
  7. package/LICENSE +21 -0
  8. package/README.md +390 -0
  9. package/SECURITY.md +30 -0
  10. package/dist/adapters/stripe.d.ts +15 -0
  11. package/dist/adapters/stripe.js +175 -0
  12. package/dist/adapters/types.d.ts +30 -0
  13. package/dist/adapters/types.js +2 -0
  14. package/dist/adapters/xero.d.ts +19 -0
  15. package/dist/adapters/xero.js +261 -0
  16. package/dist/analysis/anomaly.d.ts +12 -0
  17. package/dist/analysis/anomaly.js +103 -0
  18. package/dist/analysis/cashflow.d.ts +10 -0
  19. package/dist/analysis/cashflow.js +134 -0
  20. package/dist/analysis/pnl.d.ts +8 -0
  21. package/dist/analysis/pnl.js +56 -0
  22. package/dist/analysis/reconciliation.d.ts +14 -0
  23. package/dist/analysis/reconciliation.js +98 -0
  24. package/dist/analysis/tax.d.ts +11 -0
  25. package/dist/analysis/tax.js +81 -0
  26. package/dist/index.d.ts +3 -0
  27. package/dist/index.js +565 -0
  28. package/dist/lib/audit.d.ts +17 -0
  29. package/dist/lib/audit.js +70 -0
  30. package/dist/lib/providers.d.ts +6 -0
  31. package/dist/lib/providers.js +25 -0
  32. package/dist/premium/gate.d.ts +12 -0
  33. package/dist/premium/gate.js +22 -0
  34. package/dist/types.d.ts +138 -0
  35. package/dist/types.js +7 -0
  36. package/mcpize.yaml +10 -0
  37. package/package.json +35 -0
  38. package/src/adapters/stripe.ts +190 -0
  39. package/src/adapters/types.ts +34 -0
  40. package/src/adapters/xero.ts +317 -0
  41. package/src/analysis/anomaly.ts +119 -0
  42. package/src/analysis/cashflow.ts +158 -0
  43. package/src/analysis/pnl.ts +80 -0
  44. package/src/analysis/reconciliation.ts +117 -0
  45. package/src/analysis/tax.ts +98 -0
  46. package/src/index.ts +649 -0
  47. package/src/lib/audit.ts +92 -0
  48. package/src/lib/providers.ts +29 -0
  49. package/src/premium/gate.ts +24 -0
  50. package/src/types.ts +153 -0
  51. package/tests/adapters/stripe.test.ts +150 -0
  52. package/tests/adapters/xero.test.ts +188 -0
  53. package/tests/analysis/anomaly.test.ts +137 -0
  54. package/tests/analysis/cashflow.test.ts +112 -0
  55. package/tests/analysis/pnl.test.ts +95 -0
  56. package/tests/analysis/reconciliation.test.ts +121 -0
  57. package/tests/analysis/tax.test.ts +163 -0
  58. package/tests/helpers/mock-data.ts +135 -0
  59. package/tests/lib/audit.test.ts +89 -0
  60. package/tests/lib/providers.test.ts +129 -0
  61. package/tests/premium/cash_flow_forecast.test.ts +157 -0
  62. package/tests/premium/detect_anomalies.test.ts +189 -0
  63. package/tests/premium/gate.test.ts +59 -0
  64. package/tests/premium/generate_pnl.test.ts +155 -0
  65. package/tests/premium/multi_currency_report.test.ts +141 -0
  66. package/tests/premium/reconcile.test.ts +174 -0
  67. package/tests/premium/tax_summary.test.ts +166 -0
  68. package/tests/tools/expense_tracker.test.ts +181 -0
  69. package/tests/tools/financial_health.test.ts +196 -0
  70. package/tests/tools/get_balances.test.ts +160 -0
  71. package/tests/tools/list_invoices.test.ts +191 -0
  72. package/tests/tools/list_transactions.test.ts +210 -0
  73. package/tests/tools/revenue_summary.test.ts +188 -0
  74. package/tsconfig.json +20 -0
  75. package/vitest.config.ts +9 -0
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug in FinanceOps MCP
4
+ labels: bug
5
+ ---
6
+
7
+ **Provider:** Stripe / Xero / Both
8
+
9
+ **Tool:** (e.g., financial_health, generate_pnl, reconcile)
10
+
11
+ **Steps to Reproduce:**
12
+ 1.
13
+ 2.
14
+ 3.
15
+
16
+ **Expected Behavior:**
17
+
18
+ **Actual Behavior:**
19
+
20
+ **Error Output:**
21
+ ```
22
+
23
+ ```
24
+
25
+ **Environment:**
26
+ - Node.js version:
27
+ - FinanceOps version:
28
+ - OS:
29
+ - Pro license: Yes / No
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a new feature for FinanceOps MCP
4
+ labels: enhancement
5
+ ---
6
+
7
+ **Is this related to a problem?**
8
+
9
+ **Describe the feature:**
10
+
11
+ **Which providers should it support?**
12
+ - [ ] Stripe
13
+ - [ ] Xero
14
+ - [ ] Both
15
+ - [ ] New provider (specify):
16
+
17
+ **Type of contribution:**
18
+ - [ ] New analysis module (P&L, forecasting, etc.)
19
+ - [ ] New provider adapter
20
+ - [ ] New free tool
21
+ - [ ] New pro tool
22
+ - [ ] Other
23
+
24
+ **Use case:**
@@ -0,0 +1,104 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 200" width="800" height="200">
2
+ <defs>
3
+ <linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
4
+ <stop offset="0%" style="stop-color:#0d1117;stop-opacity:1" />
5
+ <stop offset="100%" style="stop-color:#0a1f16;stop-opacity:1" />
6
+ </linearGradient>
7
+ <linearGradient id="accent" x1="0%" y1="0%" x2="100%" y2="0%">
8
+ <stop offset="0%" style="stop-color:#10b981;stop-opacity:1" />
9
+ <stop offset="100%" style="stop-color:#34d399;stop-opacity:1" />
10
+ </linearGradient>
11
+ <linearGradient id="glow" x1="0%" y1="0%" x2="0%" y2="100%">
12
+ <stop offset="0%" style="stop-color:#10b981;stop-opacity:0.25" />
13
+ <stop offset="100%" style="stop-color:#10b981;stop-opacity:0" />
14
+ </linearGradient>
15
+ <filter id="shadow">
16
+ <feDropShadow dx="0" dy="2" stdDeviation="3" flood-color="#10b981" flood-opacity="0.3"/>
17
+ </filter>
18
+ <filter id="textGlow">
19
+ <feGaussianBlur in="SourceGraphic" stdDeviation="2" result="blur"/>
20
+ <feMerge>
21
+ <feMergeNode in="blur"/>
22
+ <feMergeNode in="SourceGraphic"/>
23
+ </feMerge>
24
+ </filter>
25
+ </defs>
26
+
27
+ <!-- Background -->
28
+ <rect width="800" height="200" fill="url(#bg)" rx="12" ry="12"/>
29
+
30
+ <!-- Subtle grid pattern -->
31
+ <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
32
+ <path d="M 40 0 L 0 0 0 40" fill="none" stroke="#1a2e22" stroke-width="0.5"/>
33
+ </pattern>
34
+ <rect width="800" height="200" fill="url(#grid)" rx="12" ry="12" opacity="0.6"/>
35
+
36
+ <!-- Top accent line -->
37
+ <rect x="0" y="0" width="800" height="3" fill="url(#accent)" rx="1"/>
38
+
39
+ <!-- Glow halo behind icons -->
40
+ <ellipse cx="400" cy="145" rx="260" ry="55" fill="url(#glow)" opacity="0.5"/>
41
+
42
+ <!-- Stripe-style icon (left): vertical bars representing payments -->
43
+ <g transform="translate(220, 108)" filter="url(#shadow)">
44
+ <rect x="0" y="12" width="8" height="28" rx="2" fill="#10b981" opacity="0.85"/>
45
+ <rect x="12" y="6" width="8" height="34" rx="2" fill="#10b981" opacity="0.65"/>
46
+ <rect x="24" y="0" width="8" height="40" rx="2" fill="#10b981" opacity="0.45"/>
47
+ <text x="16" y="52" text-anchor="middle" font-family="'SF Mono','Fira Code','Cascadia Code',monospace" font-size="9" fill="#6b7280">Stripe</text>
48
+ </g>
49
+
50
+ <!-- Chart/graph icon (center): line chart representing finance analysis -->
51
+ <g transform="translate(374, 108)" filter="url(#shadow)">
52
+ <polyline points="0,36 10,22 20,28 30,10 40,18" fill="none" stroke="#10b981" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" opacity="0.9"/>
53
+ <circle cx="0" cy="36" r="2.5" fill="#10b981" opacity="0.9"/>
54
+ <circle cx="10" cy="22" r="2.5" fill="#10b981" opacity="0.9"/>
55
+ <circle cx="20" cy="28" r="2.5" fill="#10b981" opacity="0.9"/>
56
+ <circle cx="30" cy="10" r="2.5" fill="#10b981" opacity="0.9"/>
57
+ <circle cx="40" cy="18" r="2.5" fill="#10b981" opacity="0.9"/>
58
+ <line x1="0" y1="40" x2="40" y2="40" stroke="#1a2e22" stroke-width="1.5" opacity="0.8"/>
59
+ <text x="20" y="52" text-anchor="middle" font-family="'SF Mono','Fira Code','Cascadia Code',monospace" font-size="9" fill="#6b7280">Analysis</text>
60
+ </g>
61
+
62
+ <!-- Xero-style icon (right): circular X mark representing accounting -->
63
+ <g transform="translate(536, 108)" filter="url(#shadow)">
64
+ <circle cx="20" cy="18" r="20" fill="none" stroke="#10b981" stroke-width="1.5" opacity="0.7"/>
65
+ <line x1="12" y1="10" x2="28" y2="26" stroke="#10b981" stroke-width="2.5" stroke-linecap="round" opacity="0.85"/>
66
+ <line x1="28" y1="10" x2="12" y2="26" stroke="#10b981" stroke-width="2.5" stroke-linecap="round" opacity="0.85"/>
67
+ <text x="20" y="52" text-anchor="middle" font-family="'SF Mono','Fira Code','Cascadia Code',monospace" font-size="9" fill="#6b7280">Xero</text>
68
+ </g>
69
+
70
+ <!-- Connection lines from subtitle to icons -->
71
+ <line x1="330" y1="95" x2="244" y2="110" stroke="#10b981" stroke-width="1" opacity="0.25"/>
72
+ <line x1="400" y1="95" x2="394" y2="110" stroke="#10b981" stroke-width="1" opacity="0.25"/>
73
+ <line x1="470" y1="95" x2="556" y2="110" stroke="#10b981" stroke-width="1" opacity="0.25"/>
74
+
75
+ <!-- Currency symbol accent (top-left) -->
76
+ <g transform="translate(145, 38)">
77
+ <text x="0" y="22" font-family="'SF Mono','Fira Code','Cascadia Code',monospace" font-size="28" font-weight="bold" fill="url(#accent)" opacity="0.8">$</text>
78
+ </g>
79
+
80
+ <!-- Main title -->
81
+ <text x="400" y="55" text-anchor="middle" font-family="'SF Mono','Fira Code','Cascadia Code','Consolas',monospace" font-size="38" font-weight="bold" fill="#f0f6fc" filter="url(#textGlow)" letter-spacing="1">
82
+ FinanceOps MCP
83
+ </text>
84
+
85
+ <!-- Subtitle -->
86
+ <text x="400" y="82" text-anchor="middle" font-family="'SF Mono','Fira Code','Cascadia Code','Consolas',monospace" font-size="13" fill="#6b7280" letter-spacing="3">
87
+ UNIFIED FINANCIAL INTELLIGENCE SERVER
88
+ </text>
89
+
90
+ <!-- Bottom accent line -->
91
+ <rect x="290" y="92" width="220" height="1" fill="url(#accent)" opacity="0.35"/>
92
+
93
+ <!-- Version badge -->
94
+ <g transform="translate(680, 15)">
95
+ <rect width="60" height="20" rx="10" fill="#0a1f16" stroke="#1a3a28" stroke-width="1"/>
96
+ <text x="30" y="14" text-anchor="middle" font-family="'SF Mono','Fira Code',monospace" font-size="10" fill="#10b981">v0.1.0</text>
97
+ </g>
98
+
99
+ <!-- MCP badge -->
100
+ <g transform="translate(60, 15)">
101
+ <rect width="44" height="20" rx="10" fill="#0a1f16" stroke="#1a3a28" stroke-width="1"/>
102
+ <text x="22" y="14" text-anchor="middle" font-family="'SF Mono','Fira Code',monospace" font-size="10" fill="#10b981">MCP</text>
103
+ </g>
104
+ </svg>
@@ -0,0 +1,25 @@
1
+ ## Summary
2
+
3
+ Brief description of changes.
4
+
5
+ ## Type
6
+ - [ ] Bug fix
7
+ - [ ] New free tool
8
+ - [ ] New pro tool
9
+ - [ ] New provider adapter
10
+ - [ ] New analysis module
11
+ - [ ] Documentation
12
+
13
+ ## Provider Impact
14
+ - [ ] Stripe
15
+ - [ ] Xero
16
+ - [ ] Both
17
+ - [ ] No provider changes
18
+
19
+ ## Checklist
20
+ - [ ] Tests pass (`npm test`)
21
+ - [ ] TypeScript compiles (`npm run build`)
22
+ - [ ] New tests added for new features
23
+ - [ ] No real credentials in test fixtures
24
+ - [ ] Audit log call added for new tools (`logAudit(...)`)
25
+ - [ ] README updated if new tools or providers added
@@ -0,0 +1,40 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to a positive environment:
15
+
16
+ * Using welcoming and inclusive language
17
+ * Being respectful of differing viewpoints and experiences
18
+ * Gracefully accepting constructive criticism
19
+ * Focusing on what is best for the community
20
+ * Showing empathy towards other community members
21
+
22
+ Examples of unacceptable behavior:
23
+
24
+ * The use of sexualized language or imagery and unwelcome sexual attention
25
+ * Trolling, insulting/derogatory comments, and personal or political attacks
26
+ * Public or private harassment
27
+ * Publishing others' private information without explicit permission
28
+ * Other conduct which could reasonably be considered inappropriate
29
+
30
+ ## Enforcement
31
+
32
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
33
+ reported to the project team. All complaints will be reviewed and investigated
34
+ and will result in a response that is deemed necessary and appropriate to the
35
+ circumstances.
36
+
37
+ ## Attribution
38
+
39
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
40
+ version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
@@ -0,0 +1,71 @@
1
+ # Contributing to FinanceOps MCP
2
+
3
+ Thanks for your interest in contributing! FinanceOps MCP is an open-source financial intelligence server for AI coding agents. It connects Stripe and Xero to provide P&L, cash flow forecasting, reconciliation, and anomaly detection through the MCP protocol.
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repository
8
+ 2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/financeops-mcp.git`
9
+ 3. Install dependencies: `npm install`
10
+ 4. Run tests: `npm test`
11
+
12
+ ## Development
13
+
14
+ - **Language:** TypeScript (strict mode)
15
+ - **Testing:** Vitest — run `npm test`
16
+ - **Build:** `npm run build` (TypeScript → dist/)
17
+ - **Entry point:** `src/index.ts`
18
+
19
+ ## Adding a New Provider
20
+
21
+ FinanceOps supports pluggable financial providers. To add a new one (e.g. QuickBooks, Braintree):
22
+
23
+ 1. Create `src/adapters/your-provider.ts` implementing the `FinancialProvider` interface defined in `src/adapters/types.ts`
24
+ 2. Implement the required methods:
25
+ - `getTransactions(options)` — paginated transaction list
26
+ - `getBalances()` — current account balances
27
+ - `getInvoices(options)` — invoice list with status filtering
28
+ 3. Register the provider in `src/lib/providers.ts`
29
+ 4. Add the provider to the `z.enum(['stripe', 'xero', 'your-provider'])` schemas in `src/index.ts`
30
+ 5. Add integration tests in `tests/adapters/your-provider.test.ts`
31
+ 6. Document credentials in README under "Supported Providers"
32
+
33
+ ## Adding a New Analysis Module
34
+
35
+ Analysis modules live in `src/analysis/`. Each module is a pure function that takes `Transaction[]` and returns a typed result.
36
+
37
+ 1. Create `src/analysis/your-module.ts`
38
+ 2. Export a named function: `export function yourAnalysis(transactions: Transaction[], options: YourOptions): YourResult`
39
+ 3. Add the result type to `src/types.ts`
40
+ 4. If the analysis is a free tool, register it in the free tools list in `src/index.ts`
41
+ 5. If it is a pro tool, add it behind `requirePro()` and to the pro tools list in `src/index.ts`
42
+ 6. Add tests in `tests/analysis/your-module.test.ts`
43
+
44
+ ## Adding a New Tool
45
+
46
+ 1. Register the Zod input schema in `src/index.ts`
47
+ 2. Add the tool definition to the `ListToolsRequestSchema` handler
48
+ 3. Add the `case 'your_tool':` block in the `CallToolRequestSchema` handler
49
+ 4. Free tools go directly in the tools array; pro tools go behind `isPro()` / `requirePro()`
50
+ 5. Log every tool call with `logAudit({ tool: name, provider, success })`
51
+
52
+ ## Pull Requests
53
+
54
+ - Write tests for new features — coverage for analysis modules is especially important
55
+ - Ensure all tests pass: `npm test`
56
+ - TypeScript must compile without errors: `npm run build`
57
+ - One feature per PR — keep PRs focused and reviewable
58
+ - Do not include real API credentials, even in tests; use mock data
59
+
60
+ ## Reporting Issues
61
+
62
+ Use GitHub Issues. Include:
63
+ - Steps to reproduce
64
+ - Expected vs actual behavior
65
+ - Provider (Stripe / Xero)
66
+ - Node.js version
67
+ - Any relevant error output
68
+
69
+ ## License
70
+
71
+ By contributing, you agree that your contributions will be licensed under the MIT License.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Craftpipe (Heijnes Digital)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.