Repository navigation
bug(mcp): MCP tool operations are not logged to request_logs table #68
Description
Describe the bug
MCP tool operations (add_memory, search_memory, list_memories, update_memory, delete_memory) are not recorded in the request_logs table, while HTTP API requests (via the web dashboard) are.
This means the "Requests" page in the web UI (crates/memayu-web/src/pages/requests.rs) shows no entries when memories are written/read through the MCP server — only HTTP API calls are visible.
Steps to reproduce
- Start
memayu serveand connect an MCP client (e.g. an stdio MCP client pointing at thememayu mcptransport). - Call any MCP tool (e.g.
add_memory). - Open the web UI → Requests page, or query the
request_logstable directly. - Observe: no rows for the MCP operation.
Expected behavior
MCP tool calls should be logged to request_logs (e.g. method = MCP, path = mcp/<tool_name>, with status + latency + auth) just like HTTP API requests, so the audit log / Requests page is complete regardless of access path.
Root cause (source inspection on main, v0.1.0 line)
crates/memayu-api/src/transport/routes.rscallsrequest_log_insert(...)after HTTP responses.crates/memayu-mcp/src/tools/*.rs(add_memory.rs,search_memory.rs, etc.) callbackend.add_memory()/backend.search_memory()directly and never callrequest_log_insert.- The
memayu-mcpcrate has zero references torequest_log.
Suggested fix
Add request_log_insert calls (or a shared MCP transport middleware/wrapper) in the MCP tool handlers, mirroring the HTTP API's logging. Use a synthetic method/path like MCP / mcp/<tool_name> so the Requests page can distinguish the transport.
Environment
- memayu v0.1.0 (
aarch64-unknown-linux-gnurelease binary) - Local Candle embedder (dim 384)
- Reproduced on Raspberry Pi 4 + macOS client
Context
- Discovered while reviewing PRs feat(cli): improve cli setup wizard #58–chore(docs): add systemd service example, docker-compose, and troubleshooting (#49) #65. The Requests page was implemented in PR feat(cli): improve cli setup wizard #58 (
crates/memayu-web/src/pages/requests.rs) but logging was never extended to the MCP transport.
Activity