Skip to content

Add API key authentication and MCP search improvements#352

Merged
239573049 merged 1 commit intoAIDotNet:mainfrom
keboola:upstream/api-key-auth
Apr 11, 2026
Merged

Add API key authentication and MCP search improvements#352
239573049 merged 1 commit intoAIDotNet:mainfrom
keboola:upstream/api-key-auth

Conversation

@manana2520
Copy link
Copy Markdown
Contributor

Summary

This PR adds API key authentication for headless/M2M MCP access, fixes SearchDocuments, and adds repository metadata to the MCP API.

API Key Authentication

  • New ApiKey entity with split-token storage (dwk_ prefix, SHA-256 hashed, constant-time comparison)
  • ASP.NET Core ApiKeyAuthenticationHandler that works alongside existing JWT/OAuth auth
  • Admin endpoints (POST/GET/DELETE /api/admin/api-keys) for key management
  • User self-service endpoints (POST/GET/DELETE /api/auth/api-keys)
  • Admin UI page at /admin/api-keys
  • User settings page API Keys section at /settings
  • MCP endpoint accessible without Google OAuth when API key is provided

Fix SearchDocuments

  • Replace StringComparison.OrdinalIgnoreCase with EF.Functions.Like in the search query
  • Fixes SQLite EF Core translation error that caused SearchDocuments to fail at runtime

Repository Metadata

  • Add Description field to Repository entity (populated from GitHub on import)
  • Add Description and PrimaryLanguage to DepartmentRepositoryInfo
  • DB migration for existing SQLite databases (ALTER TABLE + CREATE TABLE IF NOT EXISTS)

Frontend

  • Admin API Keys management page with create/list/revoke
  • User self-service API Keys in settings with one-time key reveal + copy
  • Sidebar navigation for API Keys admin page
  • i18n translations for en, zh, ko, ja

Motivation

Enables headless services (CI/CD, autonomous agents) to authenticate with the MCP endpoint without browser-based OAuth flows.

…ta (AIDotNet#26)

API Key Authentication (headless/M2M):
- Split-token API key scheme (dwk_ prefix, SHA-256 hashed storage)
- Constant-time hash comparison, instant revocation
- ASP.NET Core auth handler alongside existing OAuth
- Admin endpoints for key management (POST/GET/DELETE /api/admin/api-keys)
- User self-service endpoints (POST/GET/DELETE /api/auth/api-keys)
- Admin UI page at /admin/api-keys
- User settings page API Keys section at /settings
- MCP endpoint works without Google OAuth when API key is provided

Cross-Repository Search:
- New SearchAllRepositories MCP tool searches across all accessible repos
- Single JOIN query with EF.Functions.Like, filtered by user's accessible repos
- Returns snippets with relevance scoring (title match = 2.0, content = 1.0)

Fix SearchDocuments:
- Replace StringComparison.OrdinalIgnoreCase with EF.Functions.Like
- Fixes SQLite EF Core translation error at runtime

Repository Metadata:
- Add Description field to Repository entity (populated from GitHub on import)
- Expose Description and PrimaryLanguage in ListRepositories MCP tool
- Add Description to DepartmentRepositoryInfo for department repo queries

i18n: translations for all 4 locales (en, zh, ko, ja)
@239573049 239573049 merged commit dbd35d1 into AIDotNet:main Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants