# jupiterbak/ayx-mcp-wrapper architecture

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

- Interactive diagram: https://gitdiagram.com/jupiterbak/ayx-mcp-wrapper
- Repository: https://github.com/jupiterbak/ayx-mcp-wrapper

## Overview

##### Project type and purpose
- This is a full-stack Python “MCP server” application (an Alteryx Server wrapper) exposing the Model Context Protocol (MCP) interface.
- Purpose: allow MCP clients (e.g., Claude Desktop, Cursor IDE, other AI assistants) to manage Alteryx workflows, collections, users, schedules, credentials, etc., by translating MCP calls into Alteryx Server API calls.

##### File structure
- Top-level files:
- __main__.py + src/main.py – entrypoint for CLI/uvx command.
- src/mcp_server.py – core MCP request/response dispatch logic.
- src/env.py + .env.template – configuration via environment variables.
- src/server_client/… – a strongly-typed Python client library for Alteryx’s REST API:
– api_client.py, configuration.py, rest.py
– api/… – individual API endpoint modules
– models/… – Pydantic-style request/response models
- Dockerfile, Makefile, tool-versions, pyproject.toml – build/config and packaging.
- test/ – unit tests for the MCP API surface and server-client library.

##### README for additional insights
- MCP transport options: stdio, SSE, streamable-http
- Usage scenarios: integration snippets for Claude and Cursor, CLI usage.
- Environment variables: ALTERYX_SERVER_URL, CLIENT_ID/SECRET, VERIFY_SSL, LOG_LEVEL.

##### Main components and their interactions
a. MCP Client (external)
- Examples: Claude Desktop, Cursor IDE, custom MCP-capable tools.
b. Transport Layer
- stdio, SSE, or HTTP streaming – receives MCP JSON messages from client.
c. MCP Server Application (this project)
- Entry Point (__main__.py / src/main.py): parses CLI args, configures logging, selects transport.
- mcp_server.py:
– Registers MCP methods, routes incoming requests to handler functions.
– Marshals/unmarshals MCP JSON into Python calls.
- tools.py: utility functions shared across handlers.
- env.py / .env: reads environment variables or .env file into configuration.
d. Alteryx Server-Client Library (src/server_client)
- api_client.py & rest.py: HTTP client wrapper (OAuth2, base URL, SSL).
- configuration.py: holds client credentials, base URL.
- api/*.py: one module per Alteryx endpoint (workflows_api, users_api, schedules_api, etc.).
- models/*.py: data-model classes for all inputs/outputs.
e. External System
- Alteryx Server (external HTTP API)
- OAuth2 authentication, JSON REST endpoints for resources managed by MCP.

##### Architectural patterns and design principles
- Adapter pattern: server_client library adapts Alteryx REST API to Python calls.
- MVC-style separation:
- “Controller” = mcp_server handlers
- “Model” = server_client.models
- “Service/Adapter” = server_client.api & rest
- Single responsibility: each API endpoint module handles one resource type.
- Configuration decoupling: env.py centralizes environment/config loading.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External MCP Client
    MCPClient["MCP Client"]:::external

    %% Transport Layer
    TransportLayer["Transport Layer\n(stdio / SSE / streamable-http)"]:::core

    %% MCP Server Application
    subgraph "MCP Server Application"
        direction TB
        subgraph "Entrypoint"
            direction TB
            EntryMain["__main__.py"]:::core
            EntrySrcMain["src/main.py"]:::core
        end
        subgraph "Router & Handlers"
            direction TB
            Router["mcp_server.py"]:::core
            Tools["tools.py"]:::core
        end
        subgraph "Configuration Loader"
            direction TB
            EnvLoader["src/env.py"]:::core
            EnvTemplate[".env.template"]:::core
        end
        subgraph "Server-Client Library" 
            direction TB
            subgraph "Config & Auth"
                direction TB
                Configuration["configuration.py"]:::adapter
                APIClient["api_client.py"]:::adapter
                REST["rest.py"]:::adapter
            end
            subgraph "API Modules"
                direction TB
                CollectionsAPI["collections_api.py"]:::adapter
                CredentialsAPI["credentials_api.py"]:::adapter
                DCMEAdminAPI["dcme_admin_api.py"]:::adapter
                DCMEAPI["dcme_api.py"]:::adapter
                DCMEConnectAPI["dcme_connect_api.py"]:::adapter
                JobsAPI["jobs_api.py"]:::adapter
                SchedulesAPI["schedules_api.py"]:::adapter
                ServerConnsAPI["server_connections_api.py"]:::adapter
                SubscriptionsAPI["subscriptions_api.py"]:::adapter
                UserGroupsAPI["user_groups_api.py"]:::adapter
                UsersAPI["users_api.py"]:::adapter
                WorkflowsAPI["workflows_api.py"]:::adapter
            end
            subgraph "Data Models"
                direction TB
                Models["models/ (all .py)"]:::adapter
            end
        end
    end

    %% External Alteryx Server
    AlteryxServer["Alteryx Server\n(External API)"]:::external_api

    %% Flow connections
    MCPClient -->|"JSON-RPC"| TransportLayer
    TransportLayer -->|"Message"| EntryMain
    TransportLayer --> EntrySrcMain
    EntryMain --> Router
    EntrySrcMain --> Router
    Router --> Tools
    Router --> EnvLoader
    Router --> CollectionsAPI
    Router --> CredentialsAPI
    Router --> DCMEAdminAPI
    Router --> DCMEAPI
    Router --> DCMEConnectAPI
    Router --> JobsAPI
    Router --> SchedulesAPI
    Router --> ServerConnsAPI
    Router --> SubscriptionsAPI
    Router --> UserGroupsAPI
    Router --> UsersAPI
    Router --> WorkflowsAPI
    CollectionsAPI --> APIClient
    CredentialsAPI --> APIClient
    DCMEAdminAPI --> APIClient
    DCMEAPI --> APIClient
    DCMEConnectAPI --> APIClient
    JobsAPI --> APIClient
    SchedulesAPI --> APIClient
    ServerConnsAPI --> APIClient
    SubscriptionsAPI --> APIClient
    UserGroupsAPI --> APIClient
    UsersAPI --> APIClient
    WorkflowsAPI --> APIClient
    APIClient --> REST
    REST --> AlteryxServer
    AlteryxServer --> REST
    REST --> Models
    REST --> Router
    Models --> Router

    %% Click Events
    click EntryMain "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/__main__.py"
    click EntrySrcMain "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/main.py"
    click EnvLoader "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/env.py"
    click EnvTemplate "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/.env.template"
    click Router "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/mcp_server.py"
    click Tools "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/tools.py"
    click Configuration "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/configuration.py"
    click APIClient "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api_client.py"
    click REST "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/rest.py"
    click CollectionsAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/collections_api.py"
    click CredentialsAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/credentials_api.py"
    click DCMEAdminAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/dcme_admin_api.py"
    click DCMEAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/dcme_api.py"
    click DCMEConnectAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/dcme_connect_api.py"
    click JobsAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/jobs_api.py"
    click SchedulesAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/schedules_api.py"
    click ServerConnsAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/server_connections_api.py"
    click SubscriptionsAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/subscriptions_api.py"
    click UserGroupsAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/user_groups_api.py"
    click UsersAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/users_api.py"
    click WorkflowsAPI "https://github.com/jupiterbak/ayx-mcp-wrapper/blob/main/src/server_client/api/workflows_api.py"
    click Models "https://github.com/jupiterbak/ayx-mcp-wrapper/tree/main/src/server_client/models/"

    %% Styles
    classDef external fill:#9f6,stroke:#333,stroke-width:1px
    classDef core fill:#6cf,stroke:#333,stroke-width:1px
    classDef adapter fill:#f96,stroke:#333,stroke-width:1px
    classDef external_api fill:#f66,stroke:#333,stroke-width:1px
```
