ADR-0009 — MCP Integration Design
Date: 2026-05-19
Status: Accepted
Context
UseCase objects contain all business logic and are already independent of HTTP. Exposing them as MCP tools allows AI agents (Claude Desktop, claude CLI, any MCP client) to call them directly without the HTTP stack.
Decision
mcp>=1.0(Anthropic official Python SDK) as the transport layerFastMCPfrommcp.server.fastmcpfor tool declaration via decoratorsLocalMcpServerinnene2.mcp— thin wrapper with NENE2 naming andstdiodefault- Tool registration in application layer (
example/mcp.py), not in the framework _build_repositories()fromexample/app.pyis reused — same DB config, same SQLite/MySQL supportdataclasses.asdict()serializes entity output todictfor MCP JSON transportpython -m exampleorpython -m example.mcpas the entry pointstdiotransport by default (Claude Desktop integration);sse/streamable-httpavailable for web clients
Tool naming
| MCP tool | UseCase |
|---|---|
list_notes | ListNotesUseCase |
get_note | GetNoteUseCase |
create_note | CreateNoteUseCase |
update_note | UpdateNoteUseCase |
delete_note | DeleteNoteUseCase |
list_tags | ListTagsUseCase |
get_tag | GetTagUseCase |
create_tag | CreateTagUseCase |
update_tag | UpdateTagUseCase |
delete_tag | DeleteTagUseCase |
Consequences
- Zero additional API surface — each tool maps 1:1 to an existing UseCase
- Domain exceptions (
NoteNotFoundException) propagate as MCP error responses automatically - No auth on the MCP server itself (Claude Desktop is local-only); add
TokenVerifierProtocolwrapping if exposing viassetransport - MCP server and HTTP server share the same DB (same
_build_repositories()call) — data is consistent