# auchenberg/claude-code-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/auchenberg/claude-code-mcp
- Repository: https://github.com/auchenberg/claude-code-mcp

## Overview

##### Project Identification
- The project is a Node.js/TypeScript-based server implementation that adapts Anthropic’s Claude Code into a Model Context Protocol (MCP) server.
- Its purpose is to expose a series of developer tools (for file operations, shell commands, code analysis, etc.) and prompts as standardized MCP components, enabling integration with any MCP client.

##### Key Components
a. Core Server:
- Entry Point (src/index.ts): Starts the application and bootstraps the MCP server.
- MCP Server Setup (src/server/claude-code-server.ts): Main server configuration that registers tools, prompts, and resources.

b. Modules:
- Tools Module (src/server/tools.ts): Contains logic for registering and implementing various executable tools (e.g., bash, readFile, listFiles, searchGlob, grep, think, codeReview, editFile).
- Prompts Module (src/server/prompts.ts): Defines the MCP prompts for general CLI interactions, code review, PR review, and initializing documentation.
- Resources Module (src/server/resources.ts): Implements access to external resources like file system contents, directory listings, and environment variables.

c. Utilities:
- Utility functions (src/utils/bash.ts and src/utils/file.ts): Provide support for executing shell commands and file system operations that the tools and resources rely on.

d. External Interaction:
- MCP Clients (as exemplified in the README’s client code samples and test files like test-client.js, test-client.mjs, etc.): Represent how external systems communicate with the MCP server.
- Dependencies and SDK Integration: Note that the server uses the MCP SDK to register tools and resources. Although not depicted as individual files, it’s important to mark that its behavior is governed by the MCP architectural standards.

##### Relationships and Interactions
- Tools: Show that the server registers each tool found in tools.ts.
- Prompts: The prompts defined in prompts.ts are also registered on the server.
- Resources: The resources from resources.ts are set up for external data retrieval.
- Of these modules to the utility layer (bash.ts and file.ts) that supports their operations.

##### Architectural Patterns and Design Principles
- Modularity: Each distinct functionality (tools, prompts, resources, utilities) resides in its own module.
- Type Safety: The project is written in TypeScript, ensuring strict typing across components.
- Error Handling and Security: Emphasize that tools like bash have built-in security restrictions and the application is designed to perform robust error handling.
- Standardized Interface: The system conforms to the MCP standard, making it readily interoperable with other MCP clients.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Core Server
    subgraph "Core Server"
        EP["Entry Point"] 
        MSS["MCP Server Setup"]
    end

    %% Modules
    subgraph "Modules"
        T["Tools Module"]
        P["Prompts Module"]
        R["Resources Module"]
    end

    %% Utilities
    subgraph "Utilities"
        B["Bash Utility"]
        F["File Utility"]
    end

    %% External Clients
    subgraph "External Clients"
        C1["Client SDK"]
        C2["Client Simple"]
        C3["Client JS"]
        C4["Client MJS"]
    end

    %% Connections from Core Server to Modules
    EP -->|"bootstrap"| MSS
    MSS -->|"registers_tools"| T
    MSS -->|"registers_prompts"| P
    MSS -->|"registers_resources"| R

    %% Module to Utilities connections
    T -->|"executes_shell"| B
    T -->|"performs_file_ops"| F
    P -->|"uses_file_utils"| F
    R -->|"fetches_file_data"| F

    %% External Clients communication with Server (bidirectional)
    C1 -->|"request"| MSS
    MSS -->|"response"| C1
    C2 -->|"request"| MSS
    MSS -->|"response"| C2
    C3 -->|"request"| MSS
    MSS -->|"response"| C3
    C4 -->|"request"| MSS
    MSS -->|"response"| C4

    %% Class definitions for color styling
    classDef core fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef modules fill:#90EE90,stroke:#006400,stroke-width:2px;
    classDef utilities fill:#FFDAB9,stroke:#FF8C00,stroke-width:2px;
    classDef clients fill:#D8BFD8,stroke:#9400D3,stroke-width:2px;

    class EP,MSS core;
    class T,P,R modules;
    class B,F utilities;
    class C1,C2,C3,C4 clients;

    %% Click Events
    click EP "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/src/index.ts"
    click MSS "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/src/server/claude-code-server.ts"
    click T "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/src/server/tools.ts"
    click P "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/src/server/prompts.ts"
    click R "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/src/server/resources.ts"
    click B "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/src/utils/bash.ts"
    click F "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/src/utils/file.ts"
    click C1 "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/test-client-sdk.mjs"
    click C2 "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/test-client-simple.mjs"
    click C3 "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/test-client.js"
    click C4 "https://github.com/auchenberg/claude-code-mcp/blob/devin/1741367190-claude-code-mcp-setup/test-client.mjs"
```
