Fix/percistent mcp connection (#392)

* feat(oauth): add support for refresh tokens in OAuth flow and update database schema

* feat(prompts): add MCP prompts and corresponding functionality for prompt retrieval

* feat(auth): enhance error handling for refresh token operations and validation
This commit is contained in:
Mattsson
2026-05-05 13:48:53 +02:00
committed by GitHub
parent fa7d4075cf
commit c03582b5c7
10 changed files with 574 additions and 22 deletions
@@ -0,0 +1,40 @@
import { describe, it, expect } from 'vitest'
import { prompts, findPrompt } from '../prompts'
describe('mcp prompt registry', () => {
it('exposes the five single-action prompts', () => {
expect(prompts).toHaveLength(5)
const names = prompts.map((p) => p.name).sort()
expect(names).toEqual([
'cash_today',
'last_month_result',
'uncategorized_count',
'vat_due',
'whats_overdue',
])
})
it('every prompt has description and non-trivial text', () => {
for (const p of prompts) {
expect(p.description).toBeTruthy()
expect(p.text.length).toBeGreaterThan(40)
}
})
it('prompt names are snake_case and unique', () => {
const seen = new Set<string>()
for (const p of prompts) {
expect(p.name).toMatch(/^[a-z][a-z0-9_]*$/)
expect(seen.has(p.name)).toBe(false)
seen.add(p.name)
}
})
it('findPrompt returns the matching prompt', () => {
expect(findPrompt('vat_due')?.name).toBe('vat_due')
})
it('findPrompt returns null for an unknown name', () => {
expect(findPrompt('does_not_exist')).toBeNull()
})
})