trustgraph/ts/scripts/run-brave-mcp.sh
elpresidank b854b56558 feat: MCP tool client infrastructure for agent extensibility
Add the full MCP tool pipeline enabling agents to invoke external tools
(like Brave Search) via MCP servers:

- Add ToolRequest/ToolResponse types and mcp-tool topics to @trustgraph/base
- Create McpToolService (FlowProcessor) that connects to external MCP servers
  via @modelcontextprotocol/sdk StreamableHTTP transport
- Add createMcpTool() to wire MCP tools into the agent's ReAct loop
- Implement config-driven tool registration in AgentService with backward-
  compatible fallback to hardcoded tools
- Add tool filtering by group and state (port of Python tool_filter.py)
- Register mcp-tool in gateway dispatcher and export from @trustgraph/flow
- Fix flow restart race condition: skip restart when flow definitions unchanged
- Update seed config with MCP server config and tool definitions
- Add run scripts for MCP tool service and Brave Search MCP server

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 05:45:46 -05:00

28 lines
813 B
Bash
Executable file

#!/usr/bin/env bash
# Start the Brave Search MCP server with HTTP transport.
#
# Usage: ./scripts/run-brave-mcp.sh
#
# Requires:
# - @brave/brave-search-mcp-server (npx will auto-install)
# - BRAVE_API_KEY env var or 1Password access
set -euo pipefail
# Resolve API key from env or 1Password
if [ -z "${BRAVE_API_KEY:-}" ]; then
if command -v op &>/dev/null; then
BRAVE_API_KEY="$(op read 'op://beep-dev-secrets/beep-ai/BRAVE_API_KEY')"
echo "[brave-mcp] Loaded API key from 1Password"
else
echo "[brave-mcp] ERROR: BRAVE_API_KEY not set and 'op' CLI not found"
exit 1
fi
fi
echo "[brave-mcp] Starting Brave Search MCP server on port 8383..."
exec npx --yes @brave/brave-search-mcp-server \
--brave-api-key "$BRAVE_API_KEY" \
--transport http \
--port 8383 \
--stateless true