How narayanan1208/mcp-multi-agent-ai-assistant works
1. Repository shape
- This is primarily a Python backend for an AI assistant, with a prebuilt static frontend bundled under backend/static.
- The architecture is centered on a multi-agent orchestration layer plus a tool/data layer backed by SQLite.
2. Primary request entrypoint
- backend/main.py is the runtime entrypoint and likely the HTTP application entry used by uvicorn.
- The README shows a single conversational API surface: POST /chat, which is the main inbound boundary for user requests.
3. High-level control flow
- The intended flow is: User input → Main Agent → MCP Client → MCP Server → Tool → Database.
- This creates a clean separation between language/intent handling, tool invocation, and persistent storage.
4. Agent orchestration boundary
- backend/agents/main_agent.py is the coordinator that routes requests to specialized behavior.
- backend/agents/planner_agent.py handles multi-step workflows, especially the “plan my day” type of request that combines multiple data sources into one response.
5. Intent handling
- backend/services/intent_service.py suggests a dedicated intent-routing layer that classifies or normalizes user messages before agent dispatch.
- This is the decision point that likely distinguishes task, schedule/calendar, note, and planning requests.
6. MCP layer as the tool boundary
- backend/mcp/client.py, server.py, and setup.py implement a lightweight Model Context Protocol style boundary.
- The purpose of this layer is to keep agents from calling storage/tools directly; instead they invoke structured actions through MCP, improving modularity and making new tools easier to add.
7. Tooling and persistence
- backend/tools/db_tool.py is the concrete execution layer for storage operations.
- The README indicates SQLite is the persistent store for tasks, events, and notes, so this tool is the main bridge from assistant actions to durable state.
8. Session/state management
- backend/state/session_store.py provides per-session or conversation state, which matters for multi-turn interactions and planning workflows.
- This likely complements the database by storing ephemeral conversation context separate from persisted user content.
9. Supported data domains
- The system is organized around three user data types: tasks, schedules/events, and notes.
- The planner agent combines these domains, so the diagram should show them as separate logical sources feeding a higher-level planning workflow.
10. Frontend delivery
- backend/static/index.html plus hashed JS/CSS bundles indicate a compiled frontend app served by the backend.
- The backend therefore acts as both an API server and a static asset host, not just a pure JSON service.
11. Runtime and deployment
- The presence of Dockerfile, requirements.txt, and the README’s uvicorn main:app --reload indicate a standard Python ASGI deployment.
- The project is designed to be container-friendly and deployable to environments like Docker or Cloud Run.
12. What to emphasize in an architecture diagram
- Show three clear boundaries: UI, Agent Orchestration, and Tool/Data Access.
- Highlight the MCP client/server split as the decoupling mechanism between decision-making and database operations.
- Make the planner agent a special multi-step path that reads from multiple sources before producing a synthesized response.
Main entry points: planner_agent.py Planner · main_agent.py Main agent · main.py Main app · client.py MCP client
Components 14
UI
Prebuilt static frontend served by the backend
- Frontend · Compiled UI bundle served from backend/static
backend/static/index.html
Backend
HTTP entrypoint and agent orchestration
- Main app · Runtime entrypoint and HTTP surface for chat requests
backend/main.py - Intent router · Classifies and normalizes user requests before agent dispatch
backend/services/intent_service.py - Main agent · Primary conversational coordinator
backend/agents/main_agent.py - Planner · Handles multi-step planning and synthesis across sources
backend/agents/planner_agent.py
MCP
Structured tool boundary between agents and execution
- MCP client · Agent-side client for structured tool calls
backend/mcp/client.py - MCP server · Server-side boundary for invoking tools
backend/mcp/server.py - MCP setup · Initializes the MCP tool boundary
backend/mcp/setup.py
Data
Persistent and conversational state
- Session store · Per-session or per-conversation ephemeral state
backend/state/session_store.py - DB tool · Concrete execution layer for persistence actions
backend/tools/db_tool.py - SQLite store · Persistent store for tasks, events, and notes
- Tasks · Task records and task-related state
- Events · Schedule and calendar records
- Notes · Note records and captured content
Connections 18
- Frontend → Main app: chat UI · User actions reach the backend via the conversational API
- Main app → Intent router: route · Incoming requests are normalized and classified
- Intent router → Main agent: dispatch · Intent classification selects the main conversational path
- Main app → Session store: state · Conversation state is loaded and updated per session
- Main agent → Session store: context · The agent reads and updates dialogue context
- Main agent → MCP client: tools · The agent invokes external actions through MCP
- Planner → MCP client: tools · Planning workflows use the same structured tool boundary
- Main agent → Planner: plan flow · Specialized planning requests are delegated to the planner
- MCP client → MCP server: call · Client-server split decouples reasoning from execution
- MCP setup → MCP server: bootstrap · MCP wiring prepares the tool server at runtime
- MCP server → DB tool: invoke · Structured actions are translated into storage operations
- DB tool → SQLite store: persist · Tool writes to and reads from SQLite-backed storage
- SQLite store → Tasks: stores · Task domain data is persisted in the database
- SQLite store → Events: stores · Event and schedule data is persisted in the database
- SQLite store → Notes: stores · Notes are persisted in the database
- Planner → Tasks: reads · Planning combines task state with other sources
- Planner → Events: reads · Planning considers schedule availability
- Planner → Notes: reads · Planning can incorporate note content