@ executor-js/ plugin- mcp
登记册 示范背景协议 服务器作为执行器的工具集成。 既支持stdio发射服务器,也支持远程(HTTP)服务器,带有可选的OAuth.
安装
bun add @executor-js/sdk @executor-js/plugin-mcp
# or
npm install @executor-js/sdk @executor-js/plugin-mcp
使用量
import { createExecutor } from "@executor-js/sdk";
import { mcpPlugin } from "@executor-js/plugin-mcp";
const executor = await createExecutor({
onElicitation: "accept-all",
// Stdio integrations spawn a local subprocess — only enable for trusted
// single-user contexts. See "Stdio environment" below for what they receive.
plugins: [mcpPlugin({ dangerouslyAllowStdioMCP: true })] as const,
});
const scope = executor.scopes[0]!.id;
// Remote MCP server
await executor.mcp.addIntegration({
scope,
transport: "remote",
name: "Context7",
endpoint: "https://mcp.context7.com/mcp",
});
// Stdio MCP server (requires `dangerouslyAllowStdioMCP: true` above)
await executor.mcp.addIntegration({
scope,
transport: "stdio",
name: "My Server",
command: "npx",
args: ["-y", "@my/mcp-server"],
});
// Every MCP tool is now part of the unified catalog
const tools = await executor.tools.list();
const result = await executor.tools.invoke("context7.searchLibraries", {
query: "effect-ts",
});
结构环境
Stdio 服务器不继承 process.env它收到MCP SDK的安全名单(HOME, (中文(简体) ), LOGNAME, (中文(简体) ), PATH, (中文(简体) ), SHELL, (中文(简体) ), TERM, (中文(简体) ), USER; Windows 上的等效Windows),外加一个代理和CA变量的简短授权列表—— HTTP_PROXY, (中文(简体) ), HTTPS_PROXY, (中文(简体) ), NO_PROXY他们的小写拼写, NODE_EXTRA_CA_CERTS, (中文(简体) ), SSL_CERT_FILE,以及 SSL_CERT_DIR ——所以公司代理背后的服务器仍然可以到达网络. 没有别的东西可以旅行,所以在宿主环境里一个秘密就留在那里. 通过集成给服务器更多的信息,首先是 API 密钥 env,在关键相撞上获胜。 在 Windows 上,碰撞的解决不敏感,因为操作系统处理 Path 财务报告和审定财务报表 PATH 作为一个变量.
有效使用
如果你在继续发展 @executor-js/sdk/core (原始效果项),从它的插件导入此插件 /core 子路径转而返回效果形状的插件 Effect.Effect<...>- 返回方法,而不是混合包装:
import { mcpPlugin } from "@executor-js/plugin-mcp/core";
状态
预1.0. API在β释放之间仍然可能改变. 部分 执行器单曲。 。 。 .
许可证
麻省理工学院