usos.core:main— CLI entry (uv run server,uvx usos-mcp,python -m usos).usos.core:get_mcp— factory used byfastmcp.jsonfor FastMCP tooling.src/usos/__main__.pyimports fromcoreand works (not a stub).
- Python
>=3.14. Uses uv (uv sync,uv sync --frozen --no-dev). - Runtime deps:
fastmcp,pydantic,pydantic-settings,dotenv,requests,requests-oauthlib. .envrequired locally. Two independent env-prefix groups:FAST_MCP_*— transport (stdio/http/sse/streamable-http), host, port.USOS_API_*—CONSUMER_KEY,CONSUMER_SECRET,BASE_URL,OAUTH_TOKEN,OAUTH_TOKEN_SECRET.
- Runs tests via pytest under
tests/(test_auth.py,test_schedule.py,test_utils.py,test_groups.py).
src/usos/main package. Modular registry pattern.core.py: BootstrapsFastMCPwith aFileSystemProviderthat scanssrc/usosfor@tool,@prompt, and@resourcedecorators.models.py:ServerSettings(pydantic-settings,FAST_MCP_prefix).- Domain packages (
auth/,schedule/,grades/,groups/,courses/,lecturer/) each own theirtools.py,prompts.py,resources.py,models.py,utils.py. auth/— OAuth 1.0a setup (login,check_login,logout),authenticate_meprompt,usos://universities/supportedresource.schedule/— Timetable and calendar tools (get_schedule,get_faculties,get_days_off,get_exam_session_dates).grades/— Fetch student grades (get_grades) and calculate ECTS-weighted GPA (get_gpa).groups/— Fetch student class groups (get_student_groups) and group participants (get_group_participants).- Auth utils (
get_authenticated_session) provides the signed OAuth1Session reused by other packages. UsesUSOSAuthSettings(env prefixUSOS_API_). - Old root
server.pyremoved.
services/tt/student: max 7 days per request.services/calendar/search: max 30 days per request (batching built intofetch_calendar_events).calendar/searchis marked BETA in USOS docs.- Faculty auto-resolution (
resolve_faculty_id) works only when exactly one faculty is found; otherwise raisesMultipleFacultiesError. - Term auto-resolution picks the first active term from
services/terms/terms_index. get_gpaexcludes non-numeric grade symbols (e.g.,ZAL,NZAL,NK) and requires ECTS details fetched fromservices/courses/user_ects_points.- All grade retrieval tools require the user token to have the
gradesOAuth scope.
- PyPI:
uv build && uv publish(triggered on main branch push). Token viaUV_PUBLISH_TOKEN. - Docker: GHCR
ghcr.io/skalskidaniel/usos-mcp(triggered on main + semver tags). Stdio transport default. - Docker entrypoint:
python -m usoswithFAST_MCP_TRANSPORT=stdio. - Production end-user install:
uvx usos-mcp.