[MCP] Lovable initialization fails with null error; support configurable OAuth callback

未关闭
#719 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
clojure

调研方向

Start with src/eca/modules/mcp.clj, especially discover-oauth-info and the exception handler at lines 981–985, then read src/eca/oauth.clj around the callback route. Identify and log the direct HTTPS failure safely, and trace how the redirect URI reaches authorization, callback handling, client metadata, and token exchange. Done means regression coverage for the confirmed discovery failure, null-message diagnostics, and both callback shapes with matching routes and token exchange.

由索引模型根据 Issue 内容生成。

描述

[MCP] Lovable initialization fails with null error; support configurable OAuth callback

Summary

With ECA 0.175.1, configuring only {"mcpServers":{"lovable":{"url":"https://mcp.lovable.dev"}}} causes Lovable to fail at startup:

ERROR [MCP] Unexpected error initializing MCP server lovable: null

The diagnostic does not identify the exception or its cause. Separately, after discovery is fixed, ECA's fixed OAuth redirect URI (http://localhost:<port>/auth/callback) is incompatible with the callback Lovable currently accepts for its documented public client (http://127.0.0.1:<port>/callback). These are two distinct problems; changing the redirect alone is not known to fix the startup error.

Reproduction and evidence

  1. Run the 0.175.1 binary with eca server --config-file <isolated-config.json> --log-level debug. Set HOME, XDG_CONFIG_HOME, XDG_CACHE_HOME and XDG_DATA_HOME to empty temporary directories; put only the configuration above in the isolated file. Use no stored OAuth tokens, other servers, or user settings.
  2. Over stdio, send a JSON-RPC initialize request with capabilities: {} and then the initialized notification (Content-Length framing). Wait for the asynchronous MCP initialization.
  3. Observe the error above and a failed server. DEBUG did not show an MCP transport HTTP request before the error. The same error occurs with the public client ID configured as clientId.

Further isolation: An isolated local HTTP mock/proxy responding to HEAD and POST with Lovable's 200 and 401 + WWW-Authenticate responses, then pointing discovery at Lovable's real protected-resource metadata, reaches ECA's Using Client ID Metadata Document log. Replaying the other origin response headers locally also reaches that log. An independent request to the remote origin returned HEAD 200 and unauthenticated POST ping 401. In contrast, a local 403/403 response takes ECA's ordinary initialization-failure branch, not this null error. This narrows the failure to ECA's direct interaction with the remote HTTPS origin before successful OAuth discovery, rather than the parsed Lovable metadata or a generic 403 response. The thrown exception class and exact root cause remain unconfirmed: the outer catch logs only .getMessage, and the test binary is a native build. Please identify the exception/stack and fix the underlying pre-discovery failure; it should not be attributed to the redirect mismatch without further evidence.

OAuth callback compatibility

In src/eca/modules/mcp.clj (0.175.1), discover-oauth-info constructs http://localhost:<port>/auth/callback (line 576). The callback server in src/eca/oauth.clj accepts only /auth/callback (near line 207), and the client metadata must also agree. Lovable's open lovablelabs/mcp#7 documents a distinct localhost token-exchange problem and an authorize-stage rejection for its pre-registered public client unless the host is the IP literal 127.0.0.1 and the path is exactly /callback. A preauthorization test with the documented public client ID accepted the latter shape (302 to login) and rejected localhost and /auth/callback (400); no end-to-end login was attempted here.

Please allow a per-server loopback redirect host/path choice, or a 127.0.0.1 + /callback option, while keeping the current default for other providers. The authorization redirect, the local callback route, and any published client metadata must agree; ensure token exchange sends the same URI. A configured clientId should remain usable with this option.

Diagnostics and tests

initialize-server! catches unexpected exceptions at src/eca/modules/mcp.clj:981-985 and logs only .getMessage, which is null for some exception types. Please include at least the exception class and a safe stack/cause in the server log; avoid logging tokens, authorization URLs with state, and response bodies containing credentials. Add regression coverage for the direct Lovable pre-discovery failure after its class is identified, both callback shapes with matching local route/token exchange, and the null-message logging path. This report does not propose changing the user's browser or appending /mcp to the endpoint.

主要语言
Clojure
星标
1k
派生
82
平均合并
21 小时 52 分钟
30 天内合并 PR
13

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

editor-code-assistant/eca 的其他 Issue

查看 editor-code-assistant/eca 的全部 Issue

相似的 Issue

更多 Clojure Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。