This is a public repository. Do not commit API keys, secrets, internal URLs, customer data, or any proprietary information. Use placeholders in all examples (e.g.
Token YOUR_API_KEY).
This repo is not docs-only. It contains three things that ship independently:
- Documentation (
docs/) — the Mintlify site and the OpenAPI source of truth. - The Terminal49 MCP server + OAuth gateway (
api/,packages/mcp/) — deployed to mcp.terminal49.com on Vercel. - The Terminal49 TypeScript SDK (
sdks/typescript-sdk/) — published to npm as@terminal49/sdk.
It is an npm workspaces monorepo (packages/*, sdks/*), Node 24. The root package-lock.json is the authoritative lockfile; npm ci (root) and Vercel both install from it.
CLAUDE.md/claude.mdare symlinks to this file. EditAGENTS.mdto change agent instructions.
For detailed docs writing standards, voice, and terminology, see WRITING_GUIDE.md and agent.md.
For substantive documentation writing, use the repo-local skill at skills/terminal49-docs-writing/SKILL.md. It includes content-type-specific guides for tutorials, how-to guides, reference pages, concepts, webhook/event docs, SDK/MCP docs, DataSync/coverage docs, changelog/update posts, and navigation.
docs/holds the Mintlify site content and configuration.docs/api-docs/,docs/datasync/,docs/sdk/,docs/mcp/,docs/updates/contain MDX pages grouped by product area.docs/docs.jsondefines navigation, branding, and tabs.docs/openapi.jsonis the source of truth for API reference content.docs/images/andassets/images/store images used by MDX pages.
api/mcp.ts— the MCP endpoint (Streamable HTTP transport, stateless). Handles caller auth: WorkOS AuthKit token resolution, env-token + client-secret mode, and pass-through.api/oauth-protected-resource.ts— RFC 9728 Protected Resource Metadata (/.well-known/oauth-protected-resource).vercel.json— routes (/mcp,/.well-known/*), function config, install/build commands. This is what deploys to mcp.terminal49.com.- These import the server from
packages/mcp/src/.
src/server.ts—createTerminal49McpServer(), built on@modelcontextprotocol/sdk(McpServer,registerTool/registerResource). Used by both the stdio entry (src/index.ts) and theapi/HTTP gateway.src/resource.ts— single source of truth for the OAuthresourceidentifier. Both the PRM endpoint and theWWW-Authenticatechallenge resolve through it so they can never diverge (RFC 9728). Do not reintroduce per-file resource derivation.src/tools/,src/resources/— MCP tools and resources.tests/,src/**/*.test.ts— vitest.
src/— the client (JSON:API, openapi-fetch).src/generated/**is generated — do not hand-edit.
- Docs live in
docs/(MDX,docs/docs.json,docs/openapi.json). - Code in
api/,packages/mcp/, andsdks/typescript-sdk/is editable, but it is deployed, public-facing infrastructure — run the tests and lint before considering a change done. - Do not hand-edit generated files unless explicitly asked:
Terminal49-API.postman_collection.json(fromdocs/openapi.json)sdks/typescript-sdk/src/generated/**(fromdocs/openapi.jsonviaopenapi-typescript)docs/sdk/reference/**(generated SDK docs; CI checks they are up to date)
- Preview locally:
cd docs && mintlify dev - Lint the OpenAPI spec:
spectral lint --ruleset .spectral.mjs docs/openapi.json - Regenerate Postman:
openapi2postmanv2 -s docs/openapi.json -o Terminal49-API.postman_collection.json -p -O folderStrategy=Tags
- Install:
npm ci(root) - Test:
npm run test --workspace @terminal49/mcp -- --run·npm run test --workspace @terminal49/sdk -- --run(vitest) - Typecheck / build:
npm run build --workspace @terminal49/mcp·--workspace @terminal49/sdk(tsc).api/is typechecked by the root config:npx tsc --noEmit -p tsconfig.json. - Lint/format: oxlint + oxfmt (migrated off Biome).
npm run lint --workspace <pkg>; auto-format withnpm run format --workspace <pkg>(oxfmt). Config:.oxlintrc.json+.oxfmtrc.jsonper package. The SDK lint also runsoxfmt --check; MCP is lint-only. - CI (
.github/workflows/ci.yml) runs build + test + lint for both packages. - Running the MCP server locally + testing tool calls with Claude Desktop (stdio and gateway paths): packages/mcp/LOCAL_DEV.md. Gateway env template:
.env.local.example.
- The gateway is an OAuth 2.1 Resource Server; WorkOS is the Authorization Server. Follow the MCP authorization spec (RFC 9728 / 8414 / 8707 / 6750).
- Token validation is delegated to the Terminal49 backend (
/connected-clients/resolve); the backend must enforce the token audience. The gateway must not weaken theWWW-Authenticatechallenge, the PRM document, or the resource resolver without checking the spec. - Config is via env (
WORKOS_*,T49_MCP_*). Never log tokens; return generic auth errors to clients and keep detail in server logs. - The canonical connector URL and OAuth resource identifier is the root origin
https://mcp.terminal49.com(pinWORKOS_MCP_RESOURCE); don't use the/mcppath in client config. Production/client setup (WorkOS dashboard, env vars, ChatGPT + Claude specifics) is in packages/mcp/WORKOS_MCP_SETUP.md.
- Commit history favors conventional prefixes:
docs:,chore:,feat:,fix:. - Keep docs changes, gateway/SDK code changes, and tooling changes in separate commits so reviews stay focused.
- Do not manually edit generated files; update the source and regenerate.
- PRs: short summary, linked issue/ticket if available, screenshots for doc UI changes.
- Never commit real API keys or secrets; use placeholders like
Token YOUR_API_KEY. - The MCP gateway is public-facing — treat auth, the resource resolver, and the discovery endpoints as security-sensitive. Keep local credentials in your environment only.