How to Request a Custom Module from Your AI Agent

Build Analysis Modules via MCP — No Browser Required

Request Modules Directly from Your AI Assistant

If you use Claude Desktop, Cursor, Windsurf, or any MCP-compatible client, you can request a custom statistical analysis module without ever opening a browser. Describe what you need to your AI assistant, and the platform builds it in the background. When it is ready, your agent can run it immediately.

This is the fastest path from business question to published analysis: your agent handles the spec, the submission, and the first run. You just talk.

What You'll Need

What You'll Get

Step 1: Connect Your MCP Client

Follow the quickstart guide at docs/quickstart.html to connect your MCP client to MCP Analytics. The setup takes about two minutes:

  1. Copy your API key from the Settings page in your MCP Analytics account
  2. Add the MCP Analytics server to your client's configuration file
  3. Restart your client

Example: Claude Desktop Configuration

// In your Claude Desktop MCP config:
{
  "mcpServers": {
    "mcpanalytics": {
      "type": "http",
      "url": "https://api.mcpanalytics.ai/mcp/api-key",
      "headers": {
        "x-api-key": "your-api-key-here"
      }
    }
  }
}

Once connected, several MCP tools become available to your agent: discover_tools, tools_schema, tools_run, datasets_upload, datasets_list, and — on paid plans — module_request.

Tip: You can verify the connection by asking your agent: "What analysis tools are available on MCP Analytics?" The agent will call discover_tools and list the catalog.

Expected Outcome: Your MCP client is connected and your agent can see and call MCP Analytics tools.

Step 2: Describe Your Analysis to the Agent

Tell your AI assistant what you need, just as you would tell a colleague. The agent handles all the technical details.

Example Conversation

You: I want to build a custom module that analyzes employee
     attrition using my HR dataset. I need logistic regression
     with odds ratios, a survival curve, and feature importance.

Agent: I'll check if we already have a module that matches
       this. Let me search the catalog...

       [calls discover_tools with query "employee attrition
        logistic regression"]

       There's no exact match for your spec. I can create a
       custom module for you. Based on your description, here's
       what I'll request:

       - Category: research
       - Analysis: logistic regression + survival analysis
       - Required columns: employee_id, hire_date,
         termination_date, department, salary,
         performance_rating, age, satisfaction_score
       - Output cards: model summary, odds ratios forest plot,
         Kaplan-Meier survival curve, feature importance,
         confusion matrix, department-level breakdown

       Does this look right? Should I add or change anything?

You: Add a card for predicted attrition risk by department.

Agent: Got it. I'll add a department risk heatmap card.
       Shall I submit this now?

You: Yes, go ahead.
Note: The agent uses discover_tools to check the existing catalog first. If a pre-built module already handles your question, the agent will suggest using it instead — saving time and credits.

Expected Outcome: You and the agent have agreed on a specification. The agent is ready to submit the request.

Step 3: The Agent Calls module_request

The agent submits a structured specification via the module_request MCP tool. You do not need to fill out any forms — the agent formats everything from your conversation.

What the Agent Sends

// The agent calls module_request with a spec like this:
{
  "category": "research",
  "analysis_type": "logistic_regression_survival",
  "title": "Employee Attrition Analysis",
  "description": "Logistic regression on employee attrition
    with odds ratios, Kaplan-Meier survival curves, and
    feature importance by department.",
  "required_columns": [
    {"name": "employee_id", "type": "identifier"},
    {"name": "hire_date", "type": "date"},
    {"name": "termination_date", "type": "date"},
    {"name": "department", "type": "categorical"},
    {"name": "salary", "type": "numeric"},
    {"name": "performance_rating", "type": "numeric"}
  ],
  "dataset_uuid": "ds_hr_attrition_20260411_71t0"
}

The platform validates the spec, checks your billing tier, and creates the pipeline entry. The agent receives a confirmation with the module name and tracking URL.

Agent: Module submitted successfully.

       Module name: user__research__hr__attrition_analysis
       Tracking URL: https://mcpanalytics.ai/track.html
                     ?m=user__research__hr__attrition_analysis
       Estimated build time: 20-45 minutes.

       I'll check the status periodically. You can also
       visit the tracking URL to watch progress.
Billing: Module creation is included in Starter and Pro plans. PAYG users are charged 1,000 credits per module. The agent confirms the cost before submitting.

Expected Outcome: The module request is submitted and the autonomous build pipeline has started. You have a tracking URL.

Step 4: Track the Build

You can track the build two ways:

  1. Ask your agent: "What's the status of my module build?" The agent checks via the pipeline status endpoint and reports back.
  2. Visit the tracking page: Open mcpanalytics.ai/track.html with your module name as a parameter.
You: What's the status of my attrition module?

Agent: [checks pipeline status]

       Your module "user__research__hr__attrition_analysis"
       is currently in the "visual verification" stage
       (stage 3 of 7). Estimated time remaining: ~15 minutes.

       Stages completed:
       1. Spec validation (passed)
       2. R code generation (complete)
       3. Visual verification (in progress)
       4. Deployment (pending)
       5. Production test (pending)
       6. Quality review (pending)
       7. Marketing assets (pending)

Typical build time: 20–45 minutes. You will also receive an email when the module is ready, with a direct link to run your first analysis.

Tip: You can continue working with your agent on other tasks while the module builds. The build runs asynchronously and does not block your session.

Expected Outcome: You know exactly where your module is in the pipeline and when to expect it.

Step 5: Use the New Module

Once built, the module appears in discover_tools results. Your agent can run it immediately:

You: My attrition module should be ready. Can you run it
     on my HR dataset?

Agent: [calls discover_tools to confirm the module is live]

       Yes, "user__research__hr__attrition_analysis" is
       deployed and ready. Let me run it on your dataset...

       [calls tools_run with your dataset UUID and
        column mappings]

       Analysis complete. Here's your report:
       https://app.mcpanalytics.ai/rpt/rpt_abc123xyz

       Key findings:
       - Employees with satisfaction_score < 3.0 are 4.2x
         more likely to leave (OR=4.2, p<0.001)
       - Engineering department has the highest attrition
         risk (28% predicted over next 12 months)
       - Tenure < 2 years is the strongest predictor,
         followed by salary below median
       - Median time-to-attrition: 18 months for high-risk
         employees

The report URL opens a full interactive report with charts, statistical tables, interpretations, code appendix, and PDF export.

Running on New Data

The module is reusable. Next quarter, upload a fresh dataset and ask your agent to run it again:

You: Upload this Q2 HR export and run my attrition analysis.

Agent: [calls datasets_upload, then tools_run]

       Done. New report: https://app.mcpanalytics.ai/rpt/rpt_def456uvw

       Compared to Q1: overall attrition risk decreased 3pp,
       but the Sales department risk increased from 15% to 22%.
Note: You can also run the module from the web app at app.mcpanalytics.ai if you prefer a browser interface. See the web tutorial for that workflow.

Expected Outcome: Your custom module is live, your agent can run it on any matching dataset, and you have an interactive report with full statistical output.

Ready to Build a Module from Your AI Agent?

Skip the forms and dashboards. Tell your AI assistant what you need and get a custom analysis module built and ready to run — all without leaving your MCP client.

Get Started with MCP

Connect your AI agent to MCP Analytics and start building custom modules in minutes.

Read the Quickstart →

Compare plans →

What you get:

For the browser-based workflow, see the web app tutorial. For the full API reference, see the API documentation. For plan details, see pricing.

Next Steps

1. Explore Existing Modules First

Ask your agent "What analysis tools are available for my data?" before requesting a custom build. The catalog has pre-built modules for common analyses that are ready to run immediately.

2. Upload Datasets via the Agent

Your agent can upload datasets using datasets_upload. Ask: "Upload this CSV to MCP Analytics." The agent returns a dataset UUID you can reference in future module requests.

3. Customize Report Cards

After running a module, you can ask the agent to customize which cards appear in the report using cards_customize. Hide cards you do not need or reorder them for your audience.

4. Create a Module via the Web App

If you prefer a visual interface for reviewing and editing the spec, use the web app workflow instead. Both paths produce the same module.

Troubleshooting

module_request tool not visible

The module_request tool is only available on paid plans (Starter, Pro, or PAYG with credits). If you are on the Demo tier, upgrade your plan to unlock it.

Agent says "connection refused" or "unauthorized"

Check that your API key is correct and has not expired. You can regenerate a key from your account settings. Also verify the server URL matches the quickstart guide at docs/quickstart.html.

Build takes longer than expected

Complex modules with many output cards or unusual statistical methods may take longer. If the build exceeds 90 minutes, check the tracking page for details. The pipeline retries failed stages automatically.

Agent cannot find the module after build

The agent caches tool lists. Ask the agent to call discover_tools again to refresh. If the module still does not appear, check the tracking page to confirm the build completed successfully.