# e2b-dev/mcp-server architecture

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

- Interactive diagram: https://gitdiagram.com/e2b-dev/mcp-server
- Repository: https://github.com/e2b-dev/mcp-server

## Overview

##### Main Components
- E2B MCP Server: Represent the overall server component that handles code interpretation for the Claude Desktop app.
- Editions/Subsystems:
- JavaScript Edition (located in packages/js): Include its source directory (src/index.ts) and associated configuration (package.json, tsconfig.json).
- Python Edition (located in packages/python): Emphasize the core server logic in packages/python/src/e2b_mcp_server (server.py and __init__.py) along with build/config files (pyproject.toml, version management files).
- Build & Deployment:
- Docker: Include the Dockerfile indicating containerization.
- CI/CD Pipelines: Represent GitHub workflows (release.yml, publish_packages.yml) and related scripts in .github, which automate testing, building, and releasing via services like Smithery.
- Package Management & Tooling: Show nodes for overall package managers (npm, pnpm, changeset) and configuration files (.npmrc, pnpm-workspace.yaml, smithery.yaml).

##### Relationships and Interactions
- Out interactions where the build scripts and Docker containerization eventually deploy or integrate the server into the Claude Desktop app.
- How Smithery acts as an installation/delivery mechanism by showing the deployment pipeline feeding into the end-user environment.

##### Architectural Patterns and Design Principles
- CI/CD Integration: Stress the importance of automated release workflows and deployment using GitHub Actions and Docker.
- Language-Specific Design: While both editions serve the same purpose, they are implemented in different languages. This emphasizes the requirement for well-defined interfaces (or APIs) that can be modularly swapped or individually enhanced.
- Containerization: Use Docker as the deployment mechanism to ensure the server is packaged consistently across environments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Server
    A["E2B MCP Server"]:::server

    %% Editions Subgraph
    subgraph "Editions"
        JS["packages/js: JavaScript Edition"]:::js
        JS_SRC["packages/js/src/index.ts"]:::jsFile
        JS_PKG["package.json"]:::jsCfg
        JS_TS["tsconfig.json"]:::jsCfg

        PY["packages/python: Python Edition"]:::python
        PY_SERVER["server.py (core logic)"]:::pythonFile
        PY_INIT["__init__.py"]:::pythonFile
        PY_PYPROJECT["pyproject.toml"]:::pythonCfg
    end

    %% CI/CD Pipeline Subgraph
    subgraph "CI/CD Pipeline"
        CI["GitHub Workflows & CI Scripts"]:::ci
        CI_RELEASE["release.yml"]:::ciFile
        CI_PUBLISH["publish_packages.yml"]:::ciFile
        CI_SCRIPT["is_release.sh"]:::ciFile
    end

    %% Deployment Environment Subgraph
    subgraph "Deployment Environment"
        DOCK["Dockerized Environment"]:::docker
        SMITHERY["Smithery Deployment"]:::depl
        CLAUDE["Claude Desktop App Integration"]:::app
    end

    %% Package Management & Tooling Subgraph
    subgraph "Package Management & Tooling"
        NPM["npm (.npmrc)"]:::pkg
        PNPM["pnpm (pnpm-workspace.yaml)"]:::pkg
        PNPM_LOCK["pnpm-lock.yaml"]:::pkg
        CHANGE["Changeset (.changeset)"]:::pkg
        SMITHERY_CFG["smithery.yaml"]:::pkg
    end

    %% Relationships
    A -->|"contains"| JS
    A -->|"contains"| PY

    %% JavaScript Edition Details
    JS -->|"has source"| JS_SRC
    JS -->|"config"| JS_PKG
    JS -->|"config"| JS_TS

    %% Python Edition Details
    PY -->|"has logic"| PY_SERVER
    PY -->|"has init"| PY_INIT
    PY -->|"build config"| PY_PYPROJECT

    %% Triggering CI/CD Pipeline from Editions
    JS -->|"triggers"| CI
    PY -->|"triggers"| CI

    CI -->|"runs"| CI_RELEASE
    CI -->|"runs"| CI_PUBLISH
    CI -->|"executes"| CI_SCRIPT

    %% CI/CD leads to Deployment
    CI -->|"builds"| DOCK
    DOCK -->|"deploys to"| SMITHERY
    SMITHERY -->|"integrates with"| CLAUDE

    %% Core Server Package Management Linkages
    A -->|"defined by"| NPM
    A -->|"defined by"| PNPM
    A -->|"defined by"| PNPM_LOCK
    A -->|"defined by"| CHANGE
    A -->|"configured by"| SMITHERY_CFG

    %% Styles
    classDef server fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef js fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef jsFile fill:#99ccff,stroke:#333,stroke-width:1px;
    classDef jsCfg fill:#99ccff,stroke:#333,stroke-width:1px;
    classDef python fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef pythonFile fill:#99ff99,stroke:#333,stroke-width:1px;
    classDef pythonCfg fill:#99ff99,stroke:#333,stroke-width:1px;
    classDef ci fill:#fff2cc,stroke:#333,stroke-width:2px;
    classDef ciFile fill:#ffeb99,stroke:#333,stroke-width:1px;
    classDef docker fill:#ffe6cc,stroke:#333,stroke-width:2px;
    classDef depl fill:#ffddcc,stroke:#333,stroke-width:2px;
    classDef app fill:#e6ccff,stroke:#333,stroke-width:2px;
    classDef pkg fill:#e6e6fa,stroke:#333,stroke-width:2px;

    %% Click Events for Core Components
    click A "https://github.com/e2b-dev/mcp-server/blob/main/."
    
    click JS "https://github.com/e2b-dev/mcp-server/tree/main/packages/js"
    click JS_SRC "https://github.com/e2b-dev/mcp-server/blob/main/packages/js/src/index.ts"
    click JS_PKG "https://github.com/e2b-dev/mcp-server/blob/main/packages/js/package.json"
    click JS_TS "https://github.com/e2b-dev/mcp-server/blob/main/packages/js/tsconfig.json"

    click PY "https://github.com/e2b-dev/mcp-server/tree/main/packages/python"
    click PY_SERVER "https://github.com/e2b-dev/mcp-server/blob/main/packages/python/src/e2b_mcp_server/server.py"
    click PY_INIT "https://github.com/e2b-dev/mcp-server/blob/main/packages/python/src/e2b_mcp_server/__init__.py"
    click PY_PYPROJECT "https://github.com/e2b-dev/mcp-server/blob/main/packages/python/pyproject.toml"

    click DOCK "https://github.com/e2b-dev/mcp-server/tree/main/Dockerfile"
    
    click CI_RELEASE "https://github.com/e2b-dev/mcp-server/blob/main/.github/workflows/release.yml"
    click CI_PUBLISH "https://github.com/e2b-dev/mcp-server/blob/main/.github/workflows/publish_packages.yml"
    click CI_SCRIPT "https://github.com/e2b-dev/mcp-server/blob/main/.github/scripts/is_release.sh"
    
    click NPM "https://github.com/e2b-dev/mcp-server/blob/main/.npmrc"
    click PNPM "https://github.com/e2b-dev/mcp-server/blob/main/pnpm-workspace.yaml"
    click PNPM_LOCK "https://github.com/e2b-dev/mcp-server/blob/main/pnpm-lock.yaml"
    click CHANGE "https://github.com/e2b-dev/mcp-server/blob/main/.changeset"
    click SMITHERY_CFG "https://github.com/e2b-dev/mcp-server/blob/main/smithery.yaml"
```
