full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

feat: enhance MCP server support with authentication and environment variables

Open abhimanyusaxena opened this issue 5 months ago • 0 comments

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_type and auth_config fields 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 $VAR syntax
  • 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

abhimanyusaxena avatar May 28 '25 06:05 abhimanyusaxena