Master Control Panel (MCP)
Relevant source files
The following files were used as context for generating this wiki page:
- apps/mcp/README.md
- packages/mcp-server/README.md
- README.md
- apps/server-mcp/README.md
- apps/server-mcp/src/static/index.html
- apps/server-mcp/src/electron-main.ts
- apps/gauzy-e2e/src/support/step_definitions/ReportsTest/ReportsTest.ts
- packages/auth/src/lib/mcp/server/oauth-authorization-server.ts
- apps/gauzy-e2e/src/support/step_definitions/OrganizationProjectsTest/OrganizationProjectsTest.ts
- apps/gauzy-e2e/src/support/step_definitions/ManageInterviewsCriterionsTest/ManageInterviewsCriterionsTest.ts
- packages/desktop-ui-lib/src/lib/settings/plugins/component/plugin-marketplace/plugin-marketplace-item/plugin-marketplace-item.component.html
- apps/server-mcp/src/package.json
- apps/gauzy-e2e/src/support/step_definitions/OrganizationHelpCenterTest/OrganizationHelpCenterTest.ts
- apps/gauzy-e2e/src/support/step_definitions/OrganizationDepartmentsTest/OrganizationDepartmentsTest.ts
- apps/gauzy-e2e/src/integration/ManageEmployeesTest.ts
- apps/server-mcp/package.json
The Master Control Panel (MCP) is a server system designed to integrate the Gauzy platform with AI assistants like Claude Desktop and other AI tools. It exposes Gauzy's business management functionalities—such as project management, time tracking, and employee management—through a standardized Model Context Protocol. The system is architected to be flexible, supporting multiple transport layers (Stdio, HTTP, WebSocket) and featuring enterprise-grade OAuth 2.0 security for secure, scalable integrations.
The MCP is available in two main forms: a lightweight, standalone command-line server (apps/mcp) for direct AI assistant integration, and a full-featured Electron desktop application (apps/server-mcp) that provides a graphical interface for server management and monitoring. Both applications are built upon a shared core logic package, @gauzy/mcp-server, which contains all the necessary tools and communication clients.
Sources: apps/mcp/README.md, packages/mcp-server/README.md, apps/server-mcp/README.md
Architecture
The MCP system follows a modular architecture, separating core logic from the final application implementation. This allows for code reuse and tailored experiences for different use cases.
The diagram below illustrates the high-level architecture of the MCP system.
Core Components
The system is composed of three main parts:
-
@gauzy/mcp-server(Shared Package): This is the heart of the MCP system. It's a TypeScript package containing all shared functionality, including:McpServer: The core server implementation.McpServerManager: Manages the server lifecycle (start, stop, restart).ApiClient: An HTTP client for communicating with the main Gauzy API.AuthManager: Handles authentication, token management, and session persistence.- Tool Suite: A comprehensive collection of tools that expose Gauzy features (e.g.,
ProjectTool,TimerTool,EmployeeTool).
-
apps/mcp(Standalone Server): A lightweight, command-line application that runs the MCP server. It's primarily designed for integration with AI assistants via thestdiotransport layer. -
apps/server-mcp(Desktop Application): An Electron-based desktop app that provides a graphical user interface to manage and monitor the MCP server. It wraps the core server logic, offering features like real-time log viewing, status monitoring, and easy configuration.
Sources: packages/mcp-server/README.md:10-21, apps/server-mcp/README.md:5-10, apps/server-mcp/src/electron-main.ts:100-117
The relationship between the main management classes is shown below.
Transport Layers
The MCP server supports three distinct transport layers to cater to different integration needs. The transport mode is configured via the MCP_TRANSPORT environment variable.
| Feature | Stdio | HTTP | WebSocket |
|---|---|---|---|
| Use Case | AI Assistants (Claude Desktop) | Web Apps, REST APIs | Real-time Web Apps |
| Protocol | Standard I/O | JSON-RPC 2.0 over HTTP | JSON-RPC 2.0 over WebSocket |
| Connection | Process-based | Request/Response | Persistent |
| Real-time | No | No | Yes |
| Session Support | N/A | Yes (Redis) | Yes (Redis) |
| OAuth 2.0 | Not supported | Yes (Bearer tokens) | Yes (Bearer tokens) |
| Best For | Claude Desktop, CLI tools | REST clients, Postman | Live dashboards, browsers |
| Default Port | N/A | 3001 | 3002 |
Sources: apps/mcp/README.md:301-316
Stdio Transport
This is the default transport layer, designed for direct integration with AI assistants that follow the Model Context Protocol standard. It communicates via standard input/output streams.
Sources: apps/mcp/README.md:43-50
HTTP Transport
This layer exposes the MCP tools via a JSON-RPC 2.0 API over HTTP. It's suitable for web applications and for testing with tools like curl or Postman. When enabled, the server listens on port 3001 by default, with the main endpoint at POST /sse.
Sources: apps/mcp/README.md:52-60
WebSocket Transport
For real-time, bidirectional communication, the WebSocket transport can be used. It establishes a persistent connection, making it ideal for live applications like dashboards. The server listens on port 3002 by default, and connections are made to the /sse path. It supports TLS/WSS for secure connections.
Sources: apps/mcp/README.md:62-70
Security and OAuth 2.0 Authorization
The MCP server implements an enterprise-grade OAuth 2.0 authorization system for its HTTP and WebSocket transports, adhering to standards like RFC 6749, RFC 9728, and RFC 8707. This is disabled by default but can be enabled by setting MCP_AUTH_ENABLED=true.
Sources: apps/mcp/README.md:320-327, packages/auth/src/lib/mcp/server/oauth-authorization-server.ts
OAuth 2.0 Authorization Server
The project includes a dedicated OAuth 2.0 authorization server, implemented in packages/auth/src/lib/mcp/server/oauth-authorization-server.ts. This server handles user authentication, client authorization, and token issuance.
Key features include:
- Grant Types: Supports
authorization_code(with PKCE),client_credentials, andrefresh_token. - Endpoints: Exposes standard OAuth 2.0 endpoints:
/.well-known/oauth-authorization-server: Server metadata./.well-known/jwks.json: JSON Web Key Set for token signature verification./oauth2/authorize: User authorization and consent./oauth2/token: Token issuance and refresh./oauth2/introspect: Token introspection (RFC 7662)./oauth2/userinfo: User information.
- Security: Implements
helmetfor security headers, rate limiting, andcsrf-csrffor double-submit cookie CSRF protection on state-changing form submissions. - Session Management: Uses
express-sessionwith an optional Redis backend for scalable session storage.
Sources: packages/auth/src/lib/mcp/server/oauth-authorization-server.ts:285-351, 49-56
Authorization Code Flow
The following diagram shows the sequence for a user authorizing a client application using the Authorization Code grant with PKCE.
Desktop Application (server-mcp)
The apps/server-mcp project is an Electron desktop application that provides a user-friendly interface for managing the MCP server.
Main Process and UI
The application's entry point is electron-main.ts. It is responsible for:
- Initializing the
McpServerManager. - Creating the
BrowserWindowto render the UI. - Setting up Inter-Process Communication (IPC) handlers to connect the main process with the renderer process.
- Applying security settings and managing the application lifecycle.
The UI is a single HTML file, static/index.html, which presents a dashboard for monitoring server status, viewing logs, and performing actions.
Sources: apps/server-mcp/src/electron-main.ts:100-123, 180-244, apps/server-mcp/src/static/index.html
Startup and IPC
On startup, the main process initializes the McpServerManager and then creates the main window, loading index.html. The renderer process (UI) communicates with the main process via IPC to get status updates and trigger actions.
The diagram below shows the startup and status refresh flow.
Key IPC handlers defined in electron-main.ts:
get-mcp-status: Fetches the current status fromMcpServerManager.restart-mcp-server: Triggers therestart()method onMcpServerManager.server-status-update: A push event from main to renderer to notify of status changes.
Sources: apps/server-mcp/src/electron-main.ts:298-368
Configuration
The MCP server is configured primarily through environment variables.
| Variable | Description | Default |
|---|---|---|
MCP_TRANSPORT | The transport layer to use. | stdio |
MCP_SERVER_MODE | Alias for MCP_TRANSPORT. | stdio |
API_BASE_URL | The base URL of the Gauzy API server. | http://localhost:3000 |
GAUZY_AUTH_EMAIL | Email for automatic login to the Gauzy API. | - |
GAUZY_AUTH_PASSWORD | Password for automatic login. | - |
GAUZY_AUTO_LOGIN | Whether to automatically log in on startup. | true |
GAUZY_MCP_DEBUG | Enables verbose debug logging. | false |
MCP_HTTP_PORT | Port for the HTTP transport. | 3001 |
MCP_WS_PORT | Port for the WebSocket transport. | 3002 |
MCP_AUTH_ENABLED | Enables OAuth 2.0 authorization. | false |
MCP_AUTH_RESOURCE_URI | The resource URI for OAuth 2.0. | https://mcp.gauzy.co |
MCP_AUTH_JWT_JWKS_URI | The JWKS endpoint for JWT validation. | - |
REDIS_URL | Connection URL for Redis session storage. | - |
Sources: apps/mcp/README.md:80-120, 160-200
Available Tools
The MCP server exposes a wide range of Gauzy's functionalities as "tools" that can be called by an AI assistant or client application. These tools are organized into logical categories.
| Category | Description |
|---|---|
| Authentication | User login, logout, and session management. |
| Employee Management | CRUD operations for employees, profile management. |
| Task Management | Full task lifecycle management, including bulk operations. |
| Project Management | Project creation, updates, and assignment. |
| Daily Planning | Create and manage personal and team daily plans. |
| Time Management | Start, stop, and get status of time tracking. |
| Financial Management | Payments, expenses, and invoicing. |
| Sales & CRM | Manage deals and sales pipelines. |
| Reporting | Generate data analytics and insights. |
Sources: packages/mcp-server/README.md:65-148, apps/mcp/README.md:255-285