full-stack-fastapi-template
full-stack-fastapi-template copied to clipboard
feat: enhance MCP server support with authentication and environment variables
Summary
- Add authentication support for remote MCP servers (bearer token, API key, basic auth)
- Add environment variable expansion in server configurations
- Enhance error handling and connection resilience
Changes
Authentication Support
- Added
auth_typeandauth_configfields to MCP server model - Support for three authentication types:
- Bearer token authentication
- API key authentication (with configurable header name)
- Basic authentication (username/password)
- Authentication headers are automatically added when connecting to remote servers
Environment Variable Support
- Server configurations can now use environment variables with
${VAR}or$VARsyntax - Variables are expanded in:
- Command and arguments for stdio transport
- URL and headers for HTTP+SSE transport
- Authentication configuration values
- Enables secure configuration without hardcoding sensitive values
Enhanced Error Handling
- Better error messages for connection failures
- Timeout handling for HTTP requests (30 seconds)
- Process startup validation for stdio connections
- Improved error reporting through WebSocket status updates
- Connection status now includes error messages
Database Changes
- Updated MCP server migration to include authentication fields
- No breaking changes to existing data
Testing
- Tested with local stdio MCP servers
- Tested environment variable expansion
- Tested error scenarios (invalid commands, network failures)
Next Steps
- Frontend UI updates to support authentication configuration
- Additional testing with various MCP server implementations
🤖 Generated with Claude Code