Class ComposioAuthBridge

java.lang.Object
com.tnsai.mcp.composio.ComposioAuthBridge

public class ComposioAuthBridge extends Object
Bridges Composio's API key authentication to MCP-compatible auth headers.

Composio uses API keys for authentication, while MCP typically uses OAuth. This bridge generates the appropriate auth headers for Composio API calls and can verify API key validity.

Example usage:


 ComposioAuthBridge bridge = new ComposioAuthBridge("your-api-key");
 if (bridge.verifyApiKey()) {
     Map<String, String> headers = bridge.getAuthHeaders();
     // Use headers for Composio API calls
 }
 
See Also:
  • Constructor Details

    • ComposioAuthBridge

      public ComposioAuthBridge(String apiKey)
      Creates a new ComposioAuthBridge with the given API key.
      Parameters:
      apiKey - the Composio API key
      Throws:
      IllegalArgumentException - if apiKey is null or blank
  • Method Details

    • getAuthHeaders

      public Map<String,String> getAuthHeaders()
      Creates authentication headers for Composio API calls.
      Returns:
      map of header name to header value
    • verifyApiKey

      public boolean verifyApiKey() throws IOException
      Verifies that the API key is valid by making a test API call.
      Returns:
      true if the API key is valid, false otherwise
      Throws:
      IOException - if a network error occurs (not an auth failure)
    • getApiKey

      public String getApiKey()
      Returns the API key used by this bridge.
      Returns:
      the API key