Skip to main content
Glama

af-jupyterlab-mcp

MCP 服务器,让 AF 用户能够在 UChicago ATLAS Analysis Facility Kubernetes 集群上创建、检查和删除他们自己的每用户 JupyterLab 服务器——与 af-portal 今天部署的笔记本相同,以工具形式暴露给 LLM。

架构

LLM <--MCP/HTTP--> af-jupyterlab-mcp <--k8s API--> notebook namespace (Pod/Service/Secret/Ingress)
                         ^
                         | Authorization: Bearer <broker-issued JWT>
                         |
              af-mcp-platform credential broker

第一阶段(本仓库,当前)提供六个工具,管理笔记本的 Pod/Service/Secret/Ingress 四元组,从 af-portal 的 portal/jupyterlab.py 及其四个 Jinja 模板移植而来。第二阶段(已跟踪,尚未构建)添加一个类型化代理,指向笔记本内部运行的 Datalayer jupyter-mcp-server——参见 maniaclab/af-mcp-platform#189。

Related MCP server: rucio-mcp

项目布局

src/af_jupyterlab_mcp/
├── cli.py               # argparse: `af-jupyterlab-mcp serve` (HTTP only)
├── config.py            # env-driven Settings: namespace, domain, image allowlist, quotas
├── server.py            # FastMCP setup, lifespan (k8s client + broker verifier), tool registration
├── auth/
│   └── broker.py        # extract_bearer(), get_broker_claims() -- broker-issued JWT verification
├── k8s/
│   ├── errors.py         # GuardrailError, NameConflictError, NotFoundOrNotYoursError, ...
│   ├── guardrails.py     # CPU/memory/duration range + image allowlist validation
│   ├── names.py          # sanitize_k8s_pod_name, name availability, name generation
│   ├── templates.py      # Jinja rendering of the four ported manifests
│   ├── notebooks.py      # create/get/list/delete notebook (ported portal logic)
│   ├── gpu.py            # get_gpu_availability (ported portal logic)
│   └── templates/        # pod.yaml.j2, service.yaml.j2, secret.yaml.j2, ingress.yaml.j2
│                          # (ported verbatim from af-portal/portal/templates/jupyterlab/)
└── tools/
    └── jupyterlab.py     # the six @mcp.tool() functions

工具表面

  • create_jupyter_server

  • list_jupyter_servers

  • get_jupyter_server

  • delete_jupyter_server

  • get_gpu_availability

  • list_supported_images

每个服务器的所有者始终是来自已验证的 broker JWT 的 claims.unixname——没有工具接受所有者/用户名参数。

构建和测试命令

pixi run test          # quick tests
pixi run lint          # pre-commit + pylint
pixi run helm-lint      # lint + smoke-render the Helm chart

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      C
      maintenance
      An MCP server that enables LLMs to execute Python code on GPU-accelerated compute nodes within SLURM-managed HPC environments. It bridges local clients to remote clusters by launching JupyterLab sessions via SLURM jobs to facilitate high-performance notebook-based computation.
      7
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that exposes Rucio distributed data management operations as tools for LLMs. Designed for ATLAS physicists working with grid data on analysis facilities, but usable with any Rucio instance.
      29 PyPI
      6
      Apache 2.0
    • A
      license
      A
      quality
      D
      maintenance
      Enables code execution in isolated Docker containers with persistent IPython, Node.js, or R kernels, supporting file import/export and cross-session transfers via MCP tools.
      6
      MIT