mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-16 23:03:06 +00:00
src/auth/oauth.ts configures @cloudflare/workers-oauth-provider: /mcp and legacy /sse protected; /authorize (ours), /token and /register (library); CIMD enabled (with global_fetch_strictly_public in wrangler.toml); scopes read:account/read:jobs/read:catalog; 1h access, 30d idle refresh; error logging by code/category only. `resource` and `authorization_servers` are derived per request origin so one build serves every environment; production sets workers_dev = false so its only origin is canonical. src/index.ts checks the environment invariant first (a misconfigured deploy fails even /token), then hands off to the provider. src/runtime.ts holds the memoized config+app. src/auth/authorize.ts validates the OAuth request via parseAuthRequest, renders unknown-client errors locally and client-validated errors as redirects, and stops at 501 — it never auto-approves. src/mcp/handler.ts is a 501 stub reachable only with a valid token. Tests (10): 401 + resource_metadata challenge on /mcp and /sse, bogus bearer → 401 not 500, health still reachable; PRM at root and /mcp paths with derived resource and this origin as issuer; AS metadata with S256, CIMD flag, "none" auth method, iss support, registration and revocation endpoints; /authorize 400 locally on malformed and unknown client, 201 DCR then 501 with no redirect. pnpm check: typecheck, eslint, prettier, 87 tests passing. Claude-Session: https://claude.ai/code/session_01H3gfN2NCx3hBXSrZXYHUQ3
44 lines
1.2 KiB
JSON
44 lines
1.2 KiB
JSON
{
|
|
"name": "@artcraft/mcp",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"description": "Artcraft MCP server — Cloudflare Worker at mcp.getartcraft.com",
|
|
"type": "module",
|
|
"packageManager": "pnpm@11.23.0",
|
|
"engines": {
|
|
"node": ">=22"
|
|
},
|
|
"scripts": {
|
|
"dev": "wrangler dev",
|
|
"deploy:preview": "wrangler deploy --env preview",
|
|
"deploy:production": "wrangler deploy --env production",
|
|
"gen:api": "node scripts/gen-api.mjs",
|
|
"types": "wrangler types",
|
|
"typecheck": "pnpm types && tsc --noEmit -p tsconfig.json",
|
|
"lint": "eslint .",
|
|
"format": "prettier --check .",
|
|
"format:write": "prettier --write .",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"check": "pnpm typecheck && pnpm lint && pnpm format && pnpm test"
|
|
},
|
|
"dependencies": {
|
|
"@cloudflare/workers-oauth-provider": "0.10.3",
|
|
"hono": "4.13.4",
|
|
"openapi-fetch": "0.17.0",
|
|
"zod": "4.4.3"
|
|
},
|
|
"devDependencies": {
|
|
"@cloudflare/vitest-pool-workers": "0.22.0",
|
|
"@eslint/js": "10.0.1",
|
|
"eslint": "10.9.1",
|
|
"openapi-typescript": "7.13.0",
|
|
"prettier": "3.9.6",
|
|
"smol-toml": "1.8.0",
|
|
"typescript": "5.9.3",
|
|
"typescript-eslint": "8.68.0",
|
|
"vitest": "4.1.11",
|
|
"wrangler": "4.125.0"
|
|
}
|
|
}
|