🎁 LearnDash MCP Server
A Model Context Protocol (MCP) server implementation for LearnDash that integrates with Elementor's Angie AI assistant.
🚀 Features
- Integration with LearnDash's course management system.
- Provides AI-powered tools for courses, lessons, assignments, enrollment management and commerce & payments.
- Connects with Elementor's Angie AI assistant.
- Built on the Model Context Protocol (MCP) standard.
Prerequisites
- Node.js 18+ or Bun 1.2.20+
🔧 Installation
npm install @stellarwp/learndash-mcp-server
bun add @stellarwp/learndash-mcp-server
⚙️ Configuration
Create an mcp.json
file with the following structure:
Using bun (recommended):
{
"mcpServers": {
"learndash-mcp": {
"command": "bunx",
"args": ["-y", "@stellarwp/learndash-mcp-server@latest"],
"env": {
"WP_REST_URL": "https://your-wordpress-site.com/wp-json",
"WP_USERNAME": "your-username",
"WP_APP_PASSWORD": "your-application-password",
"NODE_TLS_REJECT_UNAUTHORIZED": 1
}
}
}
}
Using npm:
{
"mcpServers": {
"learndash-mcp": {
"command": "npx",
"args": ["-y", "@stellarwp/learndash-mcp-server@latest"],
"env": {
"WP_REST_URL": "https://your-wordpress-site.com/wp-json",
"WP_USERNAME": "your-username",
"WP_APP_PASSWORD": "your-application-password",
"NODE_TLS_REJECT_UNAUTHORIZED": 1
}
}
}
}
Required environment variables:
WP_REST_URL
: Your WordPress site's REST API URL
WP_USERNAME
: Your WordPress username
WP_APP_PASSWORD
: Your WordPress application password
Usage with Cursor or Claude Desktop
Add and customize the above configuration. For more information, read the Cursor MCP documentation or the Claude Desktop MCP guide.
Claude Code CLI
Using bun:
claude mcp add learndash \
--env WP_REST_URL=https://your-wordpress-site.com/wp-json \
--env WP_USERNAME=admin \
--env WP_APP_PASSWORD='XXXX XXXX XXXX XXXX XXXX XXXX' \
-- \
bunx -y @stellarwp/learndash-mcp-server@latest
Using npm:
claude mcp add learndash \
--env WP_REST_URL=https://your-wordpress-site.com/wp-json \
--env WP_USERNAME=admin \
--env WP_APP_PASSWORD='XXXX XXXX XXXX XXXX XXXX XXXX' \
-- \
npx -y @stellarwp/learndash-mcp-server@latest
Testing MCP Server Tools
[!IMPORTANT]
You need an accessible WordPress installation with LearnDash installed that the MCP Server can talk to.
The easiest way to test the tools for valid REST connectivity is to use the MCP Inspector.
Run this in your terminal, and it will automatically launch the MCP Inspector and allow you to run an instance of the server
locally:
npx @modelcontextprotocol/inspector --config path/to/your/mcp.json
[!TIP]
If you're testing this against a local WordPress install that does not have a valid SSL certificate, set NODE_TLS_REJECT_UNAUTHORIZED
to 0
in the mcp.json
to allow API requests to complete. Note: This should only be used in development environments, never in production.
🏃♂️ Usage
CLI Usage
[!IMPORTANT]
Copy the .env.example to an .env
file in your current working directory and fill it out according to the configuration.
bunx -y @stellarwp/learndash-mcp-server@latest
npx -y @stellarwp/learndash-mcp-server@latest
bun run src/index.ts
Integration with Elementor's Angie
This server can be integrated with Elementor's Angie AI assistant:
import register from '@stellarwp/learndash-mcp-server/angie';
register().then(() => console.log('Angie MCP connection successful'));
🏷️ Publishing Packages to NPM
To publish packages to NPM:
💡 The package version is set via publish.yml
workflow, so just leave them all as 0.0.0
.
- Go to the GitHub repository releases page
- Click "Create a new release"
- Create a new tag with the version number (e.g.,
1.0.1
)
- Fill in the release title and description
- Publish the release
This will automatically trigger the publish.yml
GitHub workflow to publish all packages to NPM.
🛠️ MCP Tools Available
The server provides two powerful MCP tools that give you complete access to the LearnDash REST API:
API Tools
get-learndash-api-info
- Retrieves the complete LearnDash REST API OpenAPI schema. This must be called before making any API requests.
make-learndash-api-request
- Makes authenticated requests to any LearnDash REST API endpoints.
🛠️ Development
[!NOTE]
Development requires bun.
bun install
bun run build
bun run test
Available Scripts
bun run build
- Build all packages
bun run dev
- Start development mode for all packages
bun run test
- Run test suite
bun run test:ui
- Run tests with UI
bun run test:coverage
- Generate test coverage report
bun run test:coverage:open
- Generate test coverage report and open it in your default browser
bun run lint
- Run ESLint
bun run lint:fix
- Fix ESLint problems
bun run format
- Check code formatting
bun run format:fix
- Automatically fix formatting
bun run typecheck
- Run TypeScript type checking
bun run clean
- Clean all temporary build folders