Repository navigation
LOU-K1: export MCP client on public API surface - #12
Merged
Merged
Conversation
An audit found McpToolLoader / loadMcpTools() fully implemented and tested in src/tools/mcp/ but unreachable from the public API: it was missing from src/tools/index.ts and had no ./mcp subpath export, so consumers could only reach it via an unsupported deep import into dist/tools/mcp/. - Add src/tools/mcp/index.ts barrel re-exporting loadMcpTools, listRemoteTools, RawMcpTool, and jsonSchemaToZod. - Re-export it from src/tools/index.ts so it's reachable from the package root and @loushy/build-ai-agent/tools. - Add a "./mcp" entry to package.json's exports map, mirroring the existing "./tools" shape. - Add tools/mcp/index as an explicit tsup entry point so dist/tools/mcp/index.* is actually emitted. - Document the new export with a short snippet in docs/api-overview.md and docs/configuration.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A published audit found that the SDK's MCP (Model Context Protocol) client (
McpToolLoader/loadMcpTools()insrc/tools/mcp/) was fully implemented and tested but not reachable from the public API surface: it was missing fromsrc/tools/index.ts, and there was no./mcpsubpath inpackage.json'sexportsmap. Consumers could only reach it via an unsupported deep relative import intodist/tools/mcp/....Changes
src/tools/mcp/index.tsbarrel exportingloadMcpTools,listRemoteTools,RawMcpTool, andjsonSchemaToZod(the same "export what's meant to be public, skip internals" pattern used by other barrels likesrc/execution/index.ts).export * from './mcp';tosrc/tools/index.tsso the loader is reachable from the package root and from@loushy/build-ai-agent/tools."./mcp"entry topackage.json'sexportsmap, matching the shape of the existing"./tools"entry (types/import/require ->dist/tools/mcp/index.*).'tools/mcp/index': 'src/tools/mcp/index.ts'as an explicit tsup entry point (tsup.config.ts lists entries explicitly, not via glob) sodist/tools/mcp/index.{js,mjs,d.ts,d.mts}is actually emitted.docs/api-overview.md(Tools table) anddocs/configuration.md(new "MCP (Model Context Protocol) tools" subsection under Agent spec files, since MCP tools are loaded programmatically rather than referenced by name in a spec).Out of scope: the Section 10 audit artifact itself is handled separately.
Test plan
npm run typecheck- clean, no errorsnpm run lint- 0 new errors/warnings (pre-existing 5 errors are unrelatedrequire()-in-fixture lint findings insrc/execution/__fixtures__/sample-repo/, untouched by this change)npx vitest run src/tools/mcp- 3 files / 18 tests passednpx vitest run docs/docs-links.test.ts src/tools/mcp- 4 files / 28 tests passednpm run build- tsup build succeeds and emitsdist/tools/mcp/index.js,dist/tools/mcp/index.mjs,dist/tools/mcp/index.d.ts,dist/tools/mcp/index.d.mts🤖 Generated with Claude Code