LearnMCP xAPI
STDIOAI学习活动记录与检索MCP服务器
AI学习活动记录与检索MCP服务器

LearnMCP-xAPI is an open-source MCP (Model Context Protocol) server that enables AI agents to record and retrieve learning activities through xAPI-compliant Learning Record Stores. Unlike traditional educational AI tools that focus on content generation or automated grading, LearnMCP-xAPI creates a bridge between AI interactions and learning analytics, allowing intelligent systems to build contextual understanding of what learners know, practice, and achieve.
This project addresses a fundamental gap in AI-powered education: the ability for AI agents to maintain persistent, structured records of learning progress that can inform future interactions and provide evidence of skill development. Whether you're building AI tutoring systems, personalized learning assistants, or educational analytics platforms, LearnMCP-xAPI provides the infrastructure to make AI interactions learning-aware.
Important Note: LearnMCP-xAPI is designed as a foundational component for educational technology systems. It enables AI agents to participate meaningfully in the learning process by maintaining awareness of student progress, but it does not replace thoughtful pedagogical design or human educational expertise.
Report Bug · Request Feature · Wiki
The current landscape of AI in education is dominated by familiar patterns: pre-made prompts, automated content generation, and the eternal struggle between students wanting AI to do their work and teachers trying to prevent exactly that. This approach treats AI as either a shortcut or an obstacle, missing the transformative potential of intelligent systems that can genuinely support learning.
The inspiration for LearnMCP-xAPI came from observing this fundamental disconnect. Most educational AI tools operate in isolation—they generate responses, create activities, or analyze text, but they don't learn from or contribute to a student's ongoing educational journey. There's no memory of what a student has practiced, struggled with, or mastered. Each interaction starts from zero.
Learning Record Stores (LRS) and the xAPI specification have long provided a solution for capturing and analyzing learning activities, but they've remained largely disconnected from the AI systems that are increasingly central to educational experiences. LearnMCP-xAPI bridges this gap by enabling AI agents to both contribute to and learn from comprehensive learning records.
This approach opens possibilities that go far beyond traditional AI tutoring:
The goal isn't to replace human teachers or traditional learning methods, but to create AI systems that can meaningfully participate in the learning process—understanding context, building on prior knowledge, and contributing to a richer, more personalized educational experience.
LearnMCP-xAPI implements the Model Context Protocol (MCP) to create a seamless connection between AI agents and learning analytics infrastructure. The system operates as a bridge, translating natural language learning interactions into structured xAPI statements while providing AI agents with contextual awareness of student progress.
AI Agent Integration: Through MCP, AI agents gain access to three core learning tools: statement recording, progress retrieval, and activity vocabulary management.
Natural Language Processing: LearnMCP-xAPI enables two complementary approaches to learning activity capture:
xAPI Statement Generation: LearnMCP-xAPI transforms learning activities into xAPI-compliant statements that include the learner (actor), the activity (verb + object), context, and results. These statements conform to educational data standards and can include scores, completion status, and additional metadata.
Learning Record Store Integration: Statements are securely stored in any xAPI 1.0.3 compliant LRS. The system handles authentication, validation, and error recovery automatically.
Contextual Retrieval: AI agents can query learning histories to understand what students have practiced, achieved, or struggled with. This enables responses that build on prior knowledge and address individual learning needs.
Privacy-Preserving Design: Each student receives a unique identifier (ACTOR_UUID) that separates their learning records while maintaining privacy. No personal information is stored—only learning activities and progress indicators.
This architecture enables AI systems to participate in the complete learning cycle: they can understand where students are coming from, contribute meaningful educational interactions, and build evidence of learning progress that benefits both students and educators.
LearnMCP-xAPI follows a modular plugin architecture designed for educational technology integration and extensibility.
Core Components:
Supported Learning Record Stores:
Before starting, ensure you have:
# Clone the repository git clone https://github.com/DavidLMS/learnmcp-xapi.git cd learnmcp-xapi # Install dependencies pip install -r requirements.txt
# Clone the repository git clone https://github.com/DavidLMS/learnmcp-xapi.git cd learnmcp-xapi # Create and activate a virtual environment python -m venv learnmcp-env source learnmcp-env/bin/activate # On Windows: learnmcp-env\Scripts\activate # Install dependencies pip install -r requirements.txt
# Install uv if you don't have it pip install uv # Clone the repository git clone https://github.com/DavidLMS/learnmcp-xapi.git cd learnmcp-xapi # Create and activate a virtual environment uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies uv pip install -r requirements.txt
LearnMCP-xAPI uses a flexible configuration system supporting both environment variables and configuration files.
Copy the example configuration file and customize it for your setup:
cp .env.example .env
Edit the .env file with your LRS plugin selection and student identifier:
# Required: Choose your LRS plugin LRS_PLUGIN=lrsql # Options: lrsql, ralph, veracity # Required: Unique identifier for each student ACTOR_UUID=student-12345-67890-abcdef # LRS SQL Configuration (when LRS_PLUGIN=lrsql) LRSQL_ENDPOINT=http://localhost:8080 LRSQL_KEY=your-api-key LRSQL_SECRET=your-api-secret # Ralph LRS Configuration (when LRS_PLUGIN=ralph) RALPH_ENDPOINT=http://localhost:8100 RALPH_USERNAME=your-username # For Basic Auth RALPH_PASSWORD=your-password # For Basic Auth # OR for OIDC: # RALPH_OIDC_TOKEN_URL=http://keycloak:8080/auth/realms/test/protocol/openid-connect/token # RALPH_OIDC_CLIENT_ID=ralph # RALPH_OIDC_CLIENT_SECRET=secret # Veracity LRS Configuration (when LRS_PLUGIN=veracity) VERACITY_ENDPOINT=https://your-lrs.lrs.io VERACITY_LRS_NAME=mylrs VERACITY_USERNAME=your-access-key-username VERACITY_PASSWORD=your-access-key-password
For more complex deployments, you can use configuration files:
# Create configuration directory structure mkdir -p config/plugins # Create LRS-specific configuration files echo "endpoint: \${LRSQL_ENDPOINT:-http://localhost:8080} key: \${LRSQL_KEY} secret: \${LRSQL_SECRET} timeout: 30 retry_attempts: 3" > config/plugins/lrsql.yaml echo "endpoint: \${RALPH_ENDPOINT:-http://localhost:8100} username: \${RALPH_USERNAME} password: \${RALPH_PASSWORD} oidc_token_url: \${RALPH_OIDC_TOKEN_URL} oidc_client_id: \${RALPH_OIDC_CLIENT_ID} oidc_client_secret: \${RALPH_OIDC_CLIENT_SECRET} timeout: 30 retry_attempts: 3" > config/plugins/ralph.yaml
See .env.example for all available configuration options and plugin-specific settings.
# Start the MCP server python -m learnmcp_xapi.main
You should see a response indicating the server is starting.
LearnMCP-xAPI supports multiple Learning Record Stores through its plugin architecture, making it easy to integrate with your existing educational technology infrastructure.
LearnMCP-xAPI is under active development with planned improvements including:
LearnMCP-xAPI is released under the MIT License. You are free to use, modify, and distribute the code for both commercial and non-commercial purposes.
Contributions to LearnMCP-xAPI are welcome! Whether you're improving the code, enhancing the documentation, or suggesting new features, your input is valuable. Please check out the CONTRIBUTING.md file for guidelines on how to get started and make your contributions count.
We're particularly interested in: