modal-workspace-mcp
modal-workspace-mcp
A remote MCP bridge that lets GitHub Copilot, Copilot CLI, and other MCP clients use your Modal account for Linux execution, dependency installation, Git operations, GPU jobs, and calls to deployed Modal Functions.
This project is deliberately a bridge, not an IDE or hosted developer workspace.
GitHub Copilot / MCP client
|
| Streamable HTTP MCP + Bearer token
v
https://...modal.run/mcp/
|
v
modal-workspace-mcp gateway
|
+--> Modal Sandbox --> apt / git / curl / uv / pip / GPU / Internet
|
+--> deployed Modal FunctionV1 ツール
sandbox_create— 設定可能なCPU/RAM/GPU、apt/pipパッケージ、ネットワークポリシー、許可リスト登録されたSecretsとVolumesを備えた分離されたSandboxを作成します。sandbox_exec—bash -lcコマンドを実行し、終了コード/stdout/stderrを返します。sandbox_status— Sandboxが実行中かどうかを確認します。sandbox_list— このMCPによって管理されているSandboxを一覧表示します。sandbox_snapshot— SandboxファイルシステムをModal Imageにスナップショットします。sandbox_terminate— Sandboxを終了します。function_call— アプリ/関数名で既にデプロイされたModal Functionを呼び出します。app_get— 指定されたModal AppとダッシュボードURLを解決します。app_list— 公式のmodal app list --jsonCLIサーフェスを通じてModal Appsを一覧表示します。
これがGitHubコンテナのDNS問題を解決する理由
GitHubエージェントはローカルでapt、curl、git clone、またはpipを実行しません。MCP HTTPリクエストをModalエンドポイントに送信するだけです。実際のネットワーク操作とシェル操作はModal Sandbox内で行われます。
1. ゲートウェイトークンを設定する
ローカルでランダムなトークンを生成します:
python -c "import secrets; print(secrets.token_urlsafe(48))"その値を含むmodal-workspace-mcp-authという名前のModal Secretを作成します:
modal secret create modal-workspace-mcp-auth MODAL_WORKSPACE_MCP_TOKEN='<generated-token>'同じゲートウェイSecretは、許可リストなどの非秘密設定も保持できるため、デプロイされたFunctionはそれらを環境変数として受け取ります。
トークンをコミットしないでください。
2. オプション: Sandbox SecretsとVolumesを許可する
MCPはデフォルトで任意のSecret/Volumeマウントを拒否します。必要に応じてゲートウェイFunctionに許可リストを設定してください。
サーバーが解釈する環境変数:
MODAL_WORKSPACE_ALLOWED_SECRETS=github-agent,huggingface-agent
MODAL_WORKSPACE_ALLOWED_VOLUMES=model-cache,workspace-cache
MODAL_WORKSPACE_SANDBOX_APP=modal-workspace-sandboxes
MODAL_WORKSPACE_MAX_OUTPUT_CHARS=120000たとえば、認証情報を個別のModal Secretとして作成します:
modal secret create github-agent GH_TOKEN="$GH_TOKEN"
modal secret create huggingface-agent HF_TOKEN="$HF_TOKEN"その後、それらのSecret名が明示的に許可リストに登録されるようにゲートウェイSecretを更新します(値は引き続き個別のSecretに保持されます):
modal secret create modal-workspace-mcp-auth \
MODAL_WORKSPACE_MCP_TOKEN='<generated-token>' \
MODAL_WORKSPACE_ALLOWED_SECRETS='github-agent,huggingface-agent'3. デプロイ
Modalがローカルで認証された状態で:
uv sync
uv run modal deploy modal_app.pyModalは公開Web Function URLを出力します。MCPエンドポイントはそのURLに/mcp/を加えたものです。
ヘルスチェック:
curl https://YOUR-ENDPOINT.modal.run/healthzMCP Inspectorの場合:
npx @modelcontextprotocol/inspectorStreamable HTTPを使用し、URL:
https://YOUR-ENDPOINT.modal.run/mcp/およびヘッダー:
Authorization: Bearer <generated-token>4. GitHub Copilotクラウドエージェント
対象のGitHubリポジトリで以下のAgents値を設定します:
COPILOT_MCP_MODAL_URL=https://YOUR-ENDPOINT.modal.run
COPILOT_MCP_MODAL_GATEWAY_TOKEN=<generated-token>次に、.mcp.jsonからリポジトリのMCP設定を使用します:
{
"mcpServers": {
"modal-workspace": {
"type": "http",
"url": "${COPILOT_MCP_MODAL_URL}/mcp/",
"headers": {
"Authorization": "Bearer ${COPILOT_MCP_MODAL_GATEWAY_TOKEN}"
},
"tools": [
"sandbox_create",
"sandbox_exec",
"sandbox_status",
"sandbox_list",
"sandbox_snapshot",
"sandbox_terminate",
"function_call",
"app_get",
"app_list"
]
}
}
}GitHub Copilotクラウドエージェントは、リモートHTTP MCPサーバーと、COPILOT_MCP_プレフィックスが付いたAgentsのシークレット/変数の置換をサポートしています。ここではOAuthベースのリモートMCPは意図的に使用されていません。ゲートウェイはBearerトークンを使用します。
4A. GitHub Copilotプラグインとしてインストールする
このリポジトリは小さなCopilotプラグインマーケットプレイスでもあります。GitHubで公開した後、対象リポジトリはexamples/github-copilot-settings.jsonのテンプレートを使用して、.github/copilot/settings.jsonでプラグインを有効にできます:
{
"enabledPlugins": {
"modal-workspace@modal-workspace-mcp": true
},
"extraKnownMarketplaces": {
"modal-workspace-mcp": {
"source": {
"source": "github",
"repo": "xiaoqianran/modal-workspace-mcp"
}
}
}
}マーケットプレイスのエントリはplugins/modal-workspace/を指しており、その.mcp.jsonはCopilotをデプロイされたModal HTTP MCPエンドポイントに接続します。最初のデバッグでは、プラグインインストールをテストする前に、同じリモートMCPをリポジトリのCopilot MCP設定で直接構成することもできます。
5. 最初のエンドツーエンドテスト
Copilotに以下と同等のことを依頼します:
1. Call sandbox_create with timeout_seconds=1800.
2. Call sandbox_exec on the returned sandbox_id with:
apt-get update && apt-get install -y ffmpeg && git --version && curl -I https://github.com
3. Return the exit code and the last part of stdout/stderr.
4. Call sandbox_terminate.より強力なテスト:
Create a Modal Sandbox, clone a public GitHub repository into /root/repo,
install its dependencies, run its tests, report results, then terminate the Sandbox.
Do not use the local GitHub agent shell for network operations.セキュリティモデル
HTTP MCPエンドポイントはBearerトークンを必要とします。
Sandbox SecretとVolumeのマウントはデフォルト拒否で、許可リストベースです。
Secretの値がMCPツール引数として受け入れられることは決してありません。
暴走するMCPレスポンスを避けるため、出力は切り詰められます。
Sandboxは専用のModal Appの下でタグ付けされ、分離されます。
破壊的操作はSandbox内に留めてください。
広範な個人トークンではなく、最小限のリポジトリ権限を持つ専用のGitHubトークンを優先してください。
ローカル検証
リポジトリには依存関係のないヘルパーテストが含まれています:
python -m unittest discover -s tests -v
python -m compileall modal_workspace_mcp modal_app.py完全なMCP/Modal統合テストには、インターネットアクセスと認証済みのModalアカウントが必要です。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Remote MCP for Gemini upgrade evals, prompt regressions, output diffs, and eval receipts.
Remote MCP for GenAI span mapping, provider normalization, dashboard schemas, and receipts.
Remote MCP server for RunComfy Serverless API (ComfyUI): deployments and async inference.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/xiaoqianran/modal-workspace-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server