Setup3 · Create a token

3 · Create a token

The token is the single credential the AI uses. No password is ever shared.

Generate it

  1. Site administration → Server → Web services → Manage tokens.
  2. Click Create token.
  3. Pick the authorised user and the MCP Bridge Service.
  4. Save, then copy the token string.

Test it from the shell

curl "https://YOUR_MOODLE/webservice/rest/server.php\
?wstoken=YOUR_TOKEN\
&wsfunction=core_webservice_get_site_info\
&moodlewsrestformat=json"

A JSON blob with your site name and username means the token works.

Keep it secret. Anyone with the token can act as that user. Store it in an environment variable, never in a committed file.