# archimedescrypto/fusion360-mcp-server architecture

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

- Interactive diagram: https://gitdiagram.com/archimedescrypto/fusion360-mcp-server
- Repository: https://github.com/archimedescrypto/fusion360-mcp-server

## Overview

##### Project type and purpose
- This is a Python-based microservice (FastAPI) that acts as a Model Context Protocol (MCP) server for Autodesk Fusion 360.
- It exposes a small HTTP API and an MCP (stdin/stdout) interface so that an LLM-driven client (Cline) can issue high-level tool calls, receive back generated Fusion 360 Python scripts, and execute them in Fusion.

##### File structure
- Top level
– setup_mcp.py: CLI entry point for MCP mode
– requirements.txt / setup_mcp.py / LICENSE / README.md / .gitignore
- src/
– main.py: HTTP + MCP server entrypoint (FastAPI app)
– script_generator.py: logic to turn tool calls into Fusion 360 Python script text
– tool_registry.json: JSON-driven definition of all supported tools
- tools/
– add_tool.py, update_mcp_settings.py, loft_profiles_template.py, example_tool.json
– Helpers to manage and extend the registry
- examples/ & tests/
– examples/ show how to call the API or integrate via MCP
– tests/ validate the HTTP endpoints and core logic

##### README for additional insights
- Describes two modes: HTTP server (GET /, GET /tools, POST /call_tool(s)) and MCP mode (stdin/stdout)
- Lists supported tools, how new tools get registered, and how the script generator maps calls to Fusion API calls
- Emphasizes extensibility via tool_registry.json and script_generator.py

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients Layer
    subgraph "Clients" 
        direction TB
        Cline["Cline LLM Client"]:::clients
        Curl["curl/CLI Examples"]:::clients
        Examples["Client Usage Examples\nexamples/"]:::clients
    end

    %% Gateway Layer
    subgraph "Ingress Gateway"
        direction TB
        API["HTTP API Layer\nsrc/main.py"]:::gateway
        MCP["MCP Mode Entrypoint\nsetup_mcp.py"]:::gateway
    end

    %% Core Logic Layer
    subgraph "Core Logic"
        direction TB
        RegistryConfig["Tool Registry Configuration\nsrc/tool_registry.json"]:::core
        RegistryHelpers["Registry Helpers\ntools/add_tool.py\n tools/update_mcp_settings.py"]:::core
        ScriptGen["Script Generator\nsrc/script_generator.py"]:::core
    end

    %% Extensions Layer
    subgraph "Tool Templates and Definitions"
        direction TB
        Templates["Template: loft_profiles_template.py\ntools/loft_profiles_template.py"]:::core
        ExampleTool["Tool Definition: example_tool.json\ntools/example_tool.json"]:::core
    end

    %% External Execution
    Fusion["Autodesk Fusion 360\n(Executes Python Script)"]:::external

    %% Demo and Support Files
    subgraph "Utilities & Metadata"
        direction TB
        Demo["Demo Script Generator\nbox.py"]:::config
        Tests["Automated Tests\ntests/test_server.py"]:::config
        Requirements["requirements.txt"]:::config
        Metadata["Project Metadata\nREADME.md\nLICENSE\n.gitignore"]:::config
    end

    %% Connections
    Cline -->|HTTP Request| API
    Curl -->|HTTP Request| API
    Cline -->|stdin/stdout| MCP
    Curl -->|stdin/stdout| MCP

    API -->|loads| RegistryConfig
    MCP -->|loads| RegistryConfig
    RegistryConfig -->|uses| RegistryHelpers
    RegistryHelpers -->|provides definitions| ScriptGen
    ScriptGen -->|utilizes| Templates
    ScriptGen -->|reads| ExampleTool
    ScriptGen -->|returns script| Cline
    ScriptGen -->|returns script| Curl
    ScriptGen -->|returns script| Fusion
    Cline -->|forwards script| Fusion
    Curl -->|forwards script| Fusion

    Demo -->|example| Cline
    Tests -->|validate| API
    Tests -->|validate| ScriptGen

    %% Click Events
    click API "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/src/main.py"
    click MCP "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/setup_mcp.py"
    click ScriptGen "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/src/script_generator.py"
    click RegistryConfig "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/src/tool_registry.json"
    click RegistryHelpers "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/tools/add_tool.py"
    click RegistryHelpers "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/tools/update_mcp_settings.py"
    click Templates "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/tools/loft_profiles_template.py"
    click ExampleTool "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/tools/example_tool.json"
    click Demo "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/box.py"
    click Examples "https://github.com/archimedescrypto/fusion360-mcp-server/tree/master/examples/"
    click Tests "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/tests/test_server.py"
    click Requirements "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/requirements.txt"
    click Metadata "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/README.md"
    click Metadata "https://github.com/archimedescrypto/fusion360-mcp-server/tree/master/LICENSE"
    click Metadata "https://github.com/archimedescrypto/fusion360-mcp-server/blob/master/.gitignore"

    %% Styles
    classDef clients fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef gateway fill:#90EE90,stroke:#000,stroke-width:1px
    classDef core fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D8BFD8,stroke:#000,stroke-width:1px
    classDef config fill:#FFD700,stroke:#000,stroke-width:1px
```
