⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
Merge commit from fork
Croffaa08401315c2
diff --git a/apps/api/src/__tests__/integration/mcp-authorize-consent.test.ts b/apps/api/src/__tests__/integration/mcp-authorize-consent.test.tsnew file mode 100644index 00000000..49dd6f41--- /dev/null+++ b/apps/api/src/__tests__/integration/mcp-authorize-consent.test.ts@@ -0,0 +1,51 @@+import { beforeEach, describe, expect, it } from 'bun:test';+import { app } from '../helpers/app';+import { signUpTestUser } from '../helpers/auth';+import { resetDb } from '../helpers/db';++describe('MCP authorization always asks for consent', () => {+ beforeEach(resetDb);++ async function registerClient(): Promise<string> {+ const res = await app.handle(+ new Request('http://localhost/api/auth/mcp/register', {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({+ redirect_uris: ['https://client.example.com/callback'],+ token_endpoint_auth_method: 'none',+ client_name: 'Test client',+ }),+ }),+ );+ expect(res.status).toBe(201);+ return ((await res.json()) as { client_id: string }).client_id;+ }++ it('lets a client register without a session', async () => {+ expect(await registerClient()).toBeTruthy();+ });++ it('sends a signed-in person to the consent page instead of the client', async () => {+ const user = await signUpTestUser({ team: false });+ const params = new URLSearchParams({+ response_type: 'code',+ client_id: await registerClient(),+ redirect_uri: 'https://client.example.com/callback',+ code_challenge: 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM',+ code_challenge_method: 'S256',+ scope: 'openid',+ state: 'st',+ });++ const res = await app.handle(+ new Request(`http://localhost/api/auth/mcp/authorize?${params}`, {+ headers: { cookie: user.cookie },+ }),+ );++ const location = res.headers.get('location') ?? '';+ expect(location).toContain('/oauth/consent');+ expect(location).not.toContain('client.example.com');+ });+});diff --git a/packages/auth/src/index.ts b/packages/auth/src/index.tsindex d0e3ad48..ceea40dc 100644--- a/packages/auth/src/index.ts+++ b/packages/auth/src/index.ts@@ -448,6 +448,12 @@ export const auth = betterAuth({return;}+ // Any client can register itself, and the MCP plugin releases the code straight to+ // its redirect URI unless the request asks for consent, so every request asks.+ if (ctx.path === '/mcp/authorize') {+ return { context: { query: { ...ctx.query, prompt: 'consent' } } };+ }+if (ctx.path === '/sign-up/email') {await assertRegistrationAllowed((ctx.body as { email?: string } | undefined)?.email ?? '');return;