labbench

labbench

Enables Claude Code to browse coursework, manage user workspaces, run sandboxed tests, post hints, and assign new projects in LabBench.

Category
访问服务器

README

🧪 LabBench

A personal platform for learning ML & systems by building — host entire courses (CS336-style problem sets), write multi-file solutions in the browser, run tests in sandboxes with arbitrary machine types, and get help from Claude both in-site and from Claude Code over MCP.

What it does

  • Problem-set style problems — each problem has a multi-part markdown statement (KaTeX math supported) in a sidebar, closer to a pset than a LeetCode prompt. Courses are just directories of markdown + yaml in content/ (see content/README.md).
  • Multi-file editor — Monaco-based workspace on the right: create/delete files, autosave, Cmd/Ctrl+S. Python + PyTorch out of the box; the runner itself is language-agnostic (anything the sandbox image can execute).
  • Sandboxed test runs — hit Run tests and the platform executes the problem's run_tests.py against your files in a sandbox and renders per-case results + logs in the sidebar. Two backends:
    • local: subprocess on the server (dev, stdlib-only problems)
    • modal: Modal Sandboxes with per-problem machine specs — image, cpu, memory, GPUs (T4…H100), and pip packages like torch
  • Google login, allowlist-only — only emails in ALLOWED_EMAILS can sign in.
  • One shared MCP endpoint (/api/mcp) for Claude Code:
    tool what it does
    list_problems / get_problem browse all coursework
    get_workspace / get_run read your current files, runs, logs
    run_tests kick off a sandbox run
    post_hint drop a hint into the problem's chat sidebar
    assign_task assign you a brand-new project (statement + starter + tests), shows up under "Assigned by Claude"
  • In-site tutor chat — per-problem Claude chat that sees the statement, your files, and your latest test run. MCP hints land in the same thread.

Setup

npm install
cp .env.example .env   # then fill it in
npx prisma db push     # create tables
npm run dev

You need:

  1. Postgres — any DATABASE_URL (Neon / Supabase / Vercel Postgres / local).
  2. Google OAuth — create an OAuth client at console.cloud.google.com/apis/credentials, authorized redirect URI https://<your-domain>/api/auth/callback/google (or http://localhost:3000/... for dev). Put the id/secret in AUTH_GOOGLE_ID / AUTH_GOOGLE_SECRET, and set AUTH_SECRET (openssl rand -base64 32).
  3. ALLOWED_EMAILS — your email. Nobody else can log in.

Optional:

  1. Anthropic — ANTHROPIC_API_KEY enables the in-site tutor chat.
  2. Modal — MODAL_TOKEN_ID/MODAL_TOKEN_SECRET (from modal.com/settings/tokens) enables cloud sandboxes with GPUs and pip installs. With RUNNER_BACKEND=auto, problems run on Modal when it's configured and locally otherwise; per-problem machine.backend overrides.
  3. MCP_TOKEN — openssl rand -hex 32; required for the MCP endpoint.

Deploying (Vercel)

Push this repo, import into Vercel, set the env vars above. npm run build runs prisma generate automatically; run npx prisma db push against your production DB once. The MCP endpoint and OAuth need the public URL, so set the Google redirect URI accordingly.

Connecting Claude Code (MCP)

claude mcp add --transport http labbench https://<your-domain>/api/mcp \
  --header "Authorization: Bearer <MCP_TOKEN>"

Then, in any Claude Code session:

  • "Look at my workspace for cs336-mini/micrograd and give me a hint about the failing test" → Claude uses get_workspace/get_run, posts via post_hint.
  • "Assign me a small project about building a compiler" → Claude uses assign_task; the task appears on your dashboard under Assigned by Claude, complete with starter files and tests.

The MCP server acts on behalf of the first email in ALLOWED_EMAILS (sign in once on the site before using MCP so the user row exists).

Authoring courses

See content/README.md. Short version:

content/courses/<course>/course.yaml
content/courses/<course>/problems/<slug>/{problem.yaml,statement.md,starter/,tests/}

tests/run_tests.py uses the injected harness:

from labbench import case, run

@case("part (a): thing works")
def test_thing():
    assert thing() == 42

run()

Validate with npm run content:check. The sample course CS336-mini ships three problems: a BPE tokenizer, a micrograd-style autograd engine (both run anywhere, stdlib-only), and attention-from-scratch in PyTorch (machine spec installs torch; give it a GPU by editing problem.yaml).

Architecture notes

  • Next.js 15 App Router + Prisma/Postgres + NextAuth v5 (Google, JWT sessions).
  • File-based content is read fresh from disk per request — edit markdown, refresh. DB-backed problems (from assign_task) merge into the same catalog under the virtual assigned course.
  • Runs: POST /api/runs snapshots your files into a Run row, executes via next/server after() (works on Vercel), client polls GET /api/runs/:id. Test files are copied into the sandbox after user files, so tests can't be overwritten; they're never exposed in the UI or over MCP.
  • The results protocol is one marker line of JSON printed by the harness — language-agnostic, so future non-Python runners only need to print the same line.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选