# teddynote-lab/mcp-usecase architecture

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

- Interactive diagram: https://gitdiagram.com/teddynote-lab/mcp-usecase
- Repository: https://github.com/teddynote-lab/mcp-usecase

## Overview

##### Project Type and Purpose
- This project is a specialized utility designed to help users integrate Anthropic's Model Context Protocol (MCP) into Claude Desktop and Cursor. It automates the creation of JSON configuration files required by these applications.
- The tool also comes with several “case” examples demonstrating related functionality. For example, case1 illustrates Retrieval Augmented Generation (RAG) for PDF documents, whereas case2, case3, and case4 include examples for integrating with external knowledge APIs, workflows, and web searches.

##### Analysis of the File Structure
- Top-level directories:
- Four “case” directories (case1, case2, case3, case4), each corresponding to a different example or use-case scenario.
- A “data” directory for the PDF files needed (especially in the RAG example).
- A “docs” folder that contains markdown files describing each case and an installation guide.
- Other files:
- .env.example for environment settings.
- Configuration files like pyproject.toml, and various requirements files indicate that the project is Python-based and has defined dependencies.
- Within each case directory, you typically see:
- auto_mcp_json.py – the Python script to generate the MCP JSON configuration.
- mcp_server.py – the server script that launches when Claude Desktop or Cursor starts.
- Additional specialized scripts (e.g., dify_ek_server.py in case2) or modules (like the “rag” package in case1 that contains base and pdf handling code) that handle specific functionalities.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Case 1: RAG Module
    subgraph "Case1: RAG Module"
        case1_json["auto_mcp_json.py"]:::internal
        case1_mcp["mcp_server.py"]:::internal
        case1_rag["RAG Module (rag package)"]:::internal
        case1_json -->|"generates_config"| case1_mcp
        case1_mcp -->|"integrates_RAG"| case1_rag
    end

    %% Case 2: Dify External Knowledge API Integration
    subgraph "Case2: Dify External Knowledge"
        case2_json["auto_mcp_json.py"]:::internal
        case2_mcp["mcp_server.py"]:::internal
        case2_dify["Dify EK (dify_ek_server.py)"]:::internal
        case2_json -->|"generates_config"| case2_mcp
        case2_mcp -->|"integrates_Dify_EK"| case2_dify
    end

    %% Case 3: Dify Workflow
    subgraph "Case3: Dify Workflow"
        case3_json["auto_mcp_json.py"]:::internal
        case3_mcp["mcp_server.py"]:::internal
        case3_workflow["Workflow Module"]:::internal
        case3_json -->|"generates_config"| case3_mcp
        case3_mcp -->|"executes_workflow"| case3_workflow
    end

    %% Case 4: Web Search
    subgraph "Case4: Web Search"
        case4_json["auto_mcp_json.py"]:::internal
        case4_mcp["mcp_server.py"]:::internal
        case4_web["Web Search Module"]:::internal
        case4_json -->|"generates_config"| case4_mcp
        case4_mcp -->|"executes_web_search"| case4_web
    end

    %% Data Store for PDFs (used in RAG functionality)
    DataStore["Data Store: PDF files"]:::internal
    case1_rag -->|"reads_PDFs"| DataStore

    %% External Services
    subgraph "External Services"
        anthropic["Anthropic MCP"]:::external
        dify["Dify API"]:::external
        tavily["Tavily API"]:::external
    end
    case1_mcp -->|"calls_MCP"| anthropic
    case2_mcp -->|"calls_MCP"| anthropic
    case3_mcp -->|"calls_MCP"| anthropic
    case4_mcp -->|"calls_MCP"| anthropic
    case2_dify -->|"calls_Dify"| dify
    case3_workflow -->|"calls_Dify"| dify
    case4_web -->|"calls_Tavily"| tavily

    %% Configuration Files
    subgraph "Configuration"
        config_env[".env.example"]:::config
        config_py["pyproject.toml"]:::config
        config_req["requirements.txt"]:::config
        config_req_win["requirements_windows.txt"]:::config
    end

    %% Documentation
    subgraph "Documentation"
        docs1["case1.md"]:::docs
        docs2["case2.md"]:::docs
        docs3["case3.md"]:::docs
        docs4["case4.md"]:::docs
        docs_install["installation.md"]:::docs
    end

    %% Class Definitions for Styling
    classDef internal fill:#ccf,stroke:#333,stroke-width:2px;
    classDef external fill:#fdd,stroke:#333,stroke-width:2px;
    classDef config fill:#dfd,stroke:#333,stroke-width:2px;
    classDef docs fill:#ffd,stroke:#333,stroke-width:2px;

    %% Click Events for Component Mapping
    click case1_json "https://github.com/teddynote-lab/mcp-usecase/blob/main/case1/auto_mcp_json.py"
    click case1_mcp "https://github.com/teddynote-lab/mcp-usecase/blob/main/case1/mcp_server.py"
    click case1_rag "https://github.com/teddynote-lab/mcp-usecase/tree/main/case1/rag"
    click case2_json "https://github.com/teddynote-lab/mcp-usecase/blob/main/case2/auto_mcp_json.py"
    click case2_mcp "https://github.com/teddynote-lab/mcp-usecase/blob/main/case2/mcp_server.py"
    click case2_dify "https://github.com/teddynote-lab/mcp-usecase/blob/main/case2/dify_ek_server.py"
    click case3_json "https://github.com/teddynote-lab/mcp-usecase/blob/main/case3/auto_mcp_json.py"
    click case3_mcp "https://github.com/teddynote-lab/mcp-usecase/blob/main/case3/mcp_server.py"
    click case4_json "https://github.com/teddynote-lab/mcp-usecase/blob/main/case4/auto_mcp_json.py"
    click case4_mcp "https://github.com/teddynote-lab/mcp-usecase/blob/main/case4/mcp_server.py"
    click config_env "https://github.com/teddynote-lab/mcp-usecase/blob/main/.env.example"
    click config_py "https://github.com/teddynote-lab/mcp-usecase/blob/main/pyproject.toml"
    click config_req "https://github.com/teddynote-lab/mcp-usecase/blob/main/requirements.txt"
    click config_req_win "https://github.com/teddynote-lab/mcp-usecase/blob/main/requirements_windows.txt"
    click docs1 "https://github.com/teddynote-lab/mcp-usecase/blob/main/docs/case1.md"
    click docs2 "https://github.com/teddynote-lab/mcp-usecase/blob/main/docs/case2.md"
    click docs3 "https://github.com/teddynote-lab/mcp-usecase/blob/main/docs/case3.md"
    click docs4 "https://github.com/teddynote-lab/mcp-usecase/blob/main/docs/case4.md"
    click docs_install "https://github.com/teddynote-lab/mcp-usecase/blob/main/docs/installation.md"
    click DataStore "https://github.com/teddynote-lab/mcp-usecase/tree/main/data"
```
