System Overview
forge-mcptools is built on a microservices architecture with three main layers:Detailed Architecture Diagram
The following diagram illustrates the complete system architecture showing how MCP clients, the dashboard, connectors, and data layers interact:
Architecture Components
Dashboard & MCP Clients
Dashboard & MCP Clients
User Interfaces
- Dashboard: Web-based UI for managing connectors and servers
- MCP Client/AI Agents: AI assistants like Claude, Cursor that connect via MCP protocol
Application Layer
Application Layer
Central Orchestration
- Routes requests between clients and connectors
- Manages authentication and authorization
- Handles server lifecycle and configuration
- Maintains connector registry
Postgres Connector
Postgres Connector
PostgreSQL Integration
- MCP PG Server 1, 2, …: Multiple server instances
- Each MCP server connects to its corresponding PostgreSQL database
- Supports multiple isolated database connections
- Independent connection pools per server
MySQL Connector
MySQL Connector
MySQL Integration
- MCP Msql Server 1, 2, …: Multiple server instances
- Each MCP server connects to its corresponding MySQL database
- Isolated connections for multi-tenant scenarios
- Per-server connection management
Data Layer
Data Layer
Target Databases
- PostgreSQL databases (Pg server 1, 2, …)
- MySQL databases (Msql server 1, 2, …)
- Each connector can manage multiple database instances
- Secure, encrypted connections
Key Architectural Patterns
Multi-Server Support
Single connector managing multiple server instances with independent configurations
Loose Coupling
Connectors and application layer communicate via REST APIs for flexibility
MCP Protocol
Standardized Model Context Protocol for AI agent integration
Scalability
Each connector scales independently based on load
Core Components
1. Backend API (FastAPI)
Purpose: Central orchestration and management Key Responsibilities:- User authentication (JWT tokens)
- Connector registration and discovery
- Server lifecycle management
- Tool routing and execution
- Configuration storage
- Framework: FastAPI (Python)
- Database: PostgreSQL
- ORM: SQLAlchemy
- Auth: FastAPI Users with JWT
- Migrations: Alembic
2. Frontend Dashboard (React)
Purpose: User interface for management and monitoring Key Features:- Connector management interface
- Server creation and configuration
- Tool playground with parameter input
- Real-time status monitoring
- User account management
- Framework: React 18
- State Management: React Query
- Styling: Tailwind CSS
- HTTP Client: Axios
- Build Tool: Vite
3. Connectors (FastMCP)
Purpose: Data source adapters with MCP protocol Common Features:- Connection pooling
- Async operations
- Schema introspection
- Query execution
- Health monitoring
- Framework: FastMCP (MCP implementation)
- Server: Uvicorn (ASGI)
- Validation: Pydantic
- Package Manager: UV
Data Flow
1. Tool Execution Flow
1
User Request
User invokes a tool via dashboard or API
2
Authentication
Backend validates JWT token and user permissions
3
Server Lookup
Backend retrieves server configuration and connector endpoint
4
Connector Invocation
Backend forwards request to connector service
5
Data Access
Connector executes operation on target data source
6
Response
Results flow back through backend to user
2. Server Creation Flow
Component Communication
Backend ↔ Connectors
Protocol: HTTP/REST Authentication: Internal API keys (optional) Endpoints:Frontend ↔ Backend
Protocol: HTTP/REST with JSON Authentication: JWT Bearer tokens Key Endpoints:Database Schema
Backend Database (PostgreSQL)
Connection Pooling Architecture
Each connector implements intelligent connection pooling:Pool Configuration
Security Architecture
Authentication Flow
Authorization Layers
User Level
- Active vs inactive users
- Superuser privileges
- Email verification
Server Level
- Per-server access control
- Creator ownership
- Shared access (future)
Tool Level
- Read-only tools
- Write/modify tools
- Admin-only tools
Connector Level
- SSL/TLS encryption
- Credential encryption
- Connection string security
Scalability Considerations
Horizontal Scaling
- Backend
- Connectors
- Database
- Stateless API design
- Session store in database
- Load balancer ready
- Multiple instances possible
Performance Optimizations
- Connection Pooling: Reuse database connections
- Async Operations: Non-blocking I/O throughout
- Query Caching: Frequently accessed data cached
- Lazy Loading: Tools loaded on-demand
- Response Streaming: Large results streamed
Deployment Architectures
Development
Production
Monitoring & Observability
Health Checks
Each service exposes
/health endpointLogging
Structured logging with levels (DEBUG, INFO, ERROR)
Metrics
Connection pool stats, request latency, error rates
Tracing
Request ID tracking across services
Technology Decisions
Why FastAPI?
- Automatic OpenAPI documentation
- Native async/await support
- Type validation with Pydantic
- High performance (Starlette/Uvicorn)
- Easy testing
Why React?
- Component-based architecture
- Rich ecosystem
- Excellent developer experience
- Strong TypeScript support
- Large community
Why PostgreSQL?
- JSONB for flexible schemas
- Excellent performance
- ACID compliance
- Rich feature set
- Wide adoption
Why FastMCP?
- MCP protocol implementation
- Tool registration framework
- Async-first design
- Minimal overhead
- Python ecosystem