Connect LearnWorlds to ChatGPT: Manage Users and Group Activity
Learn how to build a managed MCP server to connect LearnWorlds to ChatGPT. Automate user auditing, group enrollment tracking, and role management with AI.
If you are managing an educational platform, tracking user progress, auditing cohort enrollments, and checking customer sentiment across groups is a manually intensive process. You want to connect LearnWorlds to ChatGPT so your AI agents can read user data, audit access roles, and summarize group activity using natural language. If your team uses Claude instead, check out our guide on connecting LearnWorlds to Claude or explore our broader architectural overview on connecting LearnWorlds to AI Agents.
Giving a Large Language Model (LLM) read and write access to your LearnWorlds instance is an engineering challenge. You either spend weeks building, hosting, and maintaining a custom Model Context Protocol (MCP) server, or you use a managed infrastructure layer that handles the boilerplate for you. This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for LearnWorlds, connect it natively to ChatGPT, and execute complex workflows.
The Engineering Reality of the LearnWorlds API
A custom MCP server is a self-hosted integration layer that translates an LLM's tool calls into REST API requests. While the open MCP standard provides a predictable way for models to discover tools, the reality of implementing it against vendor APIs is painful. If you decide to build a custom MCP server for LearnWorlds, you are responsible for the entire API lifecycle.
Here are the specific integration challenges that break standard REST assumptions when working with the LearnWorlds API:
The Meta Pagination Object
When an LLM requests a list of users or groups, it cannot ingest 10,000 records at once. LearnWorlds handles pagination by returning a nested meta object containing totalPages, currentPage, itemsPerPage, and totalItems. An LLM does not inherently know how to increment a numeric page counter correctly across large datasets. Your MCP server has to inject strict descriptions into the JSON schema, explicitly instructing the LLM to read the meta.currentPage value from the previous response, increment it, and pass it back in the subsequent query payload. If your schema does not define this strictly, the model will hallucinate offsets and skip records.
Deeply Nested Group Architectures
LearnWorlds groups are complex entities. When querying groups, the API returns deeply nested arrays for group_managers (which includes internal user IDs, usernames, and role details) and products (which maps to enrolled courses). If you expose the raw LearnWorlds group endpoint to ChatGPT without explicitly mapped JSON schemas, the LLM will struggle to distinguish between a group manager and a standard user enrolled in the group's courses. Your MCP server must derive and enforce highly structured schemas for these nested resources so the LLM knows exactly what fields to extract.
Strict Rate Limits and 429 Handling
LearnWorlds enforces strict rate limiting. If an AI agent attempts to run a heavy data extraction workflow - like iterating over every user in a 5,000 - member cohort - it will quickly exhaust the API quota. Truto does not retry, throttle, or apply backoff on rate limit errors. When the LearnWorlds 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 HTTP headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. Your client (ChatGPT or your custom AI agent) is fully responsible for reading these headers and executing the appropriate retry or exponential backoff logic.
Creating the LearnWorlds MCP Server
Instead of building a proxy layer from scratch, Truto dynamically derives tool definitions from LearnWorlds API documentation and your connected tenant account. A single URL serves as the fully authenticated JSON-RPC 2.0 endpoint.
You can generate this server via the Truto UI or programmatically via the API.
Method 1: Via the Truto UI
This is the fastest method for internal operational teams.
- Navigate to the integrated account page for your LearnWorlds connection in the Truto dashboard.
- Click the MCP Servers tab.
- Click Create MCP Server.
- Define your configuration. You can filter the server to only allow
readoperations or restrict it to specific tags (e.g.,users,groups). - Click Save and copy the generated MCP server URL (it will look like
https://api.truto.one/mcp/a1b2c3d4...).
Method 2: Via the Truto API
For platform engineering teams deploying AI agents dynamically, you can generate an MCP server programmatically. Truto validates the configuration, generates a cryptographically hashed token, stores it in distributed state, and returns a ready-to-use URL.
Endpoint: POST /integrated-account/:id/mcp
// Example: Creating a Read-Only LearnWorlds MCP Server
const response = await fetch('https://api.truto.one/integrated-account/lw_acc_88493/mcp', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TRUTO_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: "LearnWorlds User Audit MCP",
config: {
methods: ["read"], // Restricts the LLM to GET/LIST requests
tags: ["users", "groups"]
},
expires_at: "2026-12-31T23:59:59Z"
})
});
const mcpServer = await response.json();
console.log(mcpServer.url);
// "https://api.truto.one/mcp/a1b2c3d4e5f6..."This URL is entirely self-contained. It encodes the tenant routing, the LearnWorlds authentication tokens, and the JSON schemas for the exposed tools.
Connecting the MCP Server to ChatGPT
Once you have the Truto MCP URL, you need to register it as a tool provider for your LLM. ChatGPT and other agents use this URL to discover the available LearnWorlds endpoints during the initialization handshake.
Method A: Via the ChatGPT UI
If you are using ChatGPT Plus, Team, or Enterprise, you can connect the server directly in the client.
- Open ChatGPT and navigate to Settings → Apps → Advanced settings.
- Enable Developer mode.
- Under MCP servers / Custom connectors, click Add new server.
- Name: "LearnWorlds Admin"
- Server URL: Paste the Truto MCP URL.
- Save the configuration. ChatGPT will immediately connect, perform the JSON-RPC initialization, and load the LearnWorlds tools.
Method B: Via Manual Config File (SSE Transport)
If you are running a local agent, Claude Desktop, or a custom LangChain/LangGraph architecture, you can define the MCP server using a standard JSON configuration file. Truto's MCP servers communicate over HTTP POST (Server-Sent Events proxying JSON-RPC).
{
"mcpServers": {
"learnworlds_admin": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"https://api.truto.one/mcp/a1b2c3d4e5f6..."
]
}
}
}LearnWorlds Hero Tools
Truto exposes integration endpoints as highly structured tools. Instead of forcing the LLM to construct complex REST queries, Truto provides precise query and body schemas derived from the LearnWorlds documentation. Here are the highest-leverage tools available for LearnWorlds management.
list_all_learn_worlds_users
This tool retrieves the complete directory of users in your LearnWorlds instance. It returns an array of user objects containing fields like id, email, username, created, last_login, role, tags, and status. Crucially, it handles the metadata required for iterating through large student populations.
"Fetch the first page of users in LearnWorlds. I need to see their email addresses, tags, and account status to determine who has logged in recently."
get_single_learn_worlds_user_by_id
When you need granular details about a specific student or administrator, this tool extracts the complete profile based on the user's id. The response includes account status booleans (is_admin, is_instructor, is_suspended), billing_info, utms, tracking tags, and customer sentiment metrics like nps_score and nps_comment.
"Look up the user profile for ID 'usr_5592'. Check their billing info, verify if they are suspended, and summarize their latest NPS comment."
list_all_learn_worlds_roles
This tool retrieves all configured user roles within the platform. It returns the id, title, description, access_level, and custom_role boolean for each role. This is critical for security audits, allowing the LLM to cross-reference a user's assigned role against the actual permissions that role grants.
"List all the user roles currently active in LearnWorlds. Highlight any custom roles and explain their access levels."
list_all_learn_worlds_groups
Groups in LearnWorlds map to cohorts, B2B clients, or internal teams. This tool lists every group, returning the id, title, description, course products, enroll_users_on_courses flags, group_managers, and modification timestamps.
"Show me all the user groups in our LearnWorlds instance. I want to see which groups automatically enroll users into courses when they join."
get_single_learn_worlds_group_by_id
To audit a specific cohort, this tool pulls the deep nested schema of a single group. It extracts the products array (the courses the group has access to) and the group_managers array (detailing the ID, username, email, and role_id of the staff managing the cohort).
"Retrieve the full details for the group with ID 'grp_104'. List the exact courses assigned to this group and tell me the email addresses of the group managers."
For the complete inventory of available operations, including write methods and custom resources, visit the LearnWorlds integration page.
Workflows in Action
By connecting these tools to ChatGPT, IT administrators and Customer Success Managers can execute complex, multi-step queries that would normally require manual CSV exports and VLOOKUPs.
Scenario 1: Auditing Group Managers and Enrolled Courses
Persona: EdTech IT Administrator
"Find the 'Enterprise Cohort Q3' group in LearnWorlds. Tell me who manages it, and list the specific courses they are automatically enrolled in."
list_all_learn_worlds_groups: ChatGPT calls this tool to retrieve the directory of groups. It scans the response to locate the ID for the group titled "Enterprise Cohort Q3".get_single_learn_worlds_group_by_id: Using the discovered group ID, ChatGPT fetches the deep profile of the cohort. It parses the nestedgroup_managersarray to extract the administrative emails, and maps theproductsarray to list the active courses.- Result: The LLM outputs a clean summary: "The 'Enterprise Cohort Q3' group (ID: grp_882) is managed by admin@example.com. Members are automatically enrolled in 'Advanced System Design' and 'Security Fundamentals'."
Scenario 2: VIP User Sentiment & Role Audit
Persona: Customer Success Manager
"Look up LearnWorlds user ID 'usr_90210'. I need their NPS score, billing info, and current system role to see if they qualify for the admin upgrade."
get_single_learn_worlds_user_by_id: ChatGPT queries the specific user ID. It extracts thenps_score,billing_info, androlefields from the extensive JSON response.list_all_learn_worlds_roles: If the user's role ID is opaque (e.g., 'rl_44'), ChatGPT proactively calls the roles tool to match the ID against the human-readable title andaccess_level.- Result: The LLM responds: "User usr_90210 has an NPS score of 9 ('Great platform!'). They are currently on the 'Pro Annual' billing tier. Their current role is 'Standard Student' (access_level: 1). To qualify for the admin upgrade, their role must be changed to 'Instructor'."
Security and Access Control
Exposing an educational platform to an AI model requires strict governance. Truto's MCP architecture provides several layers of access control out of the box:
- Method Filtering: You can restrict the MCP server config to
methods: ["read"]. This prevents ChatGPT from accidentally deleting courses, suspending users, or modifying cohort settings, limiting it to GET and LIST requests. - Tag Filtering: By configuring
tags: ["users", "groups"], the server will completely hide unrelated integration endpoints (like webhooks or site settings) from the LLM's context window, reducing hallucination risk. require_api_token_auth: For high-security environments, you can enable this flag. It forces the connecting MCP client to provide a valid Truto API token in the Authorization header, ensuring that simply possessing the MCP URL is not enough to access the LearnWorlds tools.expires_at: You can assign an ISO datetime to the server. Truto's distributed cleanup system will automatically revoke the token and destroy the MCP endpoint at the specified time, perfect for granting temporary auditing access to external contractors.
Wrapping Up
Automating LearnWorlds operations through ChatGPT eliminates the manual overhead of traversing nested menus to audit student roles and cohort managers. However, building the necessary MCP infrastructure to handle LearnWorlds's specific pagination logic, nested group architectures, and rate limits is a massive engineering distraction.
Truto abstracts this away. By normalizing the documentation into strict JSON schemas and providing a managed JSON-RPC layer, you can give your AI agents safe, structured access to LearnWorlds in minutes instead of months.
FAQ
- How do I connect LearnWorlds to ChatGPT?
- You need an MCP (Model Context Protocol) server to translate ChatGPT's tool calls into LearnWorlds REST API requests. You can generate a managed MCP server URL using Truto, then paste that URL into ChatGPT's Custom Connectors configuration.
- How does Truto handle LearnWorlds API rate limits?
- Truto does not retry, throttle, or apply backoff on rate limit errors. When LearnWorlds returns an HTTP 429, Truto passes that error back to the caller while normalizing the rate limit info into standard IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). The client is responsible for implementing retry logic.
- Can I restrict which LearnWorlds endpoints ChatGPT can access?
- Yes. When creating the Truto MCP server, you can use method filtering (e.g., restricting to 'read' operations only) or tag filtering to ensure the LLM only has access to specific functional areas like users or groups.