Bug: get_*-by-id MCP tools return a 404 "Record not found" HTML page for valid references (doubled /api/v1 in request path)
Repo: grokify/aha-studio · Version: v0.8.0 (commit b9c4aa6) with grokify/aha-go v0.4.0
Summary
Every MCP getter that goes through the raw getResourceByID helper hits the URL https://<subdomain>.aha.io/api/v1/api/v1/<endpoint>/<id> — note the doubled /api/v1. That path doesn't exist on the Aha! API, so the request falls through to the Aha! web app and returns an HTML "Record not found (404)" page for references that are perfectly valid.
Affected tools
get_epic, get_goal, get_comment, get_requirement, get_user, get_key_result, get_persona, get_team, get_workflow — i.e. everything routed through getResourceByID. (The GraphQL/genqlient-based getters are unaffected.)
Reproduction
get_epic(epic_id="AI-E-9") # valid epic
Returns {"status_code": 404, "epic": "<!DOCTYPE html> ... Aha! | Record not found (404) ..."}.
Root cause
mcp/handlers.go builds a path that already includes /api/v1:
// getResourceByID
resp, err := h.client.DoRaw(ctx, http.MethodGet, fmt.Sprintf("/api/v1/%s/%s", endpoint, id), nil)
…but aha-go's DoRaw appends the path to a base URL that already ends in /api/v1:
// aha-go client.go
url := c.BaseURL() + path // BaseURL() -> "https://<sub>.aha.io/api/v1"
// aha-go config.go buildBaseURL()
return "https://" + c.Subdomain + ".aha.io/api/v1"
Result: …/api/v1 + /api/v1/epics/AI-E-9 → …/api/v1/api/v1/epics/AI-E-9.
Fix
Drop the /api/v1 prefix in the handler, since BaseURL() already supplies it:
resp, err := h.client.DoRaw(ctx, http.MethodGet, fmt.Sprintf("/%s/%s", endpoint, id), nil)
Verified: with this one-line change, all nine getters return 200 with the expected JSON.
Bug:
get_*-by-id MCP tools return a 404 "Record not found" HTML page for valid references (doubled/api/v1in request path)Repo: grokify/aha-studio · Version: v0.8.0 (commit b9c4aa6) with
grokify/aha-go v0.4.0Summary
Every MCP getter that goes through the raw
getResourceByIDhelper hits the URLhttps://<subdomain>.aha.io/api/v1/api/v1/<endpoint>/<id>— note the doubled/api/v1. That path doesn't exist on the Aha! API, so the request falls through to the Aha! web app and returns an HTML "Record not found (404)" page for references that are perfectly valid.Affected tools
get_epic,get_goal,get_comment,get_requirement,get_user,get_key_result,get_persona,get_team,get_workflow— i.e. everything routed throughgetResourceByID. (The GraphQL/genqlient-based getters are unaffected.)Reproduction
Returns
{"status_code": 404, "epic": "<!DOCTYPE html> ... Aha! | Record not found (404) ..."}.Root cause
mcp/handlers.gobuilds a path that already includes/api/v1:…but
aha-go'sDoRawappends the path to a base URL that already ends in/api/v1:Result:
…/api/v1+/api/v1/epics/AI-E-9→…/api/v1/api/v1/epics/AI-E-9.Fix
Drop the
/api/v1prefix in the handler, sinceBaseURL()already supplies it:Verified: with this one-line change, all nine getters return
200with the expected JSON.