1. Introduction
LearnPress includes native support for the Model Context Protocol (MCP), enabling AI assistants and tools to interact directly with LearnPress LMS data through a standardized protocol.
2. Background
The Model Context Protocol (MCP) is an open standard that enables AI applications to securely connect to external data sources and tools. LearnPress’s MCP integration builds on two core technologies:
- WordPress Abilities API – A standardized system for registering capabilities in WordPress
- WordPress MCP Adapter – The core MCP protocol implementation
This architecture allows LearnPress to expose LMS operations as MCP tools through the flexible WordPress Abilities system while maintaining existing security and permission models.
3. What’s Available
LearnPress’s MCP integration provides AI assistants with structured access to core LMS operations:
Course Management
- List courses with filtering and pagination
- Retrieve detailed course information including curriculum summary
- Filter courses by status, category, instructor, and price range
- Search courses by keyword
Lesson Management
- List lessons in a course with optional section filtering
- Retrieve detailed lesson information including content, video intro, and materials
- Filter lessons by status and section
Quiz Management
- List quizzes in a course with pagination
- Retrieve detailed quiz information including duration, passing grade, and question count
Student Progress Tracking
- Get student progress and results for course enrollments
- Track completion status and performance metrics
Enrollment Management
- List course enrollments with filtering and pagination
- Filter enrollments by course, user, and status
All operations respect LearnPress’s existing permission system and are authenticated using LearnPress MCP API keys.
Data Privacy Notice: Student progress and enrollment operations may expose personally identifiable information (PII) including names, email addresses, and learning data. You are responsible for ensuring compliance with applicable data protection regulations. Use least-privilege API scopes, rotate and revoke API keys regularly, and follow your organization’s data retention and handling policies.
4. Architecture
Data Flow Overview
AI Client (Claude, etc.) ↓ (MCP protocol over stdio/JSON-RPC) Local MCP Proxy (mcp-wordpress-remote) ↓ (HTTP/HTTPS requests with authentication) Remote WordPress MCP Server (mcp-adapter) ↓ (WordPress Abilities API) LearnPress Abilities ↓ (Direct database queries and WordPress APIs) LearnPress Core
Architecture Components
Local MCP Proxy (mcp-wordpress-remote)
- Runs locally on the developer’s machine as a Node.js process
- Converts MCP protocol messages to HTTP requests
- Handles authentication header injection
- Bridges the protocol gap between MCP clients and WordPress REST endpoints
Remote WordPress MCP Server (mcp-adapter)
- Runs within WordPress as a plugin
- Exposes the
/wp-json/mcp/mcp-adapter-default-serverendpoint - Processes incoming HTTP requests and converts them to MCP protocol messages
- Manages tool discovery and execution
WordPress Abilities System
- Provides a standardized way to register and execute capabilities
- Acts as an abstraction layer between MCP tools and actual operations
- Enables flexible implementation approaches
Core Components
Abilities Registry (Abilities.php)
- Centralizes LearnPress ability registration
- Bridges WordPress Abilities API with LearnPress operations
- Enables ability discovery for the MCP server
- Provides MCP alias route at
/wp-json/lp/v1/mcp
API Key Authenticator (ApiKeyAuthenticator.php)
- Handles LearnPress MCP API key authentication
- Validates credentials from query parameters or Basic auth
- Enforces permission scopes (
read,write,read_write) - Updates usage metrics for authenticated requests
API Keys Repository (ApiKeysRepository.php)
- Manages API key persistence and lifecycle
- Handles key creation, regeneration, and revocation
- Stores hashed credentials securely
- Tracks usage statistics (last access, call count)
Ability Schemas (AbilitySchemas.php)
- Defines JSON schemas for all ability inputs and outputs
- Provides structured data validation
- Documents expected parameters and response formats
Ability Executors (AbilityExecutors.php)
- Implements execution logic for each registered ability
- Queries LearnPress database and APIs
- Formats responses according to defined schemas
Implementation Approach
LearnPress abilities are implemented using direct database queries and WordPress APIs rather than REST endpoint proxying. This approach provides:
- Optimized performance for LMS-specific operations
- Direct access to LearnPress data models
- Consistent permission checking through WordPress capabilities
- Flexible query filtering and pagination
5. Enabling MCP Integration
Admin Interface
- Navigate to LearnPress → Settings → Advanced
- Scroll to the AI / MCP Integration section
- Check Enable MCP Integration
- Click Save Changes
Programmatically
update_option( 'learn_press_enable_mcp_integration', 'yes' );
WP-CLI
wp option update learn_press_enable_mcp_integration yes
6. Authentication and Security
API Key Management
LearnPress uses its own API key system for MCP authentication. To manage API keys:
- Navigate to LearnPress → Settings → Advanced → MCP API Keys
- Click Add Key
- Select the user who will own the key
- Enter a description (for example, Claude Desktop Integration)
- Choose permissions:
read– Allow read-only operationswrite– Allow write operations (reserved for future use)read_write– Allow all operations
- Click Generate API Key
- Copy and securely store the consumer key and secret (shown only once)
API Key Format
- Consumer Key:
ck_followed by 40 hexadecimal characters - Consumer Secret:
cs_followed by 40 hexadecimal characters
Authentication Methods
Query Parameters
GET /wp-json/lp/v1/mcp?consumer_key=ck_xxx&consumer_secret=cs_xxx
HTTP Basic Authentication
Authorization: Basic base64(consumer_key:consumer_secret)
Permission Validation
readpermissions: Allow all read-only abilitieswritepermissions: Reserved for future write operationsread_writepermissions: Allow all operations
Additionally, the authenticated user must have the manage_options capability (customizable via filter).
Security Best Practices
- Generate separate API keys for each integration or team member
- Use descriptive names to identify key purposes
- Rotate keys regularly using the regenerate function
- Revoke unused or compromised keys immediately
- Monitor key usage through the admin interface (last access, call count)
- Use HTTPS in production environments
7. Server Endpoints
The LearnPress MCP server is available at two endpoints:
Primary Endpoint
https://yoursite.com/wp-json/mcp/mcp-adapter-default-server
LearnPress Alias Endpoint
https://yoursite.com/wp-json/lp/v1/mcp
Both endpoints provide identical functionality. The alias endpoint is provided for convenience and clearer identification of LearnPress-specific integrations.
8. Connecting to the MCP Server
Proxy Architecture
The current MCP implementation uses a local proxy approach to connect MCP clients with WordPress servers:
- MCP Clients (like Claude Desktop) communicate using the MCP protocol over stdio/JSON-RPC
- Local Proxy (
@automattic/mcp-wordpress-remote) runs on your machine and translates MCP protocol messages to HTTP requests - WordPress MCP Server receives HTTP requests and processes them through the WordPress Abilities system
This proxy pattern is commonly used in MCP integrations to bridge protocol differences and handle authentication.
Claude Desktop Integration
To connect Claude Desktop to your LearnPress MCP server:
- Go to LearnPress → Settings → Advanced → MCP API Keys
- Create a new API key with Read or Read/Write permissions
- Copy the consumer key and secret
- Configure MCP using Claude Desktop:
claude mcp add learnpress_mcp \
--env WP_API_URL=https://yoursite.com/wp-json/lp/v1/mcp \
--env CUSTOM_HEADERS='{"Authorization": "Basic BASE64_ENCODED_CREDENTIALS"}' \
-- npx -y @automattic/mcp-wordpress-remote@latest
Replace BASE64_ENCODED_CREDENTIALS with the base64-encoded value of consumer_key:consumer_secret.
Manual MCP Client Configuration
For other MCP clients, add this configuration to your MCP settings:
{
"mcpServers": {
"learnpress_mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@automattic/mcp-wordpress-remote@latest"
],
"env": {
"WP_API_URL": "https://yoursite.com/wp-json/lp/v1/mcp",
"CUSTOM_HEADERS": "{\"Authorization\": \"Basic BASE64_ENCODED_CREDENTIALS\"}"
}
}
}
}
Important: Replace BASE64_ENCODED_CREDENTIALS with your actual base64-encoded credentials (consumer_key:consumer_secret).
To generate the base64 value:
echo -n "ck_your_key:cs_your_secret" | base64
9. Available Abilities
learnpress/get-courses
List courses with optional filters and pagination.
Input Parameters:
status(string|array|null): Filter by post status (publish, draft, etc.)category(integer): Filter by category IDinstructor(integer): Filter by instructor user IDprice_min(number): Minimum price filterprice_max(number): Maximum price filtersearch(string): Search keywordpage(integer): Page number (default: 1)per_page(integer): Items per page (default: 10, max: 100)
Output:
{
"items": [
{
"course_id": 123,
"title": "Introduction to WordPress",
"status": "publish",
"price": 49.99,
"duration": "4 weeks",
"permalink": "https://yoursite.com/courses/intro-wordpress",
"instructor": {
"id": 1,
"name": "John Doe"
},
"categories": ["Web Development", "WordPress"]
}
],
"pagination": {
"page": 1,
"per_page": 10,
"total_items": 25,
"total_pages": 3
}
}
learnpress/get-course-details
Get detailed information about a specific course including curriculum summary.
Input Parameters:
course_id(integer, required): Course ID
Output:
{
"course": {
"course_id": 123,
"title": "Introduction to WordPress",
"content": "Full course description...",
"status": "publish",
"price": 49.99,
"duration": "4 weeks",
"sections": [
{
"section_id": 1,
"title": "Getting Started",
"items": [
{
"item_id": 10,
"type": "lp_lesson",
"title": "Welcome to the Course"
}
]
}
]
}
}
learnpress/list-lessons
List lessons in a course with optional section filtering.
Input Parameters:
course_id(integer, required): Course IDsection_id(integer): Filter by section IDstatus(string|array|null): Filter by post statuspage(integer): Page number (default: 1)per_page(integer): Items per page (default: 10, max: 100)
learnpress/get-lesson-details
Get detailed lesson information including content, video intro, and materials.
Input Parameters:
lesson_id(integer, required): Lesson ID
learnpress/list-quizzes
List quizzes in a course with pagination.
Input Parameters:
course_id(integer, required): Course IDpage(integer): Page number (default: 1)per_page(integer): Items per page (default: 10, max: 100)
learnpress/get-quiz-details
Get detailed quiz information including duration, passing grade, and question count.
Input Parameters:
quiz_id(integer, required): Quiz ID
learnpress/get-student-progress
Get user progress and results for a course enrollment.
Input Parameters:
user_id(integer, required): Student user IDcourse_id(integer, required): Course ID
Output:
{
"progress": {
"user_id": 5,
"course_id": 123,
"status": "enrolled",
"completion_percentage": 65,
"items_completed": 13,
"items_total": 20,
"start_date": "2024-01-15",
"results": {
"grade": 85.5,
"passed": true
}
}
}
learnpress/get-enrollments
List course enrollments with optional filters and pagination.
Input Parameters:
course_id(integer): Filter by course IDuser_id(integer): Filter by user IDstatus(string|array|null): Filter by enrollment statuspage(integer): Page number (default: 1)per_page(integer): Items per page (default: 10, max: 100)
10. Extending MCP Capabilities
Adding Custom Abilities
Third-party plugins can register additional abilities using the WordPress Abilities API. Here’s an example:
add_action( 'wp_abilities_api_init', function() {
wp_register_ability(
'your-plugin/custom-lms-operation',
array(
'label' => __( 'Custom LMS Operation', 'your-plugin' ),
'description' => __( 'Performs a custom LMS operation.', 'your-plugin' ),
'category' => 'learnpress',
'execute_callback' => 'your_custom_ability_handler',
'permission_callback' => function () {
return current_user_can( 'manage_options' );
},
'input_schema' => array(
'type' => 'object',
'properties' => array(
'course_id' => array(
'type' => 'integer',
'description' => 'Course identifier'
)
),
'required' => array( 'course_id' )
),
'output_schema' => array(
'type' => 'object',
'properties' => array(
'success' => array(
'type' => 'boolean',
'description' => 'Operation result'
)
)
),
'meta' => array(
'annotations' => array(
'readonly' => true,
'destructive' => false,
'idempotent' => true
),
'mcp' => array(
'public' => true,
'type' => 'tool'
)
)
)
);
});
Customizing Permission Checks
add_filter( 'learn-press/mcp/api-keys/base-capability', function( $capability, $ability_name, $input ) {
if ( $ability_name === 'learnpress/get-student-progress' ) {
return 'view_student_data';
}
return $capability;
}, 10, 3 );
Customizing Required Scopes
add_filter( 'learn-press/mcp/ability-required-scope', function( $scope, $ability_name, $input ) {
if ( $ability_name === 'your-plugin/update-course' ) {
return 'write';
}
return $scope;
}, 10, 3 );
11. Troubleshooting
Common Issues
MCP Server Not Available
- Verify the
enable_mcp_integrationsetting is enabled in LearnPress → Settings → Advanced - Check that WordPress 6.9 or later is installed (required for Abilities API)
- Review WordPress debug logs for initialization errors
Authentication Failures
- Confirm API key format: consumer key starts with
ck_, secret starts withcs_ - Verify API key permissions match operation requirements (
readvsread_write) - Check that the user associated with the API key has
manage_optionscapability - Ensure credentials are properly base64-encoded for Basic auth
Ability Not Found
- Confirm abilities are registered during
wp_abilities_api_inithook - Verify the ability category is set to
learnpress - Check that ability callbacks are accessible and properly defined
WordPress Version Too Old
If you see the admin notice “LearnPress MCP Integration requires WordPress 6.9 or later”, you need to upgrade WordPress to use MCP features.
Debug Logging
Enable LearnPress debug mode to see detailed MCP operation logs:
- Go to LearnPress → Settings → Advanced
- Enable Debug Mode
- Check WordPress
debug.logfor LearnPress MCP entries
12. Important Considerations
- Developer Preview: This feature is in preview status and may change
- Read-Only Phase: Current implementation focuses on read-only operations
- WordPress 6.9+ Required: MCP integration requires WordPress 6.9 or later for Abilities API support
- Production Testing: Thoroughly test before deploying to production
- API Stability: The WordPress Abilities API and MCP adapter are evolving
- Data Privacy: Be mindful of PII exposure when granting API access
13. Related Resources
- WordPress Abilities API Repository
- WordPress MCP Adapter Repository
- Model Context Protocol Specification
- LearnPress Documentation
- mcp-wordpress-remote Troubleshooting
