Skip to content

basalt / mcp/src / mcpClientPlugin

Function: mcpClientPlugin() ​

> mcpClientPlugin(options): BasaltPlugin<unknown>

Defined in: mcp/src/client-plugin.ts:120

Registers a MCP_CLIENTS registry of external MCP servers. Resolve the token and call callTool(server, tool, args) / listTools(server) to use their tools from anywhere in the app. Connects eagerly at boot and closes every client on shutdown.

ts
mcpClientPlugin({
  servers: {
    search: { type: 'http', url: 'https://search.example/mcp' },
    files:  { type: 'stdio', command: 'mcp-files', args: ['--root', '.'] },
  },
})
// later:  await container.get(MCP_CLIENTS).callTool('search', 'query', { q: 'basalt' })

Parameters ​

options ​

McpClientPluginOptions

Returns ​

BasaltPlugin<unknown>

Released under the MIT License.