moodle-openapi-server

TrinityWestern/moodle-openapi-server

3.2

If you are the rightful owner of moodle-openapi-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

An MCP server that integrates with Moodle to manage educational resources and provides a REST API adhering to the OpenAPI specification.

Moodle OpenAPI server

moodle-openapi-server

A server that provides a REST API for the Moodle platform, aligned with the OpenAPI spec.

Techstack

This project uses latest tech and steps on the shoulders of giants:

  • hono for the rest api
  • bun for javascript runtime
  • docker for the container
  • typescript for the programming language
  • zod for the schema validation
  • tsx for the script runner
  • vitest for the testing

Environment Variables

The following environment variables are required to run the server:

MOODLE_BASE_URL=https://your.moodle.url
MOODLE_WSTOKEN=yourtoken
# Example: USERS=user1:password1,user2:password2
USERS=admin:admin,teacher:teacher
  • MOODLE_BASE_URL: The base URL of your Moodle instance (e.g., https://learn.twu.ca)
  • MOODLE_WSTOKEN: The web service token for your Moodle user
  • USERS: Comma-separated list of username:password pairs for basic authentication (e.g., admin:admin,teacher:teacher)

Development

you should start your local moodle server before running the test.

you can also connect to a remote moodle server by setting the MOODLE_BASE_URL environment variables.

[!NOTE] you need to create a ws token for the external service. see for more details. However, you don't need to set the MOODLE_WSTOKEN environment variable to run the docker image.

git pull
pnpm install 
# start the API server 
pnpm run dev
# build the code 
pnpm run build 
# start the API server 
pnpm run start
# build the docker image 
pnpm run build:docker
# run the docker image 
docker run \
  -e MOODLE_BASE_URL=https://your.moodle.url \
  -e USERS=admin:admin,teacher:teacher \
  -p 3000:3000 \
  moodle-openapi-server

for example

docker run \
  -e MOODLE_BASE_URL=https://learn.twu.ca \
  -e USERS=admin:admin,teacher:teacher \
  -p 3000:3000 \
  moodle-openapi-server

License

This project is licensed under the MIT License. See the LICENSE file for details.

This project is created and maintained by Yeung Man Lung Ken (manlung.yeung@twu.ca). It would be nice if you can give me a shoutout and star the repo if you like it.