frappe-mcp-server
Version:
Enhanced Model Context Protocol server for Frappe Framework with comprehensive API instructions and helper tools
43 lines (28 loc) • 1.59 kB
Markdown
# Frappe MCP Server Refactoring
## Overview
This refactoring improves the structure and error handling of the Frappe MCP Server codebase. The main goals were:
1. Break up the large `frappe-api.ts` file into smaller, more manageable modules
2. Improve error handling, especially for authentication errors
3. Make the code more maintainable and easier to understand
## File Structure Changes
The original `frappe-api.ts` file (1186 lines) has been split into the following modules:
- `errors.ts` - Contains the FrappeApiError class and error handling logic
- `api-client.ts` - Contains the Frappe API client setup
- `auth.ts` - Contains authentication-related functions
- `document-api.ts` - Contains document operations
- `schema-api.ts` - Contains schema operations
- `frappe-api.ts` - Now just re-exports from the other modules
## Error Handling Improvements
The error handling has been improved to better detect and report authentication errors:
- Better detection of invalid API key/secret errors
- Better handling of connection errors that might be related to authentication
- More detailed error messages and context
- Improved error reporting in the health check function
## Testing
A test script (`test-auth-error.js`) has been created to verify that the error handling works correctly with invalid credentials.
## Future Improvements
Some potential future improvements:
1. Add more comprehensive error handling for other types of errors
2. Add more unit tests for different error scenarios
3. Improve the documentation of the API
4. Add more logging to help with debugging