# crewaiinc/enterprise-mcp-server architecture

> Architecture diagram of the GitHub repository crewaiinc/enterprise-mcp-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/crewaiinc/enterprise-mcp-server
- Repository: https://github.com/crewaiinc/enterprise-mcp-server

## Overview

##### Project type and purpose
- This is a small Python-based MCP (Model Context Protocol) server implementation. It acts as an adapter or gateway layer (“microservice”) that exposes two endpoints—kickoff_crew and get_crew_status—to any MCP-capable client (e.g., Claude Desktop) and forwards requests to the CrewAI Enterprise API.

##### File structure
- Top-level files:
- crewai_enterprise_server.py → the single entry-point defining the MCP handlers and HTTP server
- pyproject.toml, uv.lock → package and dependency definitions (uses mcp[cli], uvicorn)
- assets/ → screenshots only, no runtime code
- README.md → usage, env-vars, architecture hints
- No database or multiple services—this is one process, launched via the mcp CLI/uvicorn.

##### README for additional insights
- Exposes two MCP tool commands: kickoff_crew, get_crew_status
- Relies on two environment variables pointing at app.crewai.com (URL + token)
- Integrates with Claude Desktop by registering this server under Developer Settings

##### Main components and their interactions
a. Claude Desktop (MCP client)
b. mcp CLI + uvicorn runner
c. CrewAI Enterprise MCP Server (crewai_enterprise_server.py)
- Endpoint: POST /kickoff_crew
- Endpoint: GET /get_crew_status
- Uses the mcp Python library to implement the protocol
d. External CrewAI Enterprise API (app.crewai.com)
- Invoked by the MCP server using the bearer token

Data flows:
1) User triggers a tool in Claude Desktop →
2) Claude sends an MCP-formatted HTTP request to localhost (mcp server) →
3) The server handler parses the request, uses the stored URL/Token →
4) It issues an HTTP call to the external CrewAI API →
5) Receives the response, wraps it in MCP response format →
6) Sends back to Claude Desktop

##### Architectural patterns and design principles
- Microservice/Adapter pattern: single-responsibility for MCP protocol translation
- Layer separation:
- Transport layer (uvicorn HTTP server)
- Protocol layer (mcp library handlers)
- Integration layer (HTTP client to external API)
- Configuration by environment (URL + token), no hard-coded secrets

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    ClaudeDesktop["Claude Desktop (MCP Client)"]:::client

    %% Bootstrapper
    MCPRunner["mcp CLI + Uvicorn Runner"]:::service

    %% Application Layer
    subgraph "CrewAI Enterprise MCP Server (Application)"
        Transport["Transport: Uvicorn HTTP Server"]:::service
        ProtocolHandlers["Protocol Handlers: kickoff_crew, get_crew_status"]:::service
        IntegrationClient["Integration Client: HTTP calls (env vars)"]:::service
    end

    %% External Dependency
    ExternalAPI["CrewAI External API\napp.crewai.com"]:::external

    %% Project Files
    subgraph "Project Files"
        FileServer["crewai_enterprise_server.py"] 
        FileConfig["pyproject.toml"]
        FileReadme["README.md"]
        FileAssets["assets/"]
        FileLock["uv.lock"]
    end

    %% Data Flows
    ClaudeDesktop -->|"1: MCP request\nPOST /kickoff_crew or GET /get_crew_status"| Transport
    Transport -->|"2: route to handler"| ProtocolHandlers
    ProtocolHandlers -->|"3: Bearer-token auth"| IntegrationClient
    IntegrationClient -->|"4: HTTP call"| ExternalAPI
    ExternalAPI -->|"response"| IntegrationClient
    IntegrationClient -->|"5: wrap MCP response"| ProtocolHandlers
    ProtocolHandlers -->|"6: MCP response"| Transport
    Transport -->|"7: return to client"| ClaudeDesktop

    %% Click Events
    click Transport "https://github.com/crewaiinc/enterprise-mcp-server/blob/main/pyproject.toml"
    click ProtocolHandlers "https://github.com/crewaiinc/enterprise-mcp-server/blob/main/crewai_enterprise_server.py"
    click IntegrationClient "https://github.com/crewaiinc/enterprise-mcp-server/blob/main/crewai_enterprise_server.py"
    click FileServer "https://github.com/crewaiinc/enterprise-mcp-server/blob/main/crewai_enterprise_server.py"
    click FileConfig "https://github.com/crewaiinc/enterprise-mcp-server/blob/main/pyproject.toml"
    click FileReadme "https://github.com/crewaiinc/enterprise-mcp-server/blob/main/README.md"
    click FileAssets "https://github.com/crewaiinc/enterprise-mcp-server/tree/main/assets/"
    click FileLock "https://github.com/crewaiinc/enterprise-mcp-server/blob/main/uv.lock"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef service fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px;
```
