Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b27f6ea
Add complete YNAB MCP server implementation
auzroz Jan 25, 2026
e065ed1
Fix critical security issues from CodeRabbit review
auzroz Jan 25, 2026
8748018
Sanitize console.error logging in formatErrorResponse
auzroz Jan 25, 2026
8f20853
Remove implementation details from error messages
auzroz Jan 25, 2026
6215f24
Sanitize all error response messages and add defensive checks
auzroz Jan 25, 2026
1cd67da
Fix critical security issues from CodeRabbit review
auzroz Jan 25, 2026
8db1a1f
Sanitize user-controlled strings in tool responses
auzroz Jan 25, 2026
2426e0d
Fix analytics calculation edge cases
auzroz Jan 25, 2026
e382099
Fix minor issues from CodeRabbit review
auzroz Jan 25, 2026
4a366fc
docs: update README with correct repository URL
auzroz Jan 25, 2026
eb7d3dd
fix: strict integer parsing and mapped error messages
auzroz Jan 25, 2026
de1573a
fix: address CodeRabbit review findings (round 7)
auzroz Jan 25, 2026
d1338b6
fix: address CodeRabbit review (round 8)
auzroz Jan 25, 2026
1999906
feat: implement comprehensive fixes from remediation plan
auzroz Jan 25, 2026
fb0d63d
feat: add comprehensive test fixtures and analytics tests (Task 10)
auzroz Jan 25, 2026
b276a8b
fix: address CodeRabbit review findings (round 10)
auzroz Jan 25, 2026
76d5e5f
fix: address CodeRabbit review findings (round 11)
auzroz Jan 25, 2026
05e2cca
fix: address CodeRabbit review findings (round 12)
auzroz Jan 25, 2026
7f89b75
fix: address CodeRabbit review findings (round 13)
auzroz Jan 25, 2026
e961939
fix: address CodeRabbit review findings (round 14)
auzroz Jan 25, 2026
d14f5b3
fix: use sanitizeErrorMessage for audit log error redaction
auzroz Jan 25, 2026
84035a5
fix: address CodeRabbit review findings (round 16)
auzroz Jan 25, 2026
dcabf32
fix: address CodeRabbit review findings (round 17)
auzroz Jan 25, 2026
9cfc415
fix: add validation refinements to update-transaction
auzroz Jan 25, 2026
279bd14
fix: use UTC-based getCurrentMonth() in budget-health
auzroz Jan 25, 2026
a9918eb
docs: add JSDoc docstrings to all handler functions
auzroz Jan 25, 2026
726898e
fix: address CodeRabbit review findings (round 21)
auzroz Jan 25, 2026
e04645d
fix: address CodeRabbit nitpicks (round 21 continued)
auzroz Jan 25, 2026
26fbc50
fix: address remaining CodeRabbit issues (round 21 final)
auzroz Jan 25, 2026
75613a2
fix: address CodeRabbit round 10 findings
auzroz Jan 25, 2026
1a3ddd0
fix: address 25 unresolved CodeRabbit PR findings
auzroz Jan 26, 2026
a0da08e
fix: address CodeRabbit review findings (round 22)
auzroz Jan 26, 2026
f0cc6f1
fix: address final CodeRabbit review findings (round 23)
auzroz Jan 26, 2026
fe57ef2
fix: address CodeRabbit review findings (round 24)
auzroz Jan 26, 2026
bd4cfae
fix: address CodeRabbit review findings (round 25)
auzroz Jan 26, 2026
be41adb
fix: remove unnecessary budgets:false cache invalidation
auzroz Jan 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

# CodeRabbit Configuration for YNAB MCP Server
# Focus: Security and Safety

language: "en-US"
tone_instructions: "Be thorough about security issues. Flag any potential vulnerabilities clearly."
early_access: false

reviews:
profile: "assertive" # Strict reviews for security focus
request_changes_workflow: true
high_level_summary: true
high_level_summary_placeholder: "@coderabbitai summary"
review_status: true
commit_status: true
fail_commit_status: true # Fail on security issues
collapse_walkthrough: false
sequence_diagrams: true

# Path-specific security instructions
path_instructions:
- path: "src/**/*.ts"
instructions: |
Security Review Checklist:
1. INPUT VALIDATION: Ensure all user inputs are validated with Zod schemas before use
2. API TOKENS: Never log, expose, or hardcode YNAB_ACCESS_TOKEN or any credentials
3. ERROR MESSAGES: Verify error messages don't leak sensitive information (tokens, internal paths)
4. RATE LIMITING: Confirm API calls go through rateLimiter.acquire()
5. READ-ONLY MODE: Write operations must call assertWriteAllowed() before execution
6. AUDIT LOGGING: All write operations must be logged via auditLog
7. SQL/COMMAND INJECTION: Check for any string interpolation that could allow injection
8. TYPE SAFETY: Ensure proper TypeScript types, avoid 'any' type

- path: "src/services/ynab-client.ts"
instructions: |
CRITICAL FILE - YNAB API Client
- Verify all write operations check assertWriteAllowed()
- Confirm rateLimiter.acquire() is called before every API request
- Ensure tokens are never logged or included in error messages
- Check that audit logging captures all mutations

- path: "src/tools/**/*.ts"
instructions: |
Tool Handler Security:
- Validate ALL inputs with Zod before processing
- Sanitize any user-provided strings before including in responses
- Don't expose internal IDs or paths unnecessarily
- Ensure budget_id resolution uses client.resolveBudgetId()

- path: "src/config/**/*.ts"
instructions: |
Configuration Security:
- Environment variables must be validated
- Sensitive values (tokens) must never have defaults
- READ_ONLY should default to true for safety

- path: "tests/**/*.ts"
instructions: |
Test Security:
- Never use real API tokens in tests
- Mock all external API calls
- Test error handling paths for information leakage

# Auto review settings
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords:
- "WIP"
- "DO NOT MERGE"
drafts: false

# Pre-merge security checks
pre_merge_checks:
title:
mode: "warning"
description:
mode: "warning"
custom_checks:
- mode: "error"
name: "No Hardcoded Secrets"
instructions: |
FAIL if any of these are found:
- Hardcoded API tokens or keys
- Hardcoded passwords
- YNAB access tokens in code (not from environment)
- Base64 encoded credentials

- mode: "error"
name: "Input Validation"
instructions: |
FAIL if tool handlers don't validate inputs with Zod schemas
before processing user-provided data.

- mode: "error"
name: "Rate Limit Compliance"
instructions: |
FAIL if any new API calls are added without calling
rateLimiter.acquire() first.

- mode: "warning"
name: "Error Message Safety"
instructions: |
WARN if error messages might expose:
- Internal file paths
- API tokens or credentials
- Stack traces with sensitive context
- Database/API internal IDs

# Enable security-focused tools
tools:
shellcheck:
enabled: true
ruff:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 90000
biome:
enabled: true
ast-grep:
essential_rules: true

chat:
auto_reply: true

knowledge_base:
opt_out: false
web_search:
enabled: true
learnings:
scope: "local"
issues:
scope: "local"
pull_requests:
scope: "local"
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# YNAB MCP Server Configuration

# Required: Your YNAB Personal Access Token
# Get one from: https://app.ynab.com/settings/developer
YNAB_ACCESS_TOKEN=your_personal_access_token_here

# Optional: Default budget ID (UUID)
# If not set, uses "last-used" (your most recently accessed budget)
# YNAB_BUDGET_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

# Optional: Log level (debug, info, warn, error)
LOG_LEVEL=info

# Optional: Cache TTL in milliseconds (default: 300000 = 5 minutes)
CACHE_TTL_MS=300000

# Optional: Rate limit per hour (default: 180, max: 200)
# Using 180 as default provides a 10% safety margin
RATE_LIMIT_PER_HOUR=180

# Optional: Read-only mode (default: true)
# When true, all write operations (create, update, delete) are blocked
# Set to false to enable write operations
YNAB_READ_ONLY=true
59 changes: 59 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Dependencies
node_modules/

# Build output
dist/
*.tsbuildinfo

# Environment files
.env
.env.local
.env*.local

# IDE
.idea/
.vscode/
*.swp
*.swo
*.sublime-*

# OS
.DS_Store
Thumbs.db
*.orig

# Test coverage
coverage/
.nyc_output/

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Cache
.cache/
.eslintcache
.npm/

# Runtime
*.pid
*.seed

# Lock files (optional, uncomment if not committing)
# package-lock.json

# Claude related files
CLAUDE.md
SCRATCHPAD.md
CLAUDE_CODE_PROMPT.md
REMEDIATION_PLAN.md
PLAN.md
.claude/
.claude*

# Misc
*.bak
*.tmp
*.temp
Loading