Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/api-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ npm run docs:build # writes docs/api/index.html
| -------------------------------------------- | --------------------------------------------- |
| `ToolRegistry` | Holds the tools an agent config refers to. |
| `httpTool`, `currentDateTool`, `dayNameTool` | Built-in tools. |
| `loadMcpTools(client, connectionName)` | Load a connected MCP server's tools as `ToolDescriptor`s. Available from the package root, `@loushy/build-ai-agent/tools`, and `@loushy/build-ai-agent/mcp`. |

```ts
import { loadMcpTools } from '@loushy/build-ai-agent/mcp';

const tools = await loadMcpTools(mcpClient, 'my-server');
```

## Flows, evals, observability and security

Expand Down
17 changes: 17 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ tools:
them throws an error telling you to build the agent with `createAgent()` and
pass a configured tool instead.

### MCP (Model Context Protocol) tools

Tools advertised by a remote MCP server aren't referenced by name in a spec
file - connect a `Client` from `@modelcontextprotocol/sdk` yourself and load
its tools with `loadMcpTools()`, then pass the result to `createAgent()` (or
register it on a `ToolRegistry`):

```ts
import { loadMcpTools } from '@loushy/build-ai-agent/mcp';

const tools = await loadMcpTools(mcpClient, 'my-server');
const agent = createAgent({ prompt: '...', provider, tools });
```

`loadMcpTools` is also available from the package root and from
`@loushy/build-ai-agent/tools`.

## Provider credentials

Real providers are resolved by `resolveProvider('<provider>/<model>')`
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
"import": "./dist/flows/index.mjs",
"require": "./dist/flows/index.js"
},
"./mcp": {
"types": "./dist/tools/mcp/index.d.ts",
"import": "./dist/tools/mcp/index.mjs",
"require": "./dist/tools/mcp/index.js"
},
"./types": {
"types": "./dist/types/index.d.ts",
"import": "./dist/types/index.mjs",
Expand Down
1 change: 1 addition & 0 deletions src/tools/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './ToolRegistry';
export * from './built-in';
export * from './mcp';

10 changes: 10 additions & 0 deletions src/tools/mcp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* MCP Tool Loader Module (LOU-K1)
*
* Public surface for loading tools advertised by a connected MCP
* (Model Context Protocol) server and turning them into ToolDescriptors
* usable elsewhere in the SDK (e.g. registered on a ToolRegistry).
*/

export * from './McpToolLoader';
export * from './schema';
1 change: 1 addition & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default defineConfig({
index: 'src/index.ts',
'core/index': 'src/core/index.ts',
'tools/index': 'src/tools/index.ts',
'tools/mcp/index': 'src/tools/mcp/index.ts',
'flows/index': 'src/flows/index.ts',
'data/index': 'src/data/index.ts',
'types/index': 'src/types/index.ts',
Expand Down
Loading