The Asana MCP (Model Context Protocol) server integration fails with authentication errors when accessed through OpenAI’s Responses API, despite the OAuth token working correctly for direct Asana API calls. This prevents the use of Asana tools in our AI reasoning engine.
Error Details
Primary Error
Error code: 424 - {
'error': {
'message': "Error retrieving tool list from MCP server: 'Asana'. Http status code: 401 (Unauthorized)",
'type': 'external_connector_error',
'param': 'tools',
'code': 'http_error'
}
}
Error Flow
- User initiates reasoning session with Asana enabled in tools
- Our backend builds MCP tool configuration with Asana credentials
- OpenAI’s API attempts to probe the Asana MCP server at
https://mcp.asana.com/sse
- Asana MCP server returns 401 Unauthorized
- OpenAI surfaces this as a 424 external_connector_error
- Our API returns 500 Internal Server Error to the frontend
Environment
- Asana MCP Server URL:
https://mcp.asana.com/sse
- Authentication Method: OAuth 2.0
- Token Storage: PostgreSQL with encryption (working correctly)
- OpenAI API: GPT-5 Responses API (
/v1/responses
) - Backend: Python FastAPI
- Working Integration: Zapier MCP (for comparison)
Code Implementation
Current Configuration (Not Working)
File: backend/app/core/gpt5_client.py
# Building Asana MCP tool configuration
if "asana" in ds.name.lower():
access_token = credentials.get("access_token")
if access_token:
tools.append({
"type": "mcp",
"server_label": "Asana",
"server_description": "Asana project management tools",
"server_url": "https://mcp.asana.com/sse",
"authorization": access_token, # Raw OAuth token
"require_approval": "never"
})
Working Zapier Configuration (For Comparison)
# Zapier MCP configuration that works correctly
elif "zapier" in ds.name.lower():
mcp_server_url = ds.config.get("mcp_server_url")
api_key = credentials.get("api_key")
if mcp_server_url and api_key:
tools.append({
"type": "mcp",
"server_label": "Zapier",
"server_description": "Zapier automation and workflow tools",
"server_url": mcp_server_url,
"authorization": api_key, # Raw API key
"require_approval": "never"
})
Direct Asana API Call (Working)
File: backend/app/api/v1/endpoints/asana.py
# This works correctly with the same token
me_response = await client.get(
"https://app.asana.com/api/1.0/users/me",
headers={"Authorization": f"Bearer {tokens['access_token']}"},
timeout=10.0
)
# Returns 200 OK with user data
Attempted Solutions
We’ve tried multiple authentication formats, all resulting in the same 401 error:
1. Raw Token (Current)
"authorization": access_token
Result: 401 Unauthorized
2. Bearer Prefix in Authorization Field
"authorization": f"Bearer {access_token}"
Result: 401 Unauthorized
3. Headers Object with Bearer Token
"headers": {
"Authorization": f"Bearer {access_token}"
}
Result: 401 Unauthorized
4. Both Authorization Field and Headers
"authorization": access_token,
"headers": {
"Authorization": f"Bearer {access_token}"
}
Result: 400 Bad Request - “Cannot specify both ‘authorization’ parameter and ‘Authorization’ header”
Token Storage and Retrieval
The OAuth token is correctly stored and retrieved from our database:
# Token storage after OAuth callback
credentials_json = json.dumps({
"access_token": tokens.get("access_token"),
"refresh_token": tokens.get("refresh_token"),
"expires_in": tokens.get("expires_in"),
"token_type": tokens.get("token_type", "Bearer")
})
credentials_encrypted = encrypt_value(credentials_json)