How jupiterbak/ayx-mcp-wrapper works
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.