VIP-65: Experimental.McpClient: MCP servers as toolkits, on Effect's client and server
Status: accepted by Will, 2026-11-23 — standard library only (no compiler or language changes). Will: "58 I accept. I accept every other language proposal but ones that don't require a change to the language and are purely library functions that don't require compiler changes at all should be marked as such". Implementation in progress (Experimental.McpClient).
Will's words
Ok so give me a list of [the reference engine's] features. We need to figure out what the VIP should look like. Some of the features outside of durable execution likely should simply be in the standard library I'm guessing but we should enumerate all of them
Summary
One sentence. The Model Context Protocol is Effect's McpClient and McpServer, in scope in Vibe today, and one function, Experimental.McpClient.toolkit, connects a server and hands back the tools you named as a Toolkit.
One paragraph. Vibe 0.0.13 already speaks MCP. Effect 4.1.1 ships a client (McpClient, experimental since 4.0.6) and a server (McpServer), and both are in scope with no import. A client call needs a name, a version, a protocol adapter, a transport and a second call to turn the catalog into a toolkit. Experimental.McpClient.toolkit does that in one call and adds what the MCP package of the reference engine (an existing Effect durable-execution framework these built-ins are modelled on) learned about running someone else's server: an allowlist of tools, a small child environment, errors that withhold the server's raw output, and a recorded step per call inside a task. The server half needs nothing new: McpServer.toolkit(Experimental.Tools.readOnly) registers a Vibe toolkit with Effect's server.
MCP server (someone else's code) Vibe program
──────────────────────────────── ────────────
create_issue ┐ ┌─► LanguageModel.generateText({ prompt, toolkit: github })
get_issue ├─ stdio or HTTP ─► McpClient.toolkit ─────┤
list_issues ┘ include: [...] github__create_issue └─► Experimental.Agent.run({ prompt, tools: github, output })
delete_repo ✕ not in `include`, never offered to the modelDecision
// proposed
export effect function issueTools(token: string) {
const github = try Experimental.McpClient.toolkit("github", {
command: ChildProcess.make("/opt/mcp/node_modules/.bin/mcp-server-github", [], { env: { GITHUB_PERSONAL_ACCESS_TOKEN: token } }),
include: ["create_issue", "get_issue", "list_issues"]
})
return Object.keys(github.tools)
}Serving a toolkit is Effect's API, unchanged:
// compiles under vibelang 0.0.13 once Experimental.Tools exists; every other name is Effect's
export const server = McpServer.layerStdio({
name: "workspace",
version: "1.0.0",
protocols: [McpProtocol.v2025_11_25],
registrations: McpServer.toolkit(Experimental.Tools.readOnly)
})Module
Experimental.McpClient, in scope with no import and named after the Effect module it extends (VIP-33). Its code is vibelang-runtime/experimental/McpClient. McpClient and McpServer stay Effect's.
| Call | Meaning | Built on |
|---|---|---|
Experimental.McpClient.toolkit(server, { command, include, timeout? }) | Start a server as a child process and give its tools as a Toolkit with handlers. Scoped: the process ends with the scope | Effect's McpClient.layerStdio and McpClient.toolkit; the reference engine's McpFlows.connected for the rules below |
Experimental.McpClient.toolkit(server, { url, headers?, include, timeout? }) | The same over Streamable HTTP | Effect's McpClient.layerHttp and McpClient.toolkit |
McpServer.toolkit(toolkit), McpServer.layerStdio, McpServer.layerHttp | Serve a toolkit as an MCP server | Effect, unchanged |
Rules
- Tool names are prefixed
<server>__<tool>, the form Effect'sMcpClient.toolkittakes as a prefix. A model's tool name holds 1 to 64 ASCII letters, digits, underscores or hyphens, so the reference engine'smcp/<server>/<tool>cannot be used. Two servers cannot collide, and a transcript shows where a tool came from. includeis required. It is an allowlist: a tool not named is not in the toolkit.include: "all"is the written opt-out. A server update that addsdelete_repothen adds nothing to what a model is offered.- The catalog is a snapshot. Tools are listed once, at connect. A server that changes its catalog changes nothing until the program connects again, and a recorded call keeps the meaning it had.
- The child gets a small environment:
PATH,HOME,USER,LANG,LC_*,TERM,TMPDIR,SHELL, plus whatcommanddeclares. Provider keys in the ambient environment do not reach a server. Connecting installs nothing and downloads nothing. - A server is opaque code. The permission kernel checks what Vibe does:
proc:spawnfor the command line,net:postfor the URL. It cannot check what the server does once called. The reference engine says the same: every projected tool "declares the widest authority the capability vocabulary can express". - A server's hints are claims.
readOnlyHintand its siblings are not copied into tool annotations unless the program asks, Effect'strustAnnotations. They never grant approval. - Errors withhold the server's text. A session error carries a code, not the child's stderr or a remote error body, which can quote a secret.
- A tool's
isError: trueresult is a result. It reaches the model unchanged, and it is not a transport failure. - A lost reply is not a retry. After a transport failure the client cannot know whether the tool ran. Inside a task the call is retried only under the task's own retry rules (durable-tasks-workflows).
- Inside a task, each call is a recorded step.
- The client has Effect's limits.
McpClientcovers tools, prompts, resources and Agent Skills. It does not cover interactive server requests, subscriptions, OAuth or retries.
Host needs
A command needs ChildProcessSpawner: Node, Bun or a sandbox. A url needs HttpClient and runs anywhere.
Maintainers' decisions
This record comes from the 2026-11-09 built-in set review. The Status line above records Will’s subsequent ruling.
- Serving a toolkit is Effect's API, unchanged: Design · Review.
Experimental.McpClient, in scope with no import and named after the Effect module it extends (VIP-33). Design · Review.- Its code is
vibelang-runtime/experimental/McpClient. Design · Review. McpClientandMcpServerstay Effect's. Design · Review.- Call
Experimental.McpClient.toolkit(server, { command, include, timeout? }): Meaning: Start a server as a child process and give its tools as aToolkitwith handlers. Scoped: the process ends with the scope; Built on: Effect'sMcpClient.layerStdioandMcpClient.toolkit; the reference engine'sMcpFlows.connectedfor the rules below. Design · Review. - Scoped: the process ends with the scope | Effect's
McpClient.layerStdioandMcpClient.toolkit; the reference engine'sMcpFlows.connectedfor the rules below | Design · Review. - Call
Experimental.McpClient.toolkit(server, { url, headers?, include, timeout? }): Meaning: The same over Streamable HTTP; Built on: Effect'sMcpClient.layerHttpandMcpClient.toolkit. Design · Review. - Call
McpServer.toolkit(toolkit),McpServer.layerStdio,McpServer.layerHttp: Meaning: Serve a toolkit as an MCP server; Built on: Effect, unchanged. Design · Review. - Tool names are prefixed
<server>__<tool>, the form Effect'sMcpClient.toolkittakes as a prefix. Design · Review. - A model's tool name holds 1 to 64 ASCII letters, digits, underscores or hyphens, so the reference engine's
mcp/<server>/<tool>cannot be used. Design · Review. - Two servers cannot collide, and a transcript shows where a tool came from. Design · Review.
includeis required. It is an allowlist: a tool not named is not in the toolkit. Design · Review.include: "all"is the written opt-out. Design · Review.- A server update that adds
delete_repothen adds nothing to what a model is offered. Design · Review. - The catalog is a snapshot. Tools are listed once, at connect. Design · Review.
- A server that changes its catalog changes nothing until the program connects again, and a recorded call keeps the meaning it had. Design · Review.
- The child gets a small environment:
PATH,HOME,USER,LANG,LC_*,TERM,TMPDIR,SHELL, plus whatcommanddeclares. Design · Review. - Provider keys in the ambient environment do not reach a server. Design · Review.
- Connecting installs nothing and downloads nothing. Design · Review.
- A server is opaque code. The permission kernel checks what Vibe does:
proc:spawnfor the command line,net:postfor the URL. Design · Review. - It cannot check what the server does once called. Design · Review.
- The reference engine says the same: every projected tool "declares the widest authority the capability vocabulary can express". Design · Review.
- A server's hints are claims.
readOnlyHintand its siblings are not copied into tool annotations unless the program asks, Effect'strustAnnotations. Design · Review. - They never grant approval. Design · Review.
- Errors withhold the server's text. A session error carries a code, not the child's stderr or a remote error body, which can quote a secret. Design · Review.
- A tool's
isError: trueresult is a result. It reaches the model unchanged, and it is not a transport failure. Design · Review. - A lost reply is not a retry. After a transport failure the client cannot know whether the tool ran. Design · Review.
- Inside a task the call is retried only under the task's own retry rules (durable-tasks-workflows). Design · Review.
- Inside a task, each call is a recorded step. Design · Review.
- The client has Effect's limits.
McpClientcovers tools, prompts, resources and Agent Skills. Design · Review. - It does not cover interactive server requests, subscriptions, OAuth or retries. Design · Review.
- A
commandneedsChildProcessSpawner: Node, Bun or a sandbox. Design · Review. - A
urlneedsHttpClientand runs anywhere. Design · Review.
Adopted review answers
- Keep
Experimental.Xnames under VIP-33. Promotion to a bare module name requires a later decision. Review question 1.
Compared
The same program in the reference engine 1.x. It type-checks against the reference engine's MCP package 1.0.0-rc.16.
import * as McpFlows from "@smthrs/mcp/McpFlows"
import { Effect } from "effect"
export const tools = (token: string) =>
Effect.scoped(Effect.gen(function*() {
const source = yield* McpFlows.connected({
server: "github",
command: "/opt/mcp/node_modules/.bin/mcp-server-github",
args: [],
env: { GITHUB_PERSONAL_ACCESS_TOKEN: token },
include: ["create_issue", "get_issue", "list_issues"]
})
const bindings = yield* source.bindings()
return bindings.map((binding) => binding.descriptor.name)
}))| Program | Tokens (o200k_base) | Lines |
|---|---|---|
| Vibe, proposed | 87 | 7 |
| Reference engine 1.x | 140 | 15 |
The reference engine gives flow bindings for its own agent loop. Vibe gives a Toolkit, which both LanguageModel and Experimental.Agent.run take.
Checked. Both Vibe examples use only existing syntax and compile under vibelang 0.0.13 against a declaration of Experimental.McpClient.toolkit and Experimental.Tools.readOnly. McpClient, McpServer, McpProtocol.v2025_11_25, ChildProcess.make with an env option, and Toolkit resolve to Effect 4.1.1 with no import. The naming rule and trustAnnotations are read from effect/dist/ai/McpClient.d.ts. The reference engine program type-checks as shown.
Principles
- TypeScript-first. One function call.
- Effect-second. The protocol is Effect's on both sides. This VIP writes no protocol code. The reference engine has its own
McpClient; Vibe does not port it. - Optimized for agentic programs. PROBLEM: "Agents call tools through MCP". One call turns a server into tools for either agent loop.
- Highly forkable. The module is one function over Effect's client. A fork changes the naming rule or the environment list in one place.
- Factory-first. The factory's MCP servers are declared in its source with their
includelists.
What this changes
Experimental.McpClientis new, with one function. No grammar changes.- The server surface needs no new implementation: a server is justified because it costs nothing.
McpServeris in scope today.
Alternatives
- Add nothing; use
McpClientdirectly. It works today. Each program then repeats the name, version, protocol adapter and toolkit call, and each forgets a different rule from the list above. - Port the reference engine's
McpClient. A second client for one protocol, which VIP-33 forbids. Effect's also covers more: prompts, resources and skills. - An
import tools from "mcp:github"form. A server's catalog is known only when it runs, so an import would have no static type. - MCP as the only tool interface. Local tools would pay a process boundary and lose their types.
Toolis the interface; MCP is one source of tools.
Follow-up questions
- Typed access to one tool. A catalog is dynamic, so
github.toolsis a record of untyped tools. Should a program pin one with its own schemas,Experimental.McpClient.tool(server, name, { input, output }), checked against the catalog at connect? Recommendation: yes, in a follow-up. - Configuration files. The reference engine's CLI reads server definitions from a config file. Should
fromConfig(path)exist? Recommendation: no. It is a product convention, and.mcp.jsonformats differ by host. - OAuth. Effect's client does not do it, and remote servers increasingly require it. Recommendation: propose it to Effect; do not build it here.
McpClientis marked experimental in Effect. Its API can change in a minor release. Vibe pins one Effect version (VIP-32), so the risk is at upgrade time. Accept it.
Depends on
- std-tools:
Toolkitas the shape of a tool set, andExperimental.Tools.readOnlyin the server example. - capabilities: the check on spawning and on requests.
- std-durable: recorded calls inside a task.