Introducing a new way to review your PRs.

Read the announcement

ever-co / ever-gauzy

Ever® Gauzy™ - Open Business Management Platform (ERP/CRM/HRM/ATS/PM) - https://gauzy.co

View on GitHub

27 documents · Updated Nov 23, 2026

docs / mcp-server-capabilities

MCP server capabilities

The Gauzy MCP server is the shared service boundary that lets an AI client discover and use Gauzy business actions through the Model Context Protocol (MCP). The reusable @gauzy/mcp-server package provides the tool and protocol service. The server-mcp application provides a desktop host that starts, monitors, and manages that service. See MCP integration for the wider MCP system, MCP authentication and client for the identity boundary, and deployment and developer operations for operating a host.

System boundary

Package and host roles

The shared package turns Gauzy API capabilities into one MCP server that can run in more than one host. The standalone MCP application and the server-mcp desktop application use the same package, so local and hosted clients receive the same business contract.

flowchart LR
    Client[AI client] --> Transport[MCP transport]
    Transport --> Server[Shared MCP server]
    Server --> Tools[Gauzy tool surface]
    Tools --> API[Gauzy API]
    Desktop[server-mcp desktop host] --> Manager[Server manager]
    Manager --> Server

The package exposes the server, transport, tool, environment, and shared service capabilities. The desktop main process owns the server manager and reports service state to the desktop window. The packaged desktop product uses the built shared package as its runtime service.

References: packages/…/README.md• L1-23 packages/…/mcp-server.ts• L277-360 packages/…/package.json• L19-29 apps/…/electron-main.ts• L34-39

Tool surface

Gauzy business capabilities

The tool surface gives an AI client controlled access to Gauzy work systems. A tool represents one user-facing query or action. The server presents these actions as one product surface instead of exposing the API's route layout.

The main capability groups are:

  • Identity, session checks, API checks, and server information.
  • Employees, contacts, candidates, skills, and awards.
  • Projects, tasks, daily plans, timers, and time off.
  • Goals, key results, reports, comments, and activity logs.
  • Products, categories, equipment, and warehouses.
  • Invoices, expenses, payments, income, merchants, deals, and pipelines.
  • Collaboration through chat, documents, and inbox tools when a deployment enables those groups.

The shared registration path assembles the business groups for server creation and schema checks. Most groups support both reads and changes. Some tools remain listed but report that the Gauzy API does not offer the requested action, so a client can distinguish an unavailable product action from an unknown MCP tool.

GroupMain capabilityTypical actions
WorkforceEmployees, candidates, contacts, skills, and awardsFind people, manage records, assign relationships, and review work details
Work planningProjects, tasks, daily plans, timers, and time offRead work, plan days, track time, and manage leave requests
Goals and recordsGoals, key results, reports, comments, and activity logsTrack progress, review records, and inspect workspace history
Finance and salesInvoices, expenses, payments, income, merchants, deals, and pipelinesReview and change financial and sales records
InventoryProducts, categories, equipment, and warehousesManage catalog, assets, and stock locations
CollaborationChat, docs, and inboxRead user collaboration data and perform scoped user actions

The package README describes the core surface as 323 tools across 22 categories. It also describes 14 collaboration tools in three groups. Collaboration groups are off by default and are enabled per deployment.

References: packages/…/README.md• L102-116 packages/…/README.md• L121-251 packages/…/register-all-tools.ts• L32-67 packages/…/timer.ts• L12-190

Tool discovery and calls

The server presents each tool with a name, description, input schema, and optional safety hints. An AI client can first learn the available actions and then submit a validated call without knowing the internal Gauzy service layout.

The same registered surface serves discovery and execution across hosts. A client uses initialize, reads tools/list, and then sends tools/call. The server validates the input before it reaches a Gauzy API action. Tool discovery converts the registered input contract to JSON Schema so clients see the same parameter shape across transports.

Tool failures keep a short message for the client and a sanitized diagnostic record for the server log. When the Gauzy API explains a refusal, that reason is carried with the client-facing error instead of being reduced to an HTTP status. The server does not put request credentials or collaboration content into these logs.

HTTP and WebSocket callers see only collaboration tools allowed by the current request scopes. A token admitted on collaboration scopes alone sees no non-collaboration tools. A stdio client receives a filtered surface when it connects. A missing or disallowed collaboration tool answers as not found rather than exposing a hidden capability.

References: packages/…/mcp-server.ts• L34-43 packages/…/mcp-server.ts• L75-190 packages/…/mcp-server.ts• L193-273 packages/…/error-utils.ts• L28-89 packages/…/register-all-tools.ts• L36-66 packages/…/collaboration-tool.ts• L39-80

Input contracts and API alignment

Shared input contracts define the values that cross the MCP boundary. They give clients stable JSON-safe fields while the tool layer maps those fields to the Gauzy API's names, routes, stored values, and scope rules.

The important contract classes are:

  • Enumerated values for statuses, types, priorities, currencies, and other business states.
  • Generic JSON records for create and update bodies whose final validation belongs to the API.
  • Organization and tenant scope taken from the caller's authenticated context unless a tool explicitly accepts a scope.
  • Paging, relations, date ranges, and search values that the tool surface normalizes for each API route.

Tools convert client-friendly values to the values the API stores. Task state fields, payment methods, and invoice cancellation are examples where the MCP names and API values differ. The tools accept the shared business vocabulary and send the matching stored value to the API.

When an API route cannot apply a search or filter, the tool reads the needed records and applies that filter before it returns a page. This keeps the MCP contract useful without claiming that every API route supports every advertised query.

References: packages/…/input-schemas.ts• L9-107 packages/…/input-schemas.ts• L112-175 packages/…/input-schemas.ts• L228-263 packages/…/tasks.ts• L53-74 packages/…/payments.ts• L65-72 packages/…/invoices.ts• L52-59 packages/…/tool-helper.ts• L39-81 packages/…/utils.ts• L21-114 packages/…/utils.ts• L179-223

Bulk action behavior

Bulk tools provide one request shape for many records. They use a Gauzy bulk action when one exists. Otherwise they apply single-record actions in order and stop at the first failure.

Sequential bulk work can leave earlier records changed when a later record fails. The returned error states which item failed and how many items were already applied, so a caller can decide whether to retry the remainder.

References: packages/…/utils.ts• L117-148 packages/…/utils.apply-in-turn.spec.ts• L18-33 packages/…/tasks.ts• L604-732 packages/…/projects.ts• L418-564 packages/…/daily-plan.ts• L731-854

Tool safety signals

Tool annotations describe the expected effect of a call so an MCP client can decide when to ask the person for approval. They classify reads, normal writes, repeatable writes, destructive changes, repeatable destructive changes, and actions that send data outside the workspace.

These hints guide a client. They do not replace API authorization or enforce a confirmation step. A client should treat a destructive or open-world hint as a reason to review the call before it runs.

References: packages/…/tool-hints.ts• L3-50 packages/…/tool-helper.ts• L45-81 packages/…/chat.ts• L195-223 packages/…/invoices.ts• L403-446

Collaboration data contracts

The collaboration tools keep user content tied to the signed-in user's tenant and organization. Chat results preserve authorship and thread state. Document reads expose a revision so a later write can detect a changed page. Inbox results expose the caller's own read, archive, snooze, and done state.

The docs tools carry page content as Markdown through create, export, search, and update actions. They support long reads in ordered slices and use the page revision to reject stale writes. The server treats message, page, and inbox bodies as user-authored data rather than instructions. It does not log their contents. Chat posts are marked as assisted by the MCP client, and clients that support elicitation can ask the person to approve a post before it is sent.

References: packages/…/collaboration-tool.ts• L10-16 packages/…/collaboration-tool.ts• L39-80 packages/…/chat.ts• L30-46 packages/…/chat.ts• L195-223 packages/…/docs.ts• L90-141 packages/…/docs.ts• L146-237 packages/…/inbox.ts• L44-100

Protocol transports

Transport modes

The server can carry MCP messages over standard input and output, HTTP, or WebSocket. Standard input and output suit a local AI client that launches the server. HTTP and WebSocket support a network service or a managed desktop process.

Automatic mode selects a suitable transport from the run context. An explicit transport setting takes priority.

ModeSystem roleClient connection style
stdioLocal process serviceThe AI client starts the server and exchanges messages through process streams.
httpRequest serviceThe client sends MCP JSON-RPC requests to the HTTP endpoint and can use the event stream for updates.
websocketLong-lived connection serviceThe client keeps a bidirectional connection for requests, responses, and connection events.
autoHost-aware selectionThe server chooses one of the modes from configuration and runtime context.

References: packages/…/transport-factory.ts• L17-77 packages/…/transport-factory.ts• L115-177 packages/…/config.ts• L3-39

MCP request flow

The protocol flow establishes the client and server contract, exposes the current tool surface, and then runs tool calls against the Gauzy API. The same high-level flow applies to HTTP and WebSocket clients.

sequenceDiagram
    participant C as AI client
    participant T as MCP transport
    participant S as Gauzy MCP server
    participant A as Gauzy API
    C->>T: initialize
    T->>S: JSON-RPC request
    S-->>C: protocol and tool capability result
    C->>T: tools/list
    T->>S: JSON-RPC request
    S-->>C: tool names, descriptions, and schemas
    C->>T: tools/call
    T->>S: JSON-RPC request with tool input
    S->>A: Gauzy API action
    A-->>S: Business result
    S-->>C: JSON-RPC result or error

HTTP provides health, protected MCP request, event stream, and optional session routes. WebSocket provides the MCP methods over a live connection with a welcome message and heartbeat. Invalid or unauthorized traffic is rejected before a tool runs.

References: packages/…/http-transport.ts• L332-414 packages/…/http-transport.ts• L824-895 packages/…/websocket-transport.ts• L339-482 packages/…/websocket-transport.ts• L484-677

Protocol and network boundary

Network transports protect the boundary between an external client and Gauzy actions. Bearer-token checks are enabled by default and use the external authentication service's token introspection result. The MCP server validates tokens but does not issue them.

Only a caller on the server machine may omit a token in loopback desktop mode. A local caller that sends a token is still checked. HTTP and WebSocket requests also apply origin, session, request-size, rate, and cross-site protections before a tool runs. This keeps the tool service separate from the authentication and client applications described in MCP authentication and client.

The default required scope is mcp.read. A deployment may set a stricter required-scope list. While that list keeps its default, a token with a named collaboration scope such as chat:read may be admitted for matching collaboration tools only. An operator-defined required-scope list is never weakened by that exception. The server uses the external authorization service for token introspection and checks that the token is active, current, for this server, and tied to a subject.

References: packages/…/auth-types.ts• L26-60 packages/…/auth-types.ts• L101-152 packages/…/authorization-middleware.ts• L35-121 packages/…/local-caller.ts• L3-49 packages/…/http-transport.ts• L83-104 packages/…/websocket-transport.ts• L396-417

Session context

User and tenant context

The session service carries the identity and scope needed by a tool call. A validated session can provide the user, organization, tenant, permissions, and connection details. Tools then act within the caller's Gauzy context instead of using one global context.

The API client attaches the login's tenant to requests when the caller has not already set one. Organization and tenant values also flow into list queries and write bodies where the API needs them. This keeps list results and changes inside the caller's organization while allowing tools with an explicit scope to use the requested organization.

References: packages/…/api-client.ts• L9-25 packages/…/api-client.ts• L52-87 packages/…/session-manager.ts• L35-44 packages/…/http-transport.ts• L711-737 packages/…/utils.ts• L7-37

Session lifecycle

The session manager initializes before a network server starts. It creates and validates sessions, attaches HTTP or WebSocket connections, refreshes an expired login when possible, and removes session login state when the session ends.

Sessions expire and are cleaned up. A session can have several connections, but limits and authorization checks keep the session tied to its user, organization, and tenant. Monitoring exposes session events, alerts, activity, and resource statistics for operational use.

References: packages/…/session-manager.ts• L62-75 packages/…/session-manager.ts• L159-218 packages/…/session-store.ts• L231-275 packages/…/session-store.ts• L402-497 packages/…/session-monitor.ts• L206-240

Authentication context

Authentication state is separate for the process login and keyed caller logins. Stdio uses the process login. HTTP sessions and OAuth subjects use keyed state. A remote caller cannot silently use the server operator's configured auto-login account.

The server can sign in with email and password or with a personal Gauzy API token. GAUZY_API_TOKEN is exchanged for a short-lived access token. It has no refresh token, so the server exchanges the personal token again when that access token expires or an API request returns 401. A refused token ends that login and is not sent again until the server restarts with a new value.

The auto-login account is available without caller credentials only to the local loopback desktop path. A remote caller must log in with its own credentials or present a valid bearer token. Session identifiers are hashed in logs because they act as bearer credentials. Error and request logging also removes access tokens, refresh tokens, personal API tokens, passwords, and other secret values.

References: packages/…/auth-manager.ts• L55-68 packages/…/auth-manager.ts• L183-228 packages/…/auth-manager.ts• L257-325 packages/…/auth-manager.ts• L387-500 packages/…/api-token.ts• L3-76 packages/…/api-client.ts• L104-134 packages/…/error-utils.ts• L11-26 packages/…/error-utils.ts• L116-197

Desktop hosting

Electron server lifecycle

The server-mcp application gives users a graphical way to run the shared MCP server. When Electron is ready, it creates a McpServerManager and starts the server before showing the main window. It stops the service during application shutdown. The package builds a distributable product with a command entry point and platform targets.

flowchart TD
    Ready[Electron ready] --> Start[Start McpServerManager]
    Start --> Status[Record transport and server status]
    Status --> Window[Show desktop window]
    Window --> Control[Start, stop, or restart controls]
    Control --> Status
    Quit[Application quit] --> Stop[Stop MCP server]

The manager reports whether the service is running, its transport, its URL or pipe mode, its version, uptime, and the last start error. The window still opens when startup fails, so the user can see the error and try a restart.

References: apps/…/electron-main.ts• L91-139 apps/…/electron-main.ts• L181-185 packages/…/mcp-server-manager.ts• L72-184 apps/…/package.json• L21-33 apps/…/package.json• L75-117

Renderer and main-process boundary

The desktop window does not receive direct access to Node.js or the full Electron IPC object. The preload layer exposes a small API for status, restart, readiness, version, theme, and window actions. The main process owns the server manager and IPC handlers.

This boundary keeps server control in the trusted Electron side. It gives the renderer only the operations needed for the management experience. Status updates can move from the main process to the window as events.

References: apps/…/electron-main.ts• L259-293 apps/…/electron-main.ts• L391-535 apps/…/preload.ts• L58-101

Examples and deployment paths

Client examples

The package examples show how an engineer can check a live server without building a full AI client. The WebSocket example checks connection, heartbeat, initialization, tool discovery, and protocol errors. The token example supports local checks for token validity and scope.

These examples are for development and diagnosis. Production clients must use the deployment's configured authentication service and transport settings.

References: packages/…/websocket-client-example.js• L1-13 packages/…/websocket-client-example.js• L155-202 packages/…/generate-test-token.js• L1-34 packages/…/generate-test-token.js• L91-142

Runtime configuration

The server needs a Gauzy API base URL. It can sign in at startup with email and password or with a personal API token. The host then selects the transport and network settings, including allowed origins, trusted proxies, authorization, and session behavior.

GAUZY_API_TOKEN takes precedence over configured email and password for the process auto-login. Its value is checked at startup, and it is never placed in a tool answer, status value, or log. Collaboration groups are enabled separately with GAUZY_MCP_TOOLS_CHAT, GAUZY_MCP_TOOLS_DOCS, and GAUZY_MCP_TOOLS_INBOX; each switch must be exactly true.

The API connection tells tools where to act. Transport and authorization settings tell clients how to reach the MCP server and how the server must check them. Network deployments must set production origins and transport values explicitly. See domain services and contracts for the Gauzy API boundary behind these tool calls.

References: packages/…/ienvironment.ts• L1-18 packages/…/environment.ts• L32-99 packages/…/environment.prod.ts• L29-64 packages/…/config.ts• L41-142 packages/…/README.md• L481-521

Desktop and server deployment

The desktop build packages server-mcp as a named Electron product. Its packaged application uses the shared MCP package and platform targets so local users can install a host without changing the tool contract. A hosted deployment runs the shared MCP service as a network workload with HTTP and WebSocket entry points.

This gives the product two deployment paths without changing the tool contract: a user-managed desktop host for local AI clients and a centrally managed server for clients that can reach the Gauzy environment. Hosted clients must use bearer tokens from the external authentication service unless the deployment explicitly disables bearer checks.

References: .scripts/…/server-mcp-packager.ts• L5-17 .deploy/…/k8s-manifest.mcp.stage.yaml• L1-18 .deploy/…/k8s-manifest.mcp.stage.yaml• L129-163 apps/…/project.json• L4-31 apps/…/package.json• L25-117

Change checklist

When these files or sections are changed, remember to consider these:

  • When a tool is added or renamed, update the shared registration path and discovery metadata so the callable surface and its categories do not drift.
  • When a tool input or enum changes, keep the MCP schema, API value mapping, route shape, and JSON Schema discovery result aligned.
  • When a business value has different MCP and API names, keep the read filters, single-record writes, bulk writes, and API-stored value mapping aligned.
  • When a list route, search rule, page rule, or count route changes, check whether the tool filters locally or delegates to the API.
  • When a sequential bulk action changes, preserve its stop point and the count of changes already applied.
  • When organization or tenant handling changes, keep request headers, query scope, write bodies, and explicit-scope tools aligned.
  • When a collaboration group or tool changes, keep its enable switch, read/write scope map, registration, request filter, and stdio filtering aligned.
  • When tool effect hints change, keep the annotation and the actual API effect aligned. Hints guide clients but do not enforce access.
  • When a personal API token changes, keep startup shape checks, exchange errors, renewal after 401, refusal handling, and secret redaction aligned.
  • When authentication state changes, check process login, keyed caller login, local loopback rules, API client retries, and tenant propagation together.
  • When collaboration content or logging changes, preserve the rule that message, page, and inbox bodies are not logged and are labeled as user-authored data.
  • When the manager status shape changes, update the Electron IPC handler, preload API, and renderer event contract as one boundary.
  • When hosted ports, origins, trusted proxies, or TLS routes change, update runtime configuration and deployment routing together.
  • When the shared package entry point or desktop package entry changes, keep the runtime dependency, library build output, and packaged application metadata aligned.

Important failure modes

TriggerConsequenceGuard
A tool is exported but not included in the shared registration path.The tool is absent from production discovery and calls.Keep tool exports, registration, and discovery checks aligned.
A tool schema uses a client value that the API does not store.A filter matches no records or a write fails.Keep enum schemas and API value mappings together.
A write tool sends a business label instead of the value stored by the Gauzy API.The API refuses the write or creates a record that later filters cannot find.Map shared values before reads, single writes, and bulk writes.
A list tool assumes the API applies a search or filter that it does not support.Results are incomplete or unrelated records appear.Use the tool's route-aware local filtering and paging rules.
A sequential bulk call fails after earlier calls succeed.The operation is partly applied and a blind retry may repeat changes.Report the failed item and applied count, then retry only the needed records.
A request loses its tenant or organization context.The API refuses the call or returns the wrong tenant's data.Keep auth-derived headers, query scope, and write scope aligned.
A personal API token is malformed, refused, or disabled on the Gauzy API.Startup or auto-login fails and tools cannot act for the process user.Use the expected gzp_ token shape and read the exchange error before replacing the setting.
A personal API token access token expires and renewal is not attempted.Later API calls return 401 even though the configured personal token is still valid.Exchange GAUZY_API_TOKEN again on expiry or the first non-auth 401.
A refused personal API token is retried in a loop.The server sends a known-invalid secret repeatedly.Stop retrying a refused token until restart with a new value.
A collaboration group is enabled without matching scope registration or request filtering.A caller can see a tool it cannot use, or a permitted tool is missing.Keep group switches, scope maps, registration, and transport filters aligned.
A token has only mcp.read but the caller expects collaboration writes.Read tools are listed, but write tools are absent or not found.Use the group's write scope or mcp.write/mcp.admin.
A remote caller sends no token.The request or WebSocket connection is rejected.Use a valid bearer token or use the local loopback desktop path.
A session identifier or secret appears in a log.Logs expose a credential or private data.Hash session identifiers and sanitize tokens, passwords, and content before logging.
A collaboration page update uses an old revision.The write is refused or reports a content conflict.Read the current page and apply the change with its current revision.
A chat client sends user-authored text as an instruction to the AI client.The client can follow untrusted content as if it were a command.Treat returned message, page, and inbox bodies as data, not instructions.
The desktop server fails before startup completes.The app opens without a usable MCP service.Show the recorded error and expose restart through the Electron boundary.
Hosted transport settings and deployment routes disagree.Clients reach the workload but cannot establish the selected transport.Keep ports, paths, origins, proxies, and ingress rules aligned.

Key files

FileWhy to read it
packages/…/README.mdStates the package purpose, consumer applications, capability groups, collaboration model, and personal API token path.
packages/…/mcp-server.tsDefines the shared server, tool discovery, input validation, tool invocation, and startup flow.
packages/…/register-all-tools.tsShows the single registration path for the business and collaboration tool surface.
packages/…/tool-helper.tsShows the common tool registration contract and runtime schema validation boundary.
packages/…/tool-hints.tsDefines the safety signals that clients use to understand likely tool effects.
packages/…/input-schemas.tsDefines shared enum values and the JSON-safe input contracts used by the tool surface.
packages/…/utils.tsShows organization scope, API value mapping, paging, local filtering, sequential bulk behavior, and unavailable-action behavior.
packages/…/timer.tsIllustrates authenticated time tracking with status, start, and stop capabilities.
packages/…/tasks.tsIllustrates a core work domain with search, paging, bulk actions, statistics, and assignment.
packages/…/chat.tsIllustrates scoped chat reads, assisted message posts, and client approval.
packages/…/docs.tsIllustrates page reads, Markdown slices, revision checks, and conflict-aware writes.
packages/…/inbox.tsIllustrates caller-owned inbox reads and state changes.
packages/…/api-client.tsShows auth headers, tenant propagation, token renewal after 401, and API access.
packages/…/api-token.tsDefines personal API token shape, exchange route, and user-facing failure states.
packages/…/auth-manager.tsDefines process and caller login state, auto-login, password refresh, and personal token renewal.
packages/…/error-utils.tsDefines API refusal reasons, secret redaction, and safe session identifiers for logs.
packages/…/environment.tsDefines development environment validation and startup authentication selection.
packages/…/environment.prod.tsDefines production environment validation and production defaults.
packages/…/config.tsExplains transport, origin, session, proxy, and network configuration.
packages/…/transport-factory.tsExplains transport selection across local and network hosts.
packages/…/http-transport.tsShows HTTP routes, authorization, session context, collaboration filtering, and MCP request routing.
packages/…/websocket-transport.tsShows live connection checks, token rechecks, heartbeat, and message routing.
packages/…/session-manager.tsDefines session identity, context, and authentication checks.
apps/…/electron-main.tsShows how the desktop host starts, monitors, controls, and stops the shared server.
apps/…/preload.tsShows the narrow renderer-to-main process control surface.
apps/…/package.jsonDefines the packaged desktop product and shared server dependency.
packages/…/websocket-client-example.jsProvides a small client path for checking connection and protocol behavior.
.deploy/…/k8s-manifest.mcp.stage.yamlShows the hosted service and public routing for network deployment.