Skip to content

Connect LearnWorlds to Claude: Administer User Roles and Groups

Learn how to build a managed MCP server for LearnWorlds, connect it to Claude, and automate user administration, group management, and role assignments.

Uday Gajavalli Uday Gajavalli · · 10 min read
Connect LearnWorlds to Claude: Administer User Roles and Groups

If you need to connect LearnWorlds to Claude to automate user administration, manage cohort groups, or audit role assignments across your e-learning platform, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between Claude's function calling capabilities and the LearnWorlds REST API. You can choose to build and host this integration infrastructure from scratch, or you can use a managed platform like Truto to dynamically generate a secure, authenticated MCP server URL. If your team uses ChatGPT, check out our guide on /connect-learnworlds-to-chatgpt-manage-users-and-group-activity/, or explore our broader architectural breakdown on /connect-learnworlds-to-ai-agents-automate-user-and-group-data/.

Giving a Large Language Model (LLM) read and write access to a complex e-learning environment is a serious engineering challenge. You must handle token lifecycles, parse deeply nested JSON responses, and manage specific rate limits to prevent your AI from failing silently. Every time LearnWorlds adds a new course parameter or deprecates a user field, your custom server code must be updated, tested, and redeployed.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for LearnWorlds, connect it natively to Claude Desktop, and execute complex administrative workflows using natural language.

The Engineering Reality of the LearnWorlds API

A custom MCP server is essentially a self-hosted integration layer. While the open Model Context Protocol provides a standard way for AI models to discover tools, implementing it against specific vendor APIs exposes a lot of hidden complexity. Integrating LearnWorlds is not just a matter of passing bearer tokens; you are dealing with an API designed for complex educational hierarchies.

If you decide to build a custom MCP server for LearnWorlds in-house, you own the entire API lifecycle. Here are the specific challenges you will face:

Deeply Nested Data Models LearnWorlds user and group objects are not flat database rows. A single user object contains nested structures for billing_info, utms, and fields. A group object contains complex arrays like group_managers (which includes nested IDs, usernames, emails, and role mappings) and products (course enrollments). If you expose these raw, nested schemas directly to Claude, the model will frequently hallucinate array structures or miss required nested properties when attempting to execute updates. A managed MCP server flattens and normalizes these inputs, ensuring the LLM understands exactly what properties go into the query string versus the request body.

Hidden Pagination Metadata When listing resources like users or groups, LearnWorlds does not use simple link headers. It embeds pagination data inside a nested meta object within the JSON response. Your MCP server must explicitly instruct the LLM on how to find the current page limits, read the next cursor or page integer, and pass it back in the exact format required by the subsequent tool call. If the schema does not explicitly constrain the LLM, the model will attempt to guess pagination tokens, leading to broken data loops.

Strict Rate Limiting Realities LearnWorlds, like all enterprise SaaS platforms, enforces strict rate limits to protect its infrastructure. When an AI agent attempts to iterate through hundreds of groups, it can quickly exhaust these limits. Truto does not retry, throttle, or apply backoff on rate limit errors. When the LearnWorlds upstream API returns an HTTP 429 Too Many Requests error, Truto passes that error directly to the caller. However, Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) following the IETF specification. The caller - whether that is the Claude desktop client or your custom LangGraph agent - is entirely responsible for reading these headers and implementing its own retry and exponential backoff logic.

How to Generate a LearnWorlds MCP Server with Truto

Truto dynamically generates MCP tools based on integration documentation and available API resources. It does not hardcode tools. When you connect a LearnWorlds instance, Truto reads the available resource definitions, filters them based on your configuration, and exposes them as a JSON-RPC 2.0 endpoint.

Each MCP server generated by Truto is scoped entirely to a single integrated account. The server URL contains a cryptographically hashed token that authenticates the request, identifies the tenant, and scopes the available tools.

You can generate this server via the Truto dashboard or programmatically via the API.

Method 1: Generating via the Truto UI

For internal workflows or one-off administrative tasks, the easiest path is generating the server through the dashboard.

  1. Log in to your Truto environment and navigate to the integrated account page for your connected LearnWorlds instance.
  2. Click the MCP Servers tab.
  3. Click the Create MCP Server button.
  4. Select your desired configuration. Name the server (e.g., "LearnWorlds Admin MCP") and apply any necessary method filters (like restricting access to only read operations to prevent accidental user deletion).
  5. Click save and copy the generated MCP server URL. Keep this URL secure, as it contains the authentication token.

Method 2: Generating via the API

For B2B SaaS companies provisioning MCP servers programmatically for their own tenants, you can use the Truto API to generate endpoints on the fly. This validates the configuration, stores the hashed token in a distributed key-value store, and returns the ready-to-use URL.

Make a POST request to /integrated-account/:id/mcp:

import fetch from 'node-fetch';
 
async function createLearnWorldsMcpServer(integratedAccountId: string) {
  const response = await fetch(`https://api.truto.one/integrated-account/${integratedAccountId}/mcp`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.TRUTO_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: "LearnWorlds User Management AI",
      config: {
        methods: ["read", "update"] // Allow reading data and updating users, but block deletions
      },
      expires_at: "2025-12-31T23:59:59Z" // Optional: Enforce an absolute TTL for security
    })
  });
 
  const data = await response.json();
  console.log(`Your MCP Server URL: ${data.url}`);
  return data.url;
}

If you request a configuration that results in zero available tools (for example, requesting a tag that does not exist on any LearnWorlds endpoints), the API will reject the request. This ensures you never provision an empty MCP server.

Connecting the MCP Server to Claude

Once you have the Truto MCP server URL, you must register it with your Claude environment. The server communicates using standard JSON-RPC 2.0 messages over HTTP POST requests.

Method 1: Via the Claude Desktop UI

If you are using the Claude Desktop application locally:

  1. Open Claude Desktop and navigate to Settings.
  2. Click on Integrations.
  3. Click Add MCP Server.
  4. Give the connection a descriptive name (e.g., "LearnWorlds Production API").
  5. Paste the Truto MCP URL into the URL field and click Add.

Claude will immediately ping the server using the initialize protocol method to fetch the server capabilities and available tools. No additional OAuth flows or authentication configurations are required on your local machine.

Method 2: Via the Configuration File (SSE)

For automated deployments, headless agents, or specific desktop configurations, you can register the server manually by editing the claude_desktop_config.json file. Because Truto provides a remote HTTP endpoint, you use the official @modelcontextprotocol/server-sse package as the transport layer to pipe standard I/O to Server-Sent Events.

Locate your configuration file (usually found at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows).

Add the Truto server configuration:

{
  "mcpServers": {
    "learnworlds-admin": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "https://api.truto.one/mcp/YOUR_SECURE_TOKEN_HERE"
      ]
    }
  }
}

Restart Claude Desktop. The application will execute the npx command, establish the SSE connection, and ingest the LearnWorlds tools.

Core LearnWorlds MCP Tools for Claude

Truto dynamically translates LearnWorlds API documentation into functional MCP tools. To ensure high quality, a tool only appears if it has a corresponding documentation record containing descriptions and JSON Schema definitions.

Here are the highest-leverage administrative operations available to Claude once connected:

list_all_learn_worlds_users

Retrieves a paginated list of all users in the LearnWorlds instance. Claude can use this to extract overarching directories, review user statuses (suspended, active), and audit tags. The response includes the user's ID, email, username, creation date, last login, role, and current status.

"Review our LearnWorlds directory and list all users who have a 'suspended' status but have logged in within the last 30 days. Output their email addresses and user IDs."

get_single_learn_worlds_user_by_id

Fetches exhaustive metadata for a specific user using their LearnWorlds ID. This tool exposes the deeply nested objects unique to LearnWorlds, including billing_info, account status booleans (is_admin, is_instructor, is_suspended), custom fields, UTM parameters, and historical NPS scores with comments.

"Pull the complete user profile for the user ID 67b8a1c9. I need to see their current role, whether they are flagged as an instructor, and any NPS comments they have left in the past."

list_all_learn_worlds_roles

Returns an alphabetical array of all user roles defined in the platform. This includes default roles and custom roles, exposing the id, title, description, access_level, and a custom_role boolean. Claude uses this to map role IDs before attempting to update a user's permissions.

"Get a list of all user roles in our LearnWorlds instance. Filter the list to show only custom roles, and output their IDs and descriptions in a table."

list_all_learn_worlds_groups

Retrieves all user groups within the LearnWorlds environment. This is critical for cohort management. The tool returns each group's ID, title, description, assigned products (courses), and the nested group_managers array. It also exposes the enroll_users_on_courses setting, which determines if users added to the group are automatically enrolled in its products.

"Audit all of our LearnWorlds groups. Find any groups where 'enroll_users_on_courses' is set to true, and list the titles of those groups alongside the IDs of their group managers."

get_single_learn_worlds_group_by_id

Fetches detailed information for a single group using its ID. This allows Claude to drill down into a specific cohort to view the exact course products attached to it, read the tags, and inspect the specific access levels of the managers overseeing the group.

"Look up the LearnWorlds group with ID 'cohort-2025-q1'. Tell me which courses are assigned to this group and list the emails of the group managers responsible for it."

For a complete list of all supported endpoints and their JSON schemas, review the LearnWorlds integration page.

Workflows in Action

Exposing these tools to Claude transforms manual API scripting into conversational workflows. Here is how an IT administrator or course manager can execute multi-step operations using the MCP server.

Scenario 1: Auditing Inactive Users and Role Assignments

IT administrators frequently need to audit e-learning platforms to ensure departed employees or inactive contractors no longer retain administrative privileges.

The Prompt:

"Audit our LearnWorlds directory. First, fetch the list of all user roles so we know which IDs correspond to 'admin' or 'instructor'. Then, pull the list of all users. Identify any users who hold an admin or instructor role but have not logged in since January 1st, 2024. Provide a report with their names, emails, and exact role titles."

The Execution:

  1. Tool Call: list_all_learn_worlds_roles - Claude fetches the role taxonomy to understand which role IDs map to elevated privileges.
  2. Tool Call: list_all_learn_worlds_users - Claude fetches the user directory. It reads the meta pagination object to determine if it needs to make subsequent calls to fetch the entire list.
  3. Analysis: Claude cross-references the last_login timestamps against the requested date and filters the list based on the role IDs extracted in step 1.
  4. The Output: Claude streams back a formatted Markdown report of high-risk, inactive accounts, allowing the administrator to take immediate action in the LearnWorlds dashboard.

Scenario 2: Cohort Manager Reporting

Operations teams need visibility into how groups are managed and whether auto-enrollment rules are configured correctly for new cohorts.

The Prompt:

"I need a report on our cohort groups. Fetch the list of all groups. For every group that has 'enroll_users_on_courses' enabled, extract the group managers. Look up the full user profile for each of those group managers and generate a table showing the Group Title, Manager Email, Manager NPS score, and whether the manager has instructor privileges."

The Execution:

sequenceDiagram
    participant User
    participant Claude
    participant MCP Server (Truto)
    participant LearnWorlds API

    User->>Claude: "I need a report on our cohort groups..."
    Claude->>MCP Server: Call list_all_learn_worlds_groups()
    MCP Server->>LearnWorlds API: GET /v2/groups
    LearnWorlds API-->>MCP Server: 200 OK (Groups + Managers)
    MCP Server-->>Claude: JSON Array of Groups
    
    opt For each Manager ID found
        Claude->>MCP Server: Call get_single_learn_worlds_user_by_id(id)
        MCP Server->>LearnWorlds API: GET /v2/users/{id}
        LearnWorlds API-->>MCP Server: 200 OK (User Profile + NPS)
        MCP Server-->>Claude: JSON User Profile
    end
    
    Claude-->>User: Markdown Table (Group Title | Manager Email | NPS | Is Instructor)
  1. Tool Call: list_all_learn_worlds_groups - Claude extracts the group metadata, checking the enroll_users_on_courses boolean for each entry.
  2. Tool Call: get_single_learn_worlds_user_by_id - For the managers nested inside the filtered groups, Claude iterates through their IDs to fetch their complete user profiles.
  3. The Output: Claude correlates the data across endpoints, generating a comprehensive table that blends group configuration data with user sentiment (NPS) and administrative flags (is_instructor).

Security and Access Control

Connecting an LLM to your production e-learning database requires strict governance. Truto provides several mechanisms to lock down the MCP server at the time of creation:

  • Method Filtering: You can configure the server to only expose specific operational categories via the config.methods array. Passing ["read"] ensures the LLM can only execute get and list operations, physically preventing it from creating or deleting LearnWorlds users regardless of the prompt.
  • Tag Filtering: You can restrict tools by functional area using config.tags. If you only want the AI to manage educational content, you can filter by tags to exclude billing or core administrative endpoints.
  • Expiration Controls: The expires_at property allows you to generate short-lived MCP servers. Once the timestamp passes, the token is automatically purged from the distributed KV store, terminating access. This is ideal for granting temporary audit access to contractors.
  • Double Authentication: Setting require_api_token_auth: true means possession of the MCP URL is not enough. The client must also send a valid Truto API token in the Authorization header, adding a required secondary layer of identity verification.

Strategic Architecture for E-Learning Administration

Building integrations for complex systems like LearnWorlds involves navigating nested schemas, mapping relationships between entities, and respecting strict API limits. Writing this translation logic into a custom MCP server is a massive resource sink that distracts your engineering team from core product development.

By leveraging Truto's dynamic, documentation-driven generation, you eliminate the need to write integration boilerplate. The Truto proxy handles the endpoint mapping and standardizes the rate limit headers, while the MCP protocol exposes everything securely to your LLM of choice.

FAQ

Does Truto automatically retry LearnWorlds API rate limits?
No. Truto does not retry, throttle, or apply backoff on rate limit errors. When LearnWorlds returns an HTTP 429 Too Many Requests error, Truto passes that error directly to the caller. Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF spec, allowing your agent or Claude to handle the retry logic.
Can I prevent Claude from deleting LearnWorlds users?
Yes. When generating the MCP server via the Truto API or UI, you can apply method filters. Setting the configuration to only allow `["read", "update"]` will physically prevent the server from exposing or executing `delete` operations, regardless of the prompt given to the LLM.
How does Truto handle pagination for LearnWorlds groups and users?
LearnWorlds often embeds pagination data inside a nested `meta` object within the JSON response. Truto normalizes this into a standard schema, injecting `limit` and `next_cursor` properties into the tool definitions. This explicitly instructs the LLM on how to iterate through pages without hallucinating token values.

More from our Blog