System Overview
ToolPilot is a monorepo built with pnpm workspaces and Turborepo. Four apps sit on top of seven shared packages, backed by four infrastructure services.
Architecture Diagram
High-level view of all components and their connections:
┌─────────────┐ ┌──────────────────┐ ┌──────────┐
│ AI Agent │────▶│ MCP Server │────▶│ Memgraph │
│ (Claude, │ │ (@toolpilot/ │ │ (Graph) │
│ Cursor...) │ │ mcp-server) │ └──────────┘
└─────────────┘ └──────────────────┘ │
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Qdrant │ │ PostgreSQL │
│ (Vectors) │ │ (Sessions) │
└──────────────┘ └──────────────┘
▲
│
┌──────────────┐ ┌──────────┐
│ Indexer │────▶│ Redis │
│ (GitHub) │ │ (Queue) │
└──────────────┘ └──────────┘Applications
Four deployable apps live in the apps/ directory:
MCP Server
apps/mcp-serverThe primary product — a Model Context Protocol server that AI agents connect to for tool discovery. Exposes five MCP tools and orchestrates the search package.
Web (Admin)
apps/webNext.js admin dashboard for monitoring graph health, managing tool data, and viewing analytics.
Public Site
apps/publicNext.js public-facing site with documentation, search playground, and marketing pages.
Indexer
apps/indexerGitHub indexer that scans repositories on a schedule, extracts tool metadata, and queues update jobs for workers.
Shared Packages
Seven packages in packages/ provide reusable domain logic:
core
packages/coreShared TypeScript types, Zod schemas, and domain constants used across all apps and packages.
graph
packages/graphMemgraph client and Cypher query builders. Provides repository interfaces for graph reads and writes over the Bolt protocol.
vector
packages/vectorQdrant client, Nomic Embed Code 768-dimensional embeddings, and similarity search helpers.
search
packages/searchThe 4-stage search pipeline — BM25 + vector retrieval, payload filtering, graph reranking, and selection logic.
db
packages/dbPostgreSQL access via Prisma. Handles session storage, analytics events, and user preferences.
queue
packages/queueRedis Streams wrapper (ioredis). Provides reliable job queuing for the indexer worker pipeline.
config
packages/configValidated configuration module — Zod schema over process.env. Single source of truth for all environment variables.
Technology Choices
Each infrastructure service was chosen to match a specific workload pattern:
Memgraph
Native graph processing engine. Tool relationships (RELATED_TO, DEPENDS_ON, ALTERNATIVE_TO) are first-class graph edges, making traversal and reranking queries orders of magnitude faster than join-heavy SQL.
Qdrant
High-performance vector similarity search with rich payload filtering. Supports hybrid BM25 + dense vector queries in a single request, which maps directly to Stage 1 of the search pipeline.
PostgreSQL
ACID-compliant relational storage for session data, analytics events, and user preferences — workloads that benefit from strong consistency and mature tooling (Prisma).
Redis Streams
Reliable, append-only job queue with consumer groups. Ensures indexer workers process every update exactly once, even across restarts, without the operational weight of a dedicated message broker.
Infrastructure
Docker Compose
docker-compose.yml at the repository root. Run pnpm db:up to start everything locally.