mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-08 11:01:35 +00:00
src/tokens/principal.ts: userToken, username, displayName, scopes, and the upstream credential. The provider hands the protected handler only the decrypted grant props, so finishAuthorization now stores userToken and the granted scopes in props alongside the credential and issue time; principalFromProps validates all of it and fails closed with PrincipalError (→ 403) on anything this build does not understand — unknown scopes, wrong token prefix, unrecognised credential kind, missing issue time. Personal tokens (M2) will produce the same props through resolveExternalToken and land on the same function. Also drops @hono/mcp: the SDK's WebStandardStreamableHTTPServerTransport is the right fit for Workers and carries our principal via AuthInfo.extra. Tests (8): rebuild, scope checks, no credential leak through JSON, and the fail-closed cases. Claude-Session: https://claude.ai/code/session_01H3gfN2NCx3hBXSrZXYHUQ3
47 lines
1.3 KiB
JSON
47 lines
1.3 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",
|
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
"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",
|
|
"ajv": "8.20.0",
|
|
"ajv-formats": "3.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"
|
|
}
|
|
}
|