compassmock/drizzle/0019_parched_thunderbird.sql
Nicholai dc0cd40b13
feat(agent): add Claude Code bridge integration (#60)
Add local daemon that routes inference through user's own Anthropic
API key with filesystem and terminal access. Includes WebSocket
transport, MCP tool adapter, and API key auth.

Key components:
- compass-bridge package: local daemon with tool registry
- WebSocket transport for agent communication
- MCP API key management with HMAC auth and scoped permissions
- Usage tracking (tool calls, duration, success/failure)
- Settings UI for Claude Code configuration
- Migration 0019: mcp_api_keys and mcp_usage tables
- Test suite for auth and transport layers

Co-authored-by: Nicholai <nicholaivogelfilms@gmail.com>
2026-02-09 00:29:00 -07:00

27 lines
871 B
SQL

CREATE TABLE `mcp_api_keys` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`name` text NOT NULL,
`key_prefix` text NOT NULL,
`key_hash` text NOT NULL,
`scopes` text NOT NULL,
`last_used_at` text,
`created_at` text NOT NULL,
`expires_at` text,
`is_active` integer DEFAULT true NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `mcp_usage` (
`id` text PRIMARY KEY NOT NULL,
`api_key_id` text NOT NULL,
`user_id` text NOT NULL,
`tool_name` text NOT NULL,
`success` integer NOT NULL,
`error_message` text,
`duration_ms` integer NOT NULL,
`created_at` text NOT NULL,
FOREIGN KEY (`api_key_id`) REFERENCES `mcp_api_keys`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);