Skip to content

feat: repoint to backend MCP gateway + require OST_API_KEY#4

Merged
spideystreet merged 3 commits into
mainfrom
feat/user-api-key-auth
Apr 21, 2026
Merged

feat: repoint to backend MCP gateway + require OST_API_KEY#4
spideystreet merged 3 commits into
mainfrom
feat/user-api-key-auth

Conversation

@spideystreet
Copy link
Copy Markdown
Contributor

Summary

Switches the ost-mcp HTTP client from the ost-linker API to the new ost-backend /v1/mcp/* gateway, improves auth/rate-limit/5xx error messages, and documents OST_API_KEY so users actually know it's required.

Pairs with the opensource-together/ost-backend PR on branch feat/user-api-key-auth which implements the gateway + key issuance.

What changed

  • src/config.tsDEFAULT_API_URL now https://api.opensource-together.com/v1/mcp. Startup error when OST_API_KEY is unset now tells the user exactly where to generate one.
  • src/client.ts — 401/403 → "Invalid or missing OST_API_KEY. Regenerate in account settings"; 429 → "Rate limit exceeded. Retry in {Retry-After} seconds"; 5xx → "OST backend temporarily unavailable". Happy path + public signatures untouched.
  • README.md — Quick Start + Distribution snippets now show OST_API_KEY in the env block. Added Environment Variables section.
  • CLAUDE.md — env-var table lists OST_API_KEY as required.
  • Tests — cover missing-key startup error + 401/429/5xx error mapping. All green.

No breaking changes

Public MCP tool schemas unchanged. Existing users already pass OST_API_KEY via the env block (the env var was already enforced at startup in src/config.ts:13) — this PR just makes that visible in the docs.

Test plan

  • npm install && npm run build && npm run lint && npm test all green.
  • Launch MCP without OST_API_KEY → expect the new helpful startup error.
  • With a valid key pointed at the paired backend PR → call search_projects / get_trending / list_categories. Expect normal results.
  • With an invalid key → expect the "Invalid or missing OST_API_KEY" message in the MCP client.
  • Hit rate limit by spamming tool calls → expect the "Rate limit exceeded. Retry in {n} seconds" message.

Startup now fails fast with a guided error when OST_API_KEY is unset.
Default API URL targets the new ost-backend MCP gateway path.
401/403 → guide the user to regenerate their token.
429 → surface Retry-After.
5xx → explicit "temporarily unavailable".
Quick Start and Distribution snippets now include OST_API_KEY in the
env block. Environment Variables table added. Architecture note points
at the backend MCP gateway instead of the linker.
@spideystreet spideystreet merged commit 138fb87 into main Apr 21, 2026
1 check passed
@spideystreet spideystreet deleted the feat/user-api-key-auth branch April 21, 2026 20:17
spideystreet added a commit that referenced this pull request Apr 21, 2026
…#5)

Regression from the merge of #4: getConfig() validated OST_API_KEY but
dropped it from the return value, and OSTClient lost its apiKey field
and the Authorization header attachment. Every MCP request was going
out unauthenticated and getting a misleading "Invalid or missing
OST_API_KEY" error back from the backend.

Restore the plumbing end-to-end: config returns { apiUrl, apiKey };
OSTClient constructor takes (baseUrl, apiKey); request() attaches
Authorization: Bearer \${apiKey} on every call.

Verified by running ost-mcp via stdio against a live backend + real
ost-linker: list_categories and list_techstacks now return the actual
taxonomy data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant