Add MCP doc/repo retrieval to the Ask Freya assistant - #632
Open
seanspeaks wants to merge 2 commits into
Open
Conversation
Give the assistant live access to the Frigg docs and repo via the new Freya MCP
client (@freyaframework/mcp-client), in proxy mode so each server costs a flat
two tools per turn.
- entry.mjs: compose RoadmapTools with an McpClientToolExecutor behind one
CompositeToolExecutor. MCP servers are built from env and offered only when
keyed, so the widget degrades gracefully:
- frigg-docs → Context7 (semantic docs), CONTEXT7_API_KEY
- frigg-repo → GitHub MCP (branch-accurate next file/code), GITHUB_MCP_TOKEN
Uses a dedicated GITHUB_MCP_TOKEN (no ambient GITHUB_TOKEN fallback) to avoid
half-activating the GitHub server with a wrong-scoped token.
- lib/freya-runtime.mjs: regenerated bundle now includes the MCP client + SDK
(self-contained; ~1.25 MB; no stdio/cross-spawn pulled in).
- assistant.mjs: system prompt tells the agent to use the *_list_tools /
*_call_tool sources for deep/technical/source questions when present.
- context7.json: pins Context7 indexing to the next branch + docs/.
Verified against the real bundle: non-MCP paths unchanged; with CONTEXT7_API_KEY
set, frigg-docs proxy tools are offered alongside the roadmap tools (proxy
discovery makes no network call); frigg-repo stays dormant until GITHUB_MCP_TOKEN
is set.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ixfrejnfZWd8TPZamZYdv
The bundle is a generated, Sonar-excluded artifact, and the MCP SDK it inlines (@modelcontextprotocol/client + zod + jose) is large. Enabling esbuild minify cuts the shipped file 1.25 MB -> 572 KB (~159 KB gzipped on the wire) with no behavior change; verified the MCP tool wiring still loads and is offered. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ixfrejnfZWd8TPZamZYdv
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
✅ Deploy Preview for friggframework-org ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
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
Gives the on-site Ask Freya assistant live access to the Frigg documentation and repository through Freya's new MCP client, so it can answer deep/technical questions from real sources instead of only the baked-in knowledge blob. Website-only — no
packages/changes.This is the website half; the framework capability (the MCP client itself) lands in
lefthookhq/freya(@freyaframework/mcp-client, ADR-024) and is vendored into the bundle here.What's here
website/tools/freya-vendor/entry.mjs— composes the existingRoadmapToolswith anMcpClientToolExecutor(proxy mode) behind one composite executor. MCP servers are built from env and offered only when their credential is present, so the widget degrades gracefully:frigg-docs→ Context7 (semantic docs) —CONTEXT7_API_KEYfrigg-repo→ GitHub MCP (branch-accuratenextfile/code) —GITHUB_MCP_TOKENwebsite/friggframework-api/lib/freya-runtime.mjs— regenerated, minified vendored bundle (now includes the MCP client + SDK; 572 KB, ~159 KB gzipped; no stdio/cross-spawn pulled in).website/friggframework-api/assistant.mjs— system prompt now steers the agent to the*_list_tools/*_call_toolsources for source/technical questions when present.context7.json— pins Context7 indexing to thenextbranch +docs/.Proxy mode exposes just two small tools per server (
<id>__list_tools+<id>__call_tool) instead of fanning out every schema, so a large server (GitHub's many tools) costs a flat ~two tool defs per turn.Verification
Tested against the real bundle:
CONTEXT7_API_KEYset, thefrigg-docsproxy tools are offered alongside the roadmap tools; proxy discovery makes no network call.frigg-repostays dormant untilGITHUB_MCP_TOKENis set.Config needed to go live (Netlify env on
friggframework-org)CONTEXT7_API_KEY(ctx7sk_…) — and registerfriggframework/friggon the Context7 dashboard so it indexes the repo.GITHUB_MCP_TOKEN— read-only fine-grained PAT.Both are optional at deploy time; absent a key, that source simply isn't offered.
Caveats
frigg-repodefaults tohttps://api.githubcopilot.com/mcp/with a bearer token, overridable viaGITHUB_MCP_URL. A plain fine-grained PAT may not authenticate there — treat GitHub-MCP as unverified until tested with a real token; it's gated and dormant, so this is safe to merge.context7.json(branch: next); confirm in the Context7 dashboard that it indexesnext.Note: intentionally no
release/prereleaselabels — this is a website-only change and should not trigger an npm prerelease (matches #630).🤖 Generated with Claude Code
https://claude.ai/code/session_018ixfrejnfZWd8TPZamZYdv
Generated by Claude Code