Skip to content

MCP server's callback endpoint is failing with a 500 error #41

@renjithsasidharan

Description

@renjithsasidharan

Summary

The hosted MCP server at https://mcp.kite.trade/mcp returns a 500 Internal Server Error
when processing the OAuth callback from Kite Connect authentication.

Steps to Reproduce

  1. Call the login tool via custom MCP client
  2. Receive login URL: https://kite.zerodha.com/connect/login?api_key=kitemcp&v=3&redirect _params=session_id%3D...
  3. Complete authentication in browser using valid Kite credentials
  4. Browser redirects to callback URL
  5. Callback endpoint returns 500 error

Expected Behavior

The callback should successfully process the authentication and associate the request
token with the session ID, allowing subsequent MCP tool calls to work.

Actual Behavior

HTTP 500 Internal Server Error on callback endpoint
error completing Kite session

Error Details

URL: https://mcp.kite.trade/callback?status=success&request_token=3tZT9tCZz1BYPi9JLVL h9tUf08cKe2yx&session_id=kitemcp-6db6acfc-94d1-45d4-b8b8-12484354dcaf%7C1752529827.JUTrdZT szQf5NH0hsdxjUfCvihHXSwEzZOnIlfE32wg%3D&action=login&type=login

Response:

  • Status: 500 Internal Server Error
  • Content-Type: text/plain; charset=utf-8
  • Content-Length: 30
  • Server: cloudflare

Environment

  • MCP Server: https://mcp.kite.trade/mcp (hosted version)
  • Client: Custom MCP client using LangChain MCP adapters
  • Authentication: Valid Kite Connect credentials (My claude code MCP client authenticates fine)
  • Browser: Chrome 137 on macOS

Additional Context

  • The authentication with Kite Connect itself works correctly (status=success,
    request_token received)
  • The session ID is properly preserved in the callback URL
  • This suggests the issue is in the MCP server's callback handler, not the OAuth flow
    itself
  • The same MCP server works correctly with Claude Desktop, suggesting this might be a race
    condition or session handling issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions