Overview
Use this skill to:
- Discover which MCP servers are available and what they are for.
- Inspect a specific MCP's capabilities without loading all tool schemas.
- Execute TypeScript/JavaScript that calls MCP tools via generated
mcp-clients/* modules.
If no MCP servers are configured, list_mcp_capabilities will respond with an empty list
and a message pointing to skills/mcp-dynamic-orchestrator/mcp.registry.json so the user
can add MCP entries.
This skill reads from mcp.registry.json, so adding an MCP entry there (for example the
Cloudflare MCP) automatically makes it discoverable without changing tool wiring.
Cloudflare MCP example
The Cloudflare MCP server can be configured in mcp.registry.json like this:
{
"id": "cloudflare",
"title": "Cloudflare platform MCP",
"summary": "Interact with Cloudflare's MCP endpoint for documentation, examples, and platform operations exposed via the official Cloudflare MCP server.",
"mcp": {
"transport": "stdio",
"command": "npx",
"args": [
"mcp-remote",
"https://docs.mcp.cloudflare.com/sse"
]
},
"domains": ["cloudflare", "workers", "kv", "r2", "queues", "zero_trust", "networking", "security", "observability"],
"tags": ["cloudflare", "platform", "infra", "docs", "workers", "mcp"],
"examples": [
"Fetch Cloudflare Workers documentation for a specific API.",
"Search Cloudflare platform docs for queues or KV usage patterns.",
"Look up configuration guidance for Zero Trust or networking features."
],
"sensitivity": "low",
"visibility": "default",
"priority": 10,
"autoDiscoverTools": true
}
With this entry present:
list_mcp_capabilities will return cloudflare when queries mention Cloudflare, Workers, KV, R2, Queues, etc.
describe_mcp with id: "cloudflare" will surface concise tool summaries from the Cloudflare MCP server.
execute_mcp_code lets the agent write TypeScript such as:
import * as cloudflare from "mcp-clients/cloudflare";
async function main() {
const docs = await cloudflare.search_docs({ query: "Workers KV" });
console.log(docs.summary);
}
The actual available functions under mcp-clients/cloudflare are generated dynamically
from the MCP tool definitions; the agent should always:
- Discover via
list_mcp_capabilities.
- Inspect via
describe_mcp to see available operations.
- Use those operations via
execute_mcp_code.
How to use
- Call
list_mcp_capabilities with a natural language query or filters to see which MCPs exist.
- For a chosen MCP (e.g.
cloudflare), call describe_mcp to understand its operations.
- Write TypeScript/JavaScript that imports from
mcp-clients/<id> and calls the exported functions.
- Run your code with
execute_mcp_code, optionally restricting allowedMcpIds for safety.
Rules
- Do not assume individual MCP tools are top-level tools.
- Always: discover → describe → generate code →
execute_mcp_code.
- Request
detail: "schema" in describe_mcp only when exact parameter shapes are required.
Known Limitations
Sandbox Security (CRITICAL)
⚠️ The current sandbox implementation is NOT secure for untrusted code.
⚠️ The vm-based sandbox is NOT a security boundary. Node's vm module can be escaped (see Node docs). This setting reduces accidental damage only. For untrusted MCP entries, run them in a separate process/container with proper OS-level isolation.
- Uses
vm.createContext() which is NOT a security boundary
- Can be escaped via prototype pollution, require() manipulation, etc.
- Only enable for Claude-generated code (trusted source)
- Requires
MCP_ORCH_ENABLE_SANDBOX=1 environment variable
- See
references/security-model.md for complete security details
Spawn Hardening (Command & Env Allowlisting)
When adding entries to mcp.registry.json, the orchestrator enforces:
- Command allowlist — only
npx, npm, pnpm, yarn, bunx, bun, node, deno, uvx, uv, python, python3, cargo, go (bare names resolved via PATH). Absolute/relative paths and shells are rejected. Set MCP_ORCH_ALLOW_RAW_COMMANDS=1 to opt out (loud stderr warning; only for fully-trusted registries).
- Env var denylist —
PATH, NODE_OPTIONS, LD_PRELOAD, DYLD_INSERT_LIBRARIES, PYTHONPATH, etc. are stripped from mcp.env before spawn (stderr warning per dropped key).
Other Limitations
- No TypeScript compilation: User code in
.ts format will fail
- No module resolution: Imports from
mcp-clients/* don't resolve; use $call() API
- Static registry: Adding/removing MCPs requires restart
- Limited error handling: Generic errors for MCP connection failures
For detailed troubleshooting, see references/troubleshooting.md.
Production Status
What's Working ✅:
- Discovery via
list_mcp_capabilities (fully functional)
- Inspection via
describe_mcp (fully functional)
- Registry management (16 MCPs configured)
- MCP clients (stdio + HTTP transports)
- Safety controls (visibility, sensitivity, policies)
What's Limited 🟡:
- Code execution (requires env flag, sandbox not secure)
- Testing (basic smoke tests only)
What's Planned 🔮:
- Secure sandbox with Worker threads (v1.1)
- TypeScript compilation support (v1.1)
- Module resolution (v1.1)
- Dynamic registry updates (v1.2)
For complete roadmap, see plan.md in repository root.
1---2name: mcp-dynamic-orchestrator3description: Dynamic MCP server discovery and code-mode execution via central registry. Use for multiple MCP integrations, tool discovery, progressive disclosure, or encountering MCP context bloat, changing server sets, large tool sets.4license: MIT5---6## Overview
7
8Use this skill to:
9- Discover which MCP servers are available and what they are for.
10- Inspect a specific MCP's capabilities without loading all tool schemas.
11- Execute TypeScript/JavaScript that calls MCP tools via generated `mcp-clients/*` modules.
12
13If no MCP servers are configured, `list_mcp_capabilities` will respond with an empty list
14and a message pointing to `skills/mcp-dynamic-orchestrator/mcp.registry.json` so the user
15can add MCP entries.
16
17This skill reads from `mcp.registry.json`, so adding an MCP entry there (for example the
18Cloudflare MCP) automatically makes it discoverable without changing tool wiring.
19
20## Cloudflare MCP example
21
22The Cloudflare MCP server can be configured in `mcp.registry.json` like this:
23
24```json
25{
26 "id": "cloudflare",
27 "title": "Cloudflare platform MCP",
28 "summary": "Interact with Cloudflare's MCP endpoint for documentation, examples, and platform operations exposed via the official Cloudflare MCP server.",
29 "mcp": {
30 "transport": "stdio",
31 "command": "npx",
32 "args": [
33 "mcp-remote",
34 "https://docs.mcp.cloudflare.com/sse"
35 ]
36 },
37 "domains": ["cloudflare", "workers", "kv", "r2", "queues", "zero_trust", "networking", "security", "observability"],
38 "tags": ["cloudflare", "platform", "infra", "docs", "workers", "mcp"],
39 "examples": [
40 "Fetch Cloudflare Workers documentation for a specific API.",
41 "Search Cloudflare platform docs for queues or KV usage patterns.",
42 "Look up configuration guidance for Zero Trust or networking features."
43 ],
44 "sensitivity": "low",
45 "visibility": "default",
46 "priority": 10,
47 "autoDiscoverTools": true
48}
49```
50
51With this entry present:
52- `list_mcp_capabilities` will return `cloudflare` when queries mention Cloudflare, Workers, KV, R2, Queues, etc.
53- `describe_mcp` with `id: "cloudflare"` will surface concise tool summaries from the Cloudflare MCP server.
54- `execute_mcp_code` lets the agent write TypeScript such as:
55
56```ts
57import * as cloudflare from "mcp-clients/cloudflare";
58
59async function main() {
60 const docs = await cloudflare.search_docs({ query: "Workers KV" });
61 console.log(docs.summary);
62}
63```
64
65The actual available functions under `mcp-clients/cloudflare` are generated dynamically
66from the MCP tool definitions; the agent should always:
671. Discover via `list_mcp_capabilities`.
682. Inspect via `describe_mcp` to see available operations.
693. Use those operations via `execute_mcp_code`.
70
71## How to use
72
731. Call `list_mcp_capabilities` with a natural language query or filters to see which MCPs exist.
742. For a chosen MCP (e.g. `cloudflare`), call `describe_mcp` to understand its operations.
753. Write TypeScript/JavaScript that imports from `mcp-clients/<id>` and calls the exported functions.
764. Run your code with `execute_mcp_code`, optionally restricting `allowedMcpIds` for safety.
77
78## Rules
79
80- Do not assume individual MCP tools are top-level tools.
81- Always: discover → describe → generate code → `execute_mcp_code`.
82- Request `detail: "schema"` in `describe_mcp` only when exact parameter shapes are required.
83
84## Known Limitations
85
86### Sandbox Security (CRITICAL)
87
88⚠️ **The current sandbox implementation is NOT secure for untrusted code.**
89
90> ⚠️ **The `vm`-based sandbox is NOT a security boundary.** Node's `vm` module can be escaped (see Node docs). This setting reduces accidental damage only. For untrusted MCP entries, run them in a **separate process/container with proper OS-level isolation.**
91
92- Uses `vm.createContext()` which is NOT a security boundary
93- Can be escaped via prototype pollution, require() manipulation, etc.
94- **Only enable for Claude-generated code** (trusted source)
95- Requires `MCP_ORCH_ENABLE_SANDBOX=1` environment variable
96- See `references/security-model.md` for complete security details
97
98### Spawn Hardening (Command & Env Allowlisting)
99
100When adding entries to `mcp.registry.json`, the orchestrator enforces:
101
1021. **Command allowlist** — only `npx, npm, pnpm, yarn, bunx, bun, node, deno, uvx, uv, python, python3, cargo, go` (bare names resolved via PATH). Absolute/relative paths and shells are rejected. Set `MCP_ORCH_ALLOW_RAW_COMMANDS=1` to opt out (loud stderr warning; only for fully-trusted registries).
1032. **Env var denylist** — `PATH`, `NODE_OPTIONS`, `LD_PRELOAD`, `DYLD_INSERT_LIBRARIES`, `PYTHONPATH`, etc. are stripped from `mcp.env` before spawn (stderr warning per dropped key).
104
105### Other Limitations
106
107- **No TypeScript compilation**: User code in `.ts` format will fail
108- **No module resolution**: Imports from `mcp-clients/*` don't resolve; use `$call()` API
109- **Static registry**: Adding/removing MCPs requires restart
110- **Limited error handling**: Generic errors for MCP connection failures
111
112For detailed troubleshooting, see `references/troubleshooting.md`.
113
114## Production Status
115
116**What's Working** ✅:
117- Discovery via `list_mcp_capabilities` (fully functional)
118- Inspection via `describe_mcp` (fully functional)
119- Registry management (16 MCPs configured)
120- MCP clients (stdio + HTTP transports)
121- Safety controls (visibility, sensitivity, policies)
122
123**What's Limited** 🟡:
124- Code execution (requires env flag, sandbox not secure)
125- Testing (basic smoke tests only)
126
127**What's Planned** 🔮:
128- Secure sandbox with Worker threads (v1.1)
129- TypeScript compilation support (v1.1)
130- Module resolution (v1.1)
131- Dynamic registry updates (v1.2)
132
133For complete roadmap, see `plan.md` in repository root.