kntu-moodle-mcp
# kntu-moodle-mcp
MCP server + Claude Code skills for the KNTU Moodle (**https://mdl.kntu.net.ua**), acting as the
signed-in **student**. See [ARCHITECTURE.md](ARCHITECTURE.md) for the design.
**Status: Phase 0.** Skeleton, sign-in from `secrets.yaml` (with automatic re-login), `auth_status` / `login` / `logout` / `whoami` tools, and the `moodle:login` skill.
## Setup
```bash
npm install
npm run build
node plugins/tooling/skills/sync-secrets/sync.mjs # creates secrets.yaml; fill in the empty values (quoted)
node dist/index.js login # optional check: signs in from ./secrets.yaml and stores the token
node dist/index.js status
```
With the project `.mcp.json` (`MOODLE_SECRETS_FILE=secrets.yaml`), the server signs in by itself,
on the `login` tool or automatically when the token is missing or expired. The token is cached in
`~/.kntu-moodle-mcp/tokens.json` (override with `MOODLE_HOME`).
`secrets.yaml` is gitignored. Signing in always uses it: there is no password prompt and no token override.
## Use with Claude Code
Skills ship as project-local **plugins** (`plugins/moodle`, `plugins/github`, `plugins/tooling`), registered in
`.claude/settings.json`. When you open the folder and trust it, Claude Code offers to install them. If it doesn't:
```bash
claude plugin marketplace add ./ --scope project
claude plugin install moodle@kntu-moodle-mcp --scope project # likewise github, tooling
```
Skills then appear as `/moodle:login`, `/tooling:sync-secrets`, …
The project ships a `.mcp.json` that registers the server as `kntu-moodle` (run `npm run build` first).
Open the folder in Claude Code and approve the server. Tools appear as `mcp__kntu-moodle__<tool>`.
To register it for use from any folder:
```bash
claude mcp add kntu-moodle -s user -- node "<absolute path>/dist/index.js"
```
## Commands
| | |
|---|---|
| `/tooling:verify` | all pre-commit checks (or `node plugins/tooling/skills/verify/verify.mjs`) |
| `/tooling:refresh-plugins` | reload edited plugins into Claude Code's cache, then `/reload-plugins` |
| `npm run build` | bundle to `dist/` |
| `npm test` | unit + in-memory MCP e2e tests |
| `npm run typecheck` | `tsc --noEmit` |
| `npm run manifest` | regenerate `tools.manifest.json` (tool names, kinds, WS functions) |
| `npm run inspect` | open the MCP Inspector against the built server |
## Configuration
See [.env.example](.env.example). The most relevant settings are `MOODLE_TOOLS` (tool allowlist),
`MOODLE_READ_ONLY`, and `MOODLE_LANG`.
## Contributing
- `npm install` also installs the git hooks (`core.hooksPath` → `.githooks`). Nothing can be committed on or pushed to
`main`/`develop`, and a push only goes through when every check in `npm run verify` passes.
- Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/): `feat(scope): subject`.
- Flow: branch from `develop` → PR into `develop` → releases are PRs `develop` → `main`. Maintainers merge.
- Style: Biome (`npm run format`, `npm run lint`).
## License
[MIT](LICENSE)
TDQS
Scored across 4 tools
Each tool has a distinct role: auth_status checks token validity, login/logout manage the session, and whoami returns profile data. auth_status and whoami overlap slightly since both reveal sign-in state, but the descriptions make the boundary clear (status check vs. full profile).
Names mix conventions: `auth_status` is a namespaced snake_case identifier, `login`/`logout` are bare verbs, and `whoami` is a Unix-ism with no verb_noun structure. The set is still readable and each name is intuitive, but there is no predictable pattern an agent can extrapolate.
Four tools is thin for a server branded as a full Moodle integration, though it is reasonable if the scope is deliberately auth-only. No tool feels redundant, so the count is borderline rather than excessive or trivial.
The auth lifecycle (status, login, logout, identity) is fully covered with no dead ends, but the Moodle domain itself is untouched — no course listing, assignments, grades, deadlines, or content access. An agent asked to do anything academic with Moodle would immediately fail.