feat(mcp): @superagentskill/sdk + i18n shim for /oauth/success - #20
Merged
Merged
Conversation
Slice 2 of the MCP UX roadmap.
## packages/sdk-ts — @superagentskill/sdk
Thin, strongly-typed client for the public MCP endpoint:
import { SuperAgentSkill, idempotencyKey } from "@superagentskill/sdk";
const sas = new SuperAgentSkill({ token: process.env.SAS_TOKEN });
const out = await sas.call("search_registry", { query: "cardiology" });
Handles the three friction points integrators hit by hand:
* Headers — sets Accept: application/json, text/event-stream so callers
don't trip the 406 footgun.
* Auth — Bearer token + typed MCPUnauthorizedError carrying the
authorization_url / tokens_url hints the server emits.
* Retries — 3 attempts by default, honours Retry-After on 429s,
exponential backoff on 5xx / network errors.
Also surfaces X-RateLimit-* headers as `sas.lastRateLimit` so callers
can self-regulate before hitting the ceiling, and exposes a tiny
`idempotencyKey()` helper for stable write-tool retries.
ToolMap covers every tool the server currently exposes; adding a tool
means updating one file so the SDK never drifts from the wire format.
## src/lib/i18n + /oauth/success in EN/PT-BR
Minimal locale shim (no i18next, no provider) because the rest of the
site is engineering-targeted English and only a handful of pages
deserve translation today. `useLang` resolves from localStorage,
falls back to navigator.language, falls back to en; renders a small
EN / PT switcher on /oauth/success so PT-BR users (the bulk of our
inbound) finally see "Conectado a Cursor" instead of "Connected to".
Notifications/resources/list_changed deferred — mcp-tanstack-start
exposes server→client push only in stateful mode (not currently
configured); we'll wire it in a follow-up once we decide on a session
store.
https://claude.ai/code/session_019gMoupKKTVydpNwiiACQRd
criptogus
marked this pull request as ready for review
May 23, 2026 01:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slice 2 of the MCP UX roadmap. Two of the three planned items land here; the third (
notifications/resources/list_changed) is deferred — see below.1.
@superagentskill/sdk— TypeScript SDKNew package at
packages/sdk-ts/. Thin, strongly-typed client for the public MCP endpoint that handles the three friction points integrators hit by hand:Accept: application/json, text/event-streamso callers don't trip the 406 footgun.MCPUnauthorizedErrorcarrying theauthorization_url/tokens_urlhints from the server.Retry-Afteron 429s, exponential backoff on 5xx / network errors.sas.lastRateLimitparsed fromX-RateLimit-*headers (added in slice 1).idempotencyKey()helper builds stable keys for write-tool retries (relies on slice 1'smcp_idempotencytable).ToolMapcovers every tool today; adding one means updating one file.Build:
cd packages/sdk-ts && npm run build. Publish:npm publish --access public.2. i18n shim —
/oauth/successin EN / PT-BRMost of our inbound is Brazilian, but every new user lands on the connection-success page in English. Now they get a tiny EN / PT switcher and Portuguese copy. Translations live in
src/lib/i18n/dictionaries.ts; resolution is viauseLang()(localStorage →navigator.language→en).Intentionally minimal — no i18next, no provider, no per-request cookie. When/if we localise the full site we can swap the implementation; the dictionaries don't change.
3. Deferred:
notifications/resources/list_changedInvestigated
mcp-tanstack-start. Server→client push notifications require stateful mode (per-session storage), which is not currently configured for this server. Enabling it touches infrastructure (session store choice — in-memory single-instance vs Redis-backed) and is worth its own PR with its own review. Filed as a follow-up.Files
packages/sdk-ts/{package.json,tsconfig.json,README.md,src/index.ts,src/types.ts}(new)src/lib/i18n/{index.ts,dictionaries.ts}(new)src/hooks/use-lang.ts(new)src/routes/oauth.success.tsx— translated copy, language switcherTest plan
cd packages/sdk-ts && npm run buildsucceeds;node -e "console.log(require('./dist/index.js').SuperAgentSkill)"prints a function.npm install ../agent-evolve-network/packages/sdk-ts && node -e "import('@superagentskill/sdk').then(({ SuperAgentSkill }) => new SuperAgentSkill().call('list_packages', { limit: 3 }).then(console.log))"./oauth/successwith browser language=pt-BR → page renders in Portuguese. Toggle switcher → flips to English, persists across reload.https://claude.ai/code/session_019gMoupKKTVydpNwiiACQRd
Generated by Claude Code