feat: add initial implementation of Finance MCP server with REST API and setup instructions (ref #16)

This commit is contained in:
Peter Wood
2025-05-02 23:51:18 -04:00
parent 58e8dbc43c
commit 06dfbf9965
5 changed files with 413 additions and 0 deletions

230
mcp/mcp-issues.md Normal file
View File

@@ -0,0 +1,230 @@
# MCP Server Enhancement Issues
## Priority 1: Core Infrastructure
### Issue 1: Database Integration with Existing PostgreSQL Setup
**Labels**: `enhancement`, `database`, `priority-high`
#### Description
Currently, the MCP server uses in-memory storage for transactions. We need to integrate it with the existing PostgreSQL database.
#### Tasks
- [ ] Add SQLAlchemy to requirements.txt
- [ ] Create database models that align with existing Prisma schema
- [ ] Implement database connection handling
- [ ] Convert in-memory operations to database operations
- [ ] Add database migration system
- [ ] Add connection error handling
- [ ] Add database connection pooling
#### Technical Details
- Use existing PostgreSQL setup from docker-compose.yml
- Align with existing Prisma schema structure
- Implement proper connection closing and resource cleanup
#### Dependencies
- SQLAlchemy
- alembic (for migrations)
- psycopg2-binary
**Estimated time**: 3-4 days
---
### Issue 2: Authentication System Implementation
**Labels**: `enhancement`, `security`, `priority-high`
#### Description
Implement secure authentication system for the MCP server endpoints.
#### Tasks
- [ ] Add JWT authentication
- [ ] Create authentication middleware
- [ ] Implement user session management
- [ ] Add API key authentication for machine-to-machine communication
- [ ] Integrate with existing user system from the main application
- [ ] Add rate limiting for authentication attempts
- [ ] Implement secure password handling
#### Technical Details
- Use Python-JWT for token handling
- Integrate with existing user schema from Prisma
- Implement token refresh mechanism
- Add proper error handling for auth failures
#### Dependencies
- python-jose[cryptography]
- passlib[bcrypt]
- python-multipart
#### Security Considerations
- Token expiration
- Secure password hashing
- Protection against brute force attacks
**Estimated time**: 2-3 days
---
## Priority 2: Feature Enhancements
### Issue 3: Enhanced Transaction Features
**Labels**: `enhancement`, `feature`, `priority-medium`
#### Description
Add enhanced features for transaction management and querying.
#### Tasks
- [ ] Implement transaction categories management
- [ ] Add transaction search functionality
- [ ] Date range filtering
- [ ] Amount range filtering
- [ ] Category filtering
- [ ] Description search
- [ ] Add pagination for transaction listings
- [ ] Implement sorting options
- [ ] Add support for different currencies
- [ ] Implement transaction metadata support
#### Technical Details
- Add proper indexing for search operations
- Implement efficient pagination
- Add currency conversion support
- Add proper validation for all new fields
#### API Endpoints to Add
- GET /transactions/search
- GET /categories
- POST /categories
- PUT /transactions/{id}/metadata
**Estimated time**: 3-4 days
---
## Priority 3: Observability & Quality
### Issue 4: Monitoring and Logging Setup
**Labels**: `enhancement`, `observability`, `priority-medium`
#### Description
Implement monitoring and logging systems for better observability.
#### Tasks
- [ ] Set up structured logging
- [ ] Request logging
- [ ] Error logging
- [ ] Performance metrics
- [ ] Add Prometheus metrics
- [ ] Request counts
- [ ] Response times
- [ ] Error rates
- [ ] Implement detailed health check endpoints
- [ ] Add performance monitoring
- [ ] Set up error tracking
#### Technical Details
- Use Python logging module with JSON formatter
- Implement OpenTelemetry integration
- Add proper error context collection
- Implement custom metrics for financial operations
#### Dependencies
- prometheus-client
- opentelemetry-api
- opentelemetry-sdk
- python-json-logger
**Estimated time**: 2-3 days
---
### Issue 5: Testing Infrastructure
**Labels**: `enhancement`, `testing`, `priority-medium`
#### Description
Set up complete testing infrastructure for the MCP server.
#### Tasks
- [ ] Set up unit testing framework
- [ ] Implement integration tests
- [ ] Add API documentation tests
- [ ] Create load testing suite
- [ ] Set up test data fixtures
- [ ] Implement CI pipeline for tests
#### Test Coverage Areas
- [ ] Transaction operations
- [ ] Authentication
- [ ] Database operations
- [ ] Error handling
- [ ] API endpoints
- [ ] Data validation
#### Technical Details
- Use pytest for testing
- Implement proper test database handling
- Add mock services for external dependencies
- Set up GitHub Actions for CI
#### Dependencies
- pytest
- pytest-cov
- pytest-asyncio
- locust (for load testing)
**Estimated time**: 4-5 days
---
## Priority 4: DevOps & Documentation
### Issue 6: Docker & Deployment Setup
**Labels**: `enhancement`, `devops`, `priority-low`
#### Description
Containerize the MCP server and set up deployment infrastructure.
#### Tasks
- [ ] Create Dockerfile for MCP server
- [ ] Update docker-compose.yml to include MCP service
- [ ] Set up environment configuration
- [ ] Create deployment scripts
- [ ] Implement backup strategy
- [ ] Add health checks for container orchestration
#### Technical Details
- Multi-stage Docker build
- Environment variable configuration
- Volume management for persistent data
- Container health monitoring
**Estimated time**: 2-3 days
---
### Issue 7: Documentation Enhancement
**Labels**: `documentation`, `priority-low`
#### Description
Create comprehensive documentation for the MCP server.
#### Tasks
- [ ] Create API documentation
- [ ] Write development guide
- [ ] Create deployment guide
- [ ] Add contributing guidelines
- [ ] Document security practices
- [ ] Add troubleshooting guide
#### Areas to Cover
- Setup instructions
- API endpoints and usage
- Authentication flows
- Database schema
- Configuration options
- Deployment procedures
- Contributing workflow
- Security best practices
**Estimated time**: 2-3 days