Skip to content

Add MCP doc/repo retrieval to the Ask Freya assistant - #632

Open
seanspeaks wants to merge 2 commits into
nextfrom
claude/frigg-bot-branding-pvt3zz
Open

Add MCP doc/repo retrieval to the Ask Freya assistant#632
seanspeaks wants to merge 2 commits into
nextfrom
claude/frigg-bot-branding-pvt3zz

Conversation

@seanspeaks

Copy link
Copy Markdown
Contributor

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 existing RoadmapTools with an McpClientToolExecutor (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-docsContext7 (semantic docs) — CONTEXT7_API_KEY
    • frigg-repoGitHub MCP (branch-accurate next file/code) — GITHUB_MCP_TOKEN
  • website/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_tool sources for source/technical questions when present.
  • context7.json — pins Context7 indexing to the next branch + 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:

  • Non-MCP paths unchanged (offline degradation, 405 on non-POST, roadmap tool loop).
  • With CONTEXT7_API_KEY set, the 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.

Config needed to go live (Netlify env on friggframework-org)

  • CONTEXT7_API_KEY (ctx7sk_…) — and register friggframework/frigg on 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

  • GitHub MCP endpoint/auth is unproven. frigg-repo defaults to https://api.githubcopilot.com/mcp/ with a bearer token, overridable via GITHUB_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 config-branch is declared via context7.json (branch: next); confirm in the Context7 dashboard that it indexes next.

Note: intentionally no release/prerelease labels — 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

claude added 2 commits July 24, 2026 12:35
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
@cursor

cursor Bot commented Jul 25, 2026

Copy link
Copy Markdown

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.

@netlify

netlify Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploy Preview for friggframework-org ready!

Name Link
🔨 Latest commit d1c6222
🔍 Latest deploy log https://app.netlify.com/projects/friggframework-org/deploys/6a640af7f518f000087231f9
😎 Deploy Preview https://deploy-preview-632--friggframework-org.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants