eClass MCP Server

by sdi2200262
Verified

Integrations

  • Uses .env files to store sensitive authentication credentials for eClass, maintaining them securely outside of version control

  • Hosts the project repository for version control and distribution of the eClass MCP server code

  • Built with Python, providing a foundation for the MCP server implementation that handles authentication and interactions with eClass

eClass MCP サーバー

特徴

  • 認証: UoAのCAS SSO認証システムを通じてeClassにログインします。
  • コース管理: 登録したコースのリストを取得する
  • セッション管理: ツール呼び出し間の認証されたセッションを維持する
  • ステータスチェック: 認証ステータスを確認する

プロジェクト構造

このプロジェクトは、保守性を向上させるためにモジュール式アーキテクチャを採用しています。

eclass-mcp-server/ ├── run_server.py # Entry point script for running the server ├── pyproject.toml # Project configuration and dependencies ├── .env # Environment variables (create from example.env) ├── src/ └── eclass_mcp_server/ # Main package ├── __init__.py # Package initialization ├── server.py # Core server implementation and tool handlers ├── authentication.py # Authentication functionality ├── course_management.py # Course-related functionality ├── html_parsing.py # HTML parsing utilities └── test/ # Test scripts for functionality verification ├── __init__.py ├── test_login.py ├── test_courses.py └── run_all_tests.py

インストール

UV を使用してサーバーをインストールします (推奨):

# Clone the repository git clone https://github.com/yourusername/eClass-MCP-server.git cd eClass-MCP-server # Install dependencies uv sync --dev --all-extras

あるいは、pip を使用してインストールします。

pip install -e .

構成

次の構成でルート ディレクトリに.envファイルを作成します (または、提供されているexample.envファイルをコピーして名前を変更します)。

ECLASS_URL=https://eclass.uoa.gr ECLASS_USERNAME=your_username ECLASS_PASSWORD=your_password

すべての資格情報は.envファイルで提供する必要があります。サーバーは資格情報をパラメータとして受け入れません。

使用法

ターミナル

エントリ ポイント スクリプトを使用してサーバーを実行します。

python run_server.py

またはモジュールとして:

python -m src.eclass_mcp_server.server

カーソル

「設定」→「MCP」に移動し、 Add new MCP serverをクリックします。

  • エージェントがサーバーの用途を認識できるように、一意かつ適切な名前を選択します(例:「eClass Server」)
  • 「タイプ」のcommandオプションを選択します
  • コマンド入力に以下を追加します: python /path/to/eclass-mcp-server/run_server.py

このコマンドは、MCP クライアントをserver.pyのメイン サーバー エントリ ポイントに接続するrun_server.pyスクリプトを実行します。

クロードデスクトップ

Claude Desktop で使用するには:

  1. クロードデスクトップを開く
  2. 設定 > サーバーに移動
  3. 次の詳細で新しいサーバーを追加します。
    • 名前: eClass MCP
    • コマンド: run_server.py スクリプトへのパス
  4. サーバーの追加をクリック
  5. クロードとチャットするときにドロップダウンからサーバーを選択してください

ツール

サーバーは、MCP クライアントで使用するための次のツールを提供します。

ログイン

SSO 認証を使用して eClass にログインします。

{ "random_string": "any_value" }

コースを取得する

登録済みのコースのリストを取得します (最初にログインする必要があります)。

{ "random_string": "any_value" }

ログアウト

eClass からログアウトします。

{ "random_string": "any_value" }

認証ステータス

現在の認証ステータスを確認します。

{ "random_string": "any_value" }

テスト

このプロジェクトには、機能性を検証するためのテスト スクリプトが含まれています。

# Run all tests python -m src.eclass_mcp_server.test.run_all_tests # Run specific tests python -m src.eclass_mcp_server.test.test_login python -m src.eclass_mcp_server.test.test_courses

MCPクライアントの使用例

from mcp import ClientSession, StdioServerParameters from mcp.client.stdio import stdio_client import asyncio async def run_agent(): server_params = StdioServerParameters( command="python /path/to/eclass-mcp-server/run_server.py", ) async with stdio_client(server_params) as (read, write): async with ClientSession(read, write) as session: # Initialize the session await session.initialize() # Login to eClass login_result = await session.call_tool("login", { "random_string": "dummy" }) print(login_result) # Get courses courses_result = await session.call_tool("get_courses", { "random_string": "dummy" }) print(courses_result) # Logout logout_result = await session.call_tool("logout", { "random_string": "dummy" }) print(logout_result) if __name__ == "__main__": asyncio.run(run_agent())

AIエージェントとの統合

このMCPサーバーは、モデルコンテキストプロトコルをサポートするAIエージェントと連携して使用するように設計されています。これにより、AIシステムはeClassと直接やり取りできるようになり、以下のような機能を実現できます。

  • コース情報の取得
  • コースのお知らせを確認する
  • コース教材へのアクセス
  • 課題の提出(将来の機能)

セキュリティに関する考慮事項

  • サーバーは機密性の高い認証資格情報を処理します
  • 認証情報は認証にのみ使用され、永続的に保存されることはありません
  • セッションクッキーはサーバーのライフサイクル中にメモリ内に保持されます
  • サーバーは操作を実行する前にセッション状態を検証します
  • 資格情報を含む.envファイルはバージョン管理にコミットしないでください (.gitignore に含まれています)

ライセンス

MITライセンス

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

AI エージェントが Open eClass プラットフォーム インスタンスを認証して対話できるようにする MCP サーバー。コース情報を取得して基本的なプラットフォーム操作を実行するための UoA の SSO 認証システムをサポートします。

  1. Features
    1. Project Structure
      1. Installation
        1. Configuration
          1. Usage
            1. Terminal
            2. Cursor
            3. Claude Desktop
          2. Tools
            1. login
            2. get_courses
            3. logout
            4. authstatus
          3. Testing
            1. Example MCP Client Usage
              1. Integration with AI Agents
                1. Security Considerations
                  1. License
                    1. Contributing
                      ID: 577tzz09hi