Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

chore: update wellknown paths

Andrej90aa1649eed4
diff --git a/apps/api/src/mcp/index.ts b/apps/api/src/mcp/index.ts
index f1dda0ffd..435044ce8 100644
--- a/apps/api/src/mcp/index.ts
+++ b/apps/api/src/mcp/index.ts
@@ -306,7 +306,11 @@ mcp.get("/.well-known/oauth-authorization-server/api", (c) =>
mcp.all("/mcp", async (c) => {
const authResult = await validateBearerToken(c.req.raw);
if (!authResult) {
- const prmUrl = `${publicApiUrl}/api/.well-known/oauth-protected-resource/api/mcp`;
+ // Canonical RFC 9728 URL: the well-known path goes before the resource
+ // path. MCP clients discover from this header, so it must be the URL
+ // auditors accept; the /api/.well-known alias below stays for clients
+ // that cached the previously advertised URL.
+ const prmUrl = `${publicApiUrl}/.well-known/oauth-protected-resource/api/mcp`;
c.header("WWW-Authenticate", `Bearer resource_metadata="${prmUrl}"`);
return c.json(
{
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6457156a3..4d1c9f7d4 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -105,7 +105,7 @@ importers:
version: 7.0.2
vite-plus:
specifier: 'catalog:'
apps/api:
dependencies:
@@ -229,7 +229,7 @@ importers:
vitest:
specifier: 'catalog:'
apps/site:
dependencies:
@@ -639,7 +639,7 @@ importers:
vite-plus:
specifier: 'catalog:'
packages/cli:
devDependencies:
@@ -718,7 +718,7 @@ importers:
version: 7.0.2
vite-plus:
specifier: 'catalog:'
packages/importers:
dependencies:
@@ -773,7 +773,7 @@ importers:
vite-plus:
specifier: 'catalog:'
packages/mcp:
dependencies:
@@ -826,7 +826,7 @@ importers:
vite-plus:
specifier: 'catalog:'
packages/planka-import:
dependencies:
@@ -13502,7 +13502,7 @@ snapshots:
picocolors: 1.1.1
redent: 3.0.0
optionalDependencies:
dependencies:
@@ -14075,7 +14075,7 @@ snapshots:
'@testing-library/dom': 10.4.1
'@testing-library/user-event': 14.6.7(@testing-library/[email protected])
transitivePeerDependencies:
- bufferutil
- msw
@@ -14092,7 +14092,7 @@ snapshots:
pngjs: 7.0.0
sirv: 3.0.2
tinyrainbow: 3.1.1
ws: 8.21.3
transitivePeerDependencies:
- bufferutil
@@ -14110,7 +14110,7 @@ snapshots:
obug: 2.2.1
std-env: 4.2.0
tinyrainbow: 3.1.1
'@vitest/[email protected]': {}
@@ -14171,7 +14171,7 @@ snapshots:
pathe: 2.0.3
sirv: 3.0.2
tinyrainbow: 3.1.1
'@vitest/[email protected]':
dependencies:
@@ -14490,7 +14490,7 @@ snapshots:
react: 19.3.0
react-dom: 19.3.0([email protected])
solid-js: 1.9.15
transitivePeerDependencies:
- '@cloudflare/workers-types'
- '@opentelemetry/api'
@@ -14526,7 +14526,7 @@ snapshots:
react: 19.3.0
react-dom: 19.3.0([email protected])
solid-js: 1.9.15
transitivePeerDependencies:
- '@cloudflare/workers-types'
- '@opentelemetry/api'
@@ -18655,7 +18655,7 @@ snapshots:
oxlint-tsgolint: 7.0.2003
optionalDependencies:
'@voidzero-dev/vite-plus-darwin-arm64': 1.0.0
'@voidzero-dev/vite-plus-darwin-x64': 1.0.0
@@ -18710,7 +18710,7 @@ snapshots:
oxlint-tsgolint: 7.0.2003
optionalDependencies:
'@voidzero-dev/vite-plus-darwin-arm64': 1.0.0
'@voidzero-dev/vite-plus-darwin-x64': 1.0.0
@@ -18765,7 +18765,7 @@ snapshots:
tsx: 4.23.15
yaml: 2.9.0
dependencies:
'@types/chai': 5.2.3
@@ -18790,7 +18790,7 @@ snapshots:
transitivePeerDependencies:
- msw
dependencies:
'@types/chai': 5.2.3
@@ -18809,6 +18809,7 @@ snapshots:
optionalDependencies:
'@opentelemetry/api': 1.9.1
'@types/node': 26.6.3
'@vitest/coverage-v8': 5.0.3([email protected])
jsdom: 30.1.1(@noble/[email protected])
transitivePeerDependencies:
diff --git a/tests/api/mcp-stateless.test.ts b/tests/api/mcp-stateless.test.ts
index 423577816..6eba64dbd 100644
--- a/tests/api/mcp-stateless.test.ts
+++ b/tests/api/mcp-stateless.test.ts
@@ -305,6 +305,25 @@ describe("MCP 2026-07-28 stateless HTTP", () => {
expect((await mcpRoutes.request(unauthenticated)).status).toBe(401);
});
+ it("advertises the canonical protected-resource metadata URL on 401", async () => {
+ const response = await mcpRoutes.request("/mcp", {
+ method: "POST",
+ headers: {
+ accept: "application/json, text/event-stream",
+ "content-type": "application/json",
+ },
+ body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/list" }),
+ });
+
+ expect(response.status).toBe(401);
+ const header = response.headers.get("www-authenticate") ?? "";
+ expect(header.startsWith("Bearer ")).toBe(true);
+ expect(header).toContain("/.well-known/oauth-protected-resource/api/mcp");
+ // RFC 9728 inserts the well-known path before the resource path, so the
+ // advertised URL must not carry the API mount before it.
+ expect(header).not.toContain("/api/.well-known/oauth-protected-resource");
+ });
+
it("serves legacy requests across replicas without a session ID", async () => {
const replicaA = await import("../../apps/api/src/mcp");
vi.resetModules();