Skip to content

LOU-Z3: expose an agent (and its tools) as an MCP server - #52

Merged
LinuxDevil merged 2 commits into
mainfrom
lou-z3-agent-as-mcp-server
Oct 1, 2026
Merged

LinuxDevil merged 2 commits into
mainfrom
lou-z3-agent-as-mcp-server

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What

serveMcp({ agent, name, description, tools, transport }) (from @loushy/build-ai-agent/mcp) and loushy mcp <agent.yaml|json> [--http --port N --host H].

Why

Makes a Loushy agent callable from Claude Code, Cursor and other MCP clients.

How verified

  • npx tsc --noEmit: clean
  • npm run lint: 0 errors, no new warnings
  • npm run build + create-loushy-agent build: success
  • npm run test:coverage: 100 files passed, 1314 tests passed, 3 skipped
  • npm run fallow: exit 0
  • npm run docs:verify-snippets: all 34 snippets type-check, 5 run cleanly
  • Manual: node bin/loushy.js mcp s.json answered an initialize over stdio with only protocol JSON on stdout
  • Merged origin/main (6f2dc67) before final verification; already up to date

Notes for reviewer

  • Stateless HTTP: one McpServer + transport per request.
  • Approval-gated tools cannot be approved over MCP; documented, and a paused run returns isError. createAgent() has no approval store, so such a run actually fails with the executor's "requires approval" error; the awaiting-approval branch is tested with a stub agent.
  • Bearer check reuses checkWebhookAuth from src/triggers/webhookAuth.ts.
  • Touched config: tsup.config.ts, .fallowrc.json, bin/loushy.js (USAGE + command), docs/configuration.md, README.md.
  • The stdio transport branch of serveMcp is verified manually, not in unit tests.

🤖 Generated with Claude Code

LinuxDevil and others added 2 commits October 1, 2026 09:43
Adds serveMcp() to the ./mcp subpath: serves a createAgent() agent as one
MCP tool ({ message }), optionally exposing defineTool() tools directly,
over stdio or stateless Streamable HTTP (127.0.0.1 by default, optional
bearer auth reusing checkWebhookAuth, warning on unauthenticated
non-loopback binds). MCP request cancellation aborts the agent run; agent
failures and approval pauses return isError. needsApproval tools are not
exposed unless allowApprovalTools is set. Adds `loushy mcp <spec>
[--http --port --host]` plus docs and a README bullet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@LinuxDevil
LinuxDevil merged commit d5e4f86 into main Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant