Files
accounted/extensions/general/mcp-server/index.ts
T
Jakob WennbergandClaude Opus 4.6 d0b3f21bde feat: remove AI extensions, restructure settings, and add atomic voucher commits (#157)
Remove AI-dependent extensions (ai-chat, ai-categorization, receipt-ocr,
invoice-inbox) and their infrastructure (lib/ai/*, ai-consent, LangChain/
Anthropic/OpenAI deps) to simplify core and reduce bundle size.

Restructure monolithic settings page into dedicated sub-pages (company,
bookkeeping, invoicing, tax, banking, api, account, team, templates) with
shared layout and sidebar navigation.

Add atomic commit_journal_entry RPC so voucher number increment and status
update happen in a single transaction — prevents burned numbers on constraint
failures. Add continuity check report and voucher gap explanation tracking.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 17:08:00 +02:00

46 lines
1.2 KiB
TypeScript

import type { Extension } from '@/lib/extensions/types'
import { handleMcpRequest } from './server'
export const mcpServerExtension: Extension = {
id: 'mcp-server',
name: 'MCP Server',
version: '1.0.0',
settingsPanel: {
label: 'MCP-server (API)',
path: '/settings/api',
},
apiRoutes: [
{
method: 'POST',
path: '/mcp',
skipAuth: true, // Auth handled via API key in the handler
handler: handleMcpRequest,
},
// MCP Streamable HTTP also needs GET for SSE and DELETE for session termination
{
method: 'GET',
path: '/mcp',
skipAuth: true,
handler: async () => {
const appUrl = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'
return new Response('Authorization required', {
status: 401,
headers: {
'WWW-Authenticate': `Bearer resource_metadata="${appUrl}/.well-known/oauth-protected-resource"`,
},
})
},
},
{
method: 'DELETE',
path: '/mcp',
skipAuth: true,
handler: async () => new Response(null, { status: 204 }), // Stateless — no sessions to terminate
},
],
eventHandlers: [],
}