fix(mcp-kb): address critical issues from deep review

- Fix SQL HAVING clause bug by using CTE approach (closes #73)
- Add /mcp JSON-RPC 2.0 endpoint for tool execution (closes #74)
- Add /mcp/tools endpoint for tool discovery (closes #75)
- Add content size limits to prevent DoS attacks (closes #78)
- Add comprehensive tests for new endpoints

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-04 01:03:58 +01:00
parent e6e98d4ed1
commit 953af52d0e
4 changed files with 557 additions and 9 deletions

View File

@@ -112,6 +112,20 @@ class Settings(BaseSettings):
description="TTL for embedding records in days (0 = no expiry)",
)
# Content size limits (DoS prevention)
max_document_size: int = Field(
default=10 * 1024 * 1024, # 10 MB
description="Maximum size of a single document in bytes",
)
max_batch_size: int = Field(
default=100,
description="Maximum number of documents in a batch operation",
)
max_batch_total_size: int = Field(
default=50 * 1024 * 1024, # 50 MB
description="Maximum total size of all documents in a batch",
)
model_config = {"env_prefix": "KB_", "env_file": ".env", "extra": "ignore"}