Skip to main content
Glama

METU SAIS API & MCP Server

一个面向中东技术大学(METU / ODTÜ)学生事务信息系统(SAIS / student.mete.edu.tr)的现代 Model Context Protocol (MCP) 服务器和 FastAPI 服务。

通过真实身份验证和结构化数据解析,将你的 AI 助手(如 OpenCodeClaude DesktopCursor)直接连接到 METU SAIS。


功能特性

  • SSO 身份验证:处理真实的 METU SSO 登录流程(/ssO/backend/request/user/signin)和会话令牌验证。

  • 代理抓取器与 HTML 解析器:自动建立经过身份验证的代理会话(/pxoxy/Student_Information/),并将学生记录解析为结构化 JSON。

  • MCP 服务器(MCP 2.x SDK):通过标准 I/O(stdio)提供类型化工具。

  • FastAPI REST 服务:面向集成的备选 HTTP REST 后端。

  • 隐私与安全:零凭据记录或泄露。凭据保留在本地且已被 git 忽略的 .env 文件中。


Related MCP server: SABIS MCP Server

可用的 MCP 工具

工具

描述

get_student_info

获取学生 ID、姓名、院系、学期、GPA/CGPA、学业状态和导师信息。

get_schedule

获取每周课程表(星期、时间、课程代码、课程名称、教室、授课教师)。

get_transcript

获取所有学期的学业成绩单,包含课程、学分、成绩和学期 GPA 统计。

get_announcements

获取门户中的当前公告。

create_connection

创建一条内存连接记录。

list_connections

列出所有已保存的连接记录。


安装与设置

1. 环境要求

  • Python >= 3.11

  • uv(推荐)或 pip

2. 安装依赖

# Using uv (recommended)
uv sync

# Or using pip
pip install -e .

3. 配置凭据

.env.example 复制为 .env,然后输入你的 METU 凭据:

cp .env.example .env

编辑 .env

SAIS_USERNAME=your_metu_username
SAIS_PASSWORD=your_metu_password
LOCALE=tr
PORT=8300

\系统!NOTE] .env 已列入 .gitignore,永远不会被提交。


使用 OpenCode

本仓库已包含一个 opencode.json

项目级使用

在此仓库内启动 OpenCode 时:

opencode

OpenCode 将自动连接到 metu-sais MCP 服务器。

全局使用(任意目录)

要在 OpenCode 中跨任意项目使用 METU SAIS 工具,请将服务器添加到 ~/.config/opencode/opencode.jsonc

{
  "mcp": {
    "metu-sais": {
      "type": "local",
      "command": [
        "uv",
        "--directory",
        "/absolute/path/to/metu-sais-mcp",
        "run",
        "metu-sais-mcp"
      ],
      "enabled": true
    }
  }
}

验证连接

opencode mcp list

你应该会看到:

●  ✓ metu-sais connected

独立运行 MCP 服务器

你可以直接通过标准 I/O 运行 MCP 服务器:

uv run metu-sais-mcp

运行 REST API

要启动 FastAPI 服务器:

uv run uvicorn api.main:app --port 8300 --reload

交互式 API 文档可通过以下地址访问:

REST 端点

  • GET /api/sais/info — 学生信息

  • GET /api/sais/schedule — 课程表

  • GET /api/sais/transcript — 成绩单历史

  • GET /api/sais/announcements — 门户公告

  • GET|POST|PUT|DELETE /api/connections — 连接管理 CRUD


测试

使用 pytest 运行自动化测试套件:

uv run pytest -v

测试套件包括:

  • 针对 HTML 解析器的单元测试(parse_student_infoparse_scheduleparse_transcriptparse_announcements)。

  • MCP 工具注册与工具调用测试。

  • FastAPI REST 端点测试。

  • 在配置了凭据时,针对 METU SAIS 的实时集成测试。


项目结构

├── sais/
│   ├── connector.py      # Core SAIS authentication, proxy scraping, and HTML parsers
│   └── connections.py    # Shared in-memory connection store
├── sais_mcp/
│   └── server.py         # MCP stdio server definition and tool registrations
├── api/
│   └── main.py           # FastAPI REST API wrapper
├── tests/
│   ├── test_connector.py # Scraper and HTML parser tests
│   ├── test_mcp_server.py# MCP server tests
│   └── test_api.py       # FastAPI tests
├── .env.example          # Environment variable template
├── opencode.json         # OpenCode MCP configuration
├── pyproject.toml        # Package dependencies and CLI entrypoints
└── README.md             # Project documentation

许可证

MIT License。

Install Server
F
license - not found
A
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.

  • Connect e-commerce and marketing data to AI assistants via MCP.

  • Your memory, everywhere AI goes. Build knowledge once, access it via MCP anywhere.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/atesahmet0/metu-sais-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server