MCP Server¶
Aikioku exposes a Model Context Protocol (MCP) server at /mcp, providing
33 tools (20 read, 12 write, and one generic call_api). Any MCP-compatible
client can connect and interact with your knowledge base as tools.
- Endpoint:
http://localhost:8869/mcp(Docker default;http://localhost:8000/mcpwhen running the server outside Docker) - Transport: Streamable-HTTP (FastMCP)
- Auth: Personal Access Token (PAT) in
Authorization: Bearer <token>header
Getting a Token¶
- Open the Aikioku web UI → Settings → API access
- Create a token with scope
readorfull - Copy the token immediately — it's shown only once (SHA-256 hashed in DB)
Token Scopes¶
| Scope | Capabilities |
|---|---|
read |
All read tools (search, retrieval, graph, RAG, export) |
full |
All read + write tools (create/update/delete notes, generate cards, import) |
Read Tools¶
Search & Retrieval¶
| Tool | Description | Parameters |
|---|---|---|
search_notes |
Full-text search | q, limit (default 20) |
hybrid_search |
RRF fusion (dense+sparse+graph) | query, limit (default 20) |
list_notes |
List notes, filter by tag/search | tag, search, skip, limit |
get_note |
Fetch note by ID | note_id |
ask |
RAG question answering | query, mode ("simple" or "multi_hop") |
Knowledge Graph¶
| Tool | Description | Parameters |
|---|---|---|
list_entities |
List entities | type, search, limit |
get_entity |
Get entity with properties | entity_id |
get_entity_subgraph |
BFS neighbourhood | entity_id, depth (1–5) |
graph_paths |
Find paths between entities | source, target, max_depth |
graph_stats |
Entity/relation counts | — |
discover_connections |
Indirect connections | entity_id, max_distance |
Conversations & Augmentation¶
| Tool | Description | Parameters |
|---|---|---|
list_conversations |
Load chat history, newest-first (paginated) | limit (default 50), before (cursor) |
generate_questions |
Generate review questions from a note | note_id, count (1–20, default 5) |
git_history |
Git commit history of the notes vault | limit (default 20) |
Review & Serendipity¶
| Tool | Description | Parameters |
|---|---|---|
list_due_cards |
Cards due for review | limit (default 20) |
get_review_stats |
Card collection stats | — |
serendipity_walk |
Random graph walk | start_entity_id, steps |
Summarization & Export¶
| Tool | Description | Parameters |
|---|---|---|
get_note_summary |
Progressive summary | note_id |
stats |
System-wide counts | — |
export_json |
Export all data as JSON | — |
Write Tools (require full scope)¶
| Tool | Description | Parameters |
|---|---|---|
create_note |
Create note | title, content, path |
update_note |
Update note | note_id, title, content |
delete_note |
Delete note | note_id |
create_memory |
Create a hidden note from free text (agent-generated, source_type='hidden') |
text, source (default user) |
auto_tag_note |
Auto-generate tags for a note | note_id |
clear_conversations |
Delete the caller's entire chat history | — |
git_commit |
Stage all vault changes and commit | message |
scan_anomalies |
Run all knowledge-base anomaly checks | — |
summarize_note |
Generate summary | note_id |
generate_cards |
Generate flashcards | note_id |
review_card |
Review flashcard | card_id, rating (1–4) |
import_markdown |
Import markdown note | content, title, path |
Escape Hatch¶
| Tool | Description | Parameters |
|---|---|---|
call_api |
Call any REST endpoint | method, path, query, body |
Security: call_api blocks /api/auth, /api/setup, /api/settings/secrets,
and /api/settings/tokens to prevent privilege escalation.
Architecture¶
Built with FastMCP (streamable-HTTP), mounted into the FastAPI app at /mcp.
Each tool is a thin wrapper that re-enters the same app over an in-process
httpx ASGI transport — no duplicated logic.
Auth flow:
1. Client sends Authorization: Bearer <pat>
2. Middleware validates PAT at /mcp boundary
3. Each tool reads PAT from request context, verifies scope
4. Internal REST calls carry short-lived JWT (5 min) minted for token owner
Security:
- PATs SHA-256 hashed — leaked DB cannot reveal usable tokens
- Write tools require full scope
- call_api blocks auth/setup/secret/token routes
- Internal JWTs short-lived (5 minutes)
Client Configuration¶
Claude Desktop¶
~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"aikioku": {
"type": "streamableHttp",
"url": "http://localhost:8869/mcp",
"headers": {
"Authorization": "Bearer sbk_your_token_here"
}
}
}
}
Cursor¶
.cursor/mcp.json:
{
"mcpServers": {
"aikioku": {
"type": "streamableHttp",
"url": "http://localhost:8869/mcp",
"headers": {
"Authorization": "Bearer sbk_your_token_here"
}
}
}
}
Hermes Agent¶
~/.hermes/profiles/default/mcp.json:
{
"mcpServers": {
"aikioku": {
"type": "streamableHttp",
"url": "http://localhost:8869/mcp",
"headers": {
"Authorization": "Bearer sbk_your_token_here"
}
}
}
}
Claude Code¶
Generic Client¶
Any MCP client supporting streamable-HTTP:
http://<host>:8869/mcp
Authorization: Bearer <pat>
stdio-only Clients¶
Bridge with mcp-remote:
{
"mcpServers": {
"aikioku": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:8869/mcp",
"--header", "Authorization: Bearer sbk_your_token_here"]
}
}
}
Remote Access¶
Compose binds to 127.0.0.1 only. For remote access, put a reverse proxy
(nginx, Caddy, Cloudflare Tunnel) in front of port 8869. The PAT gate on
/mcp makes this safe. Do not change the bind to 0.0.0.0 without
understanding the exposure.
Rate Limiting¶
Tools re-enter the same REST app, so LLM-backed tools are bound by the daily LLM
budget (llm_daily_budget_usd, default 5.0). When it is reached, interactive
tools return an error, while tools that ingest content (notes, including hidden notes) still
persist the content and queue its LLM processing until the budget resets at 00:00
UTC. The per-minute HTTP rate limits (import, chat) are keyed by client IP at the
REST boundary.