@agent-native/core 0.98.16 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +21 -0
- package/corpus/core/docs/content/actions.mdx +1 -1
- package/corpus/core/docs/content/authentication.mdx +1 -1
- package/corpus/core/docs/content/dispatch.mdx +3 -3
- package/corpus/core/docs/content/external-agents.mdx +30 -19
- package/corpus/core/docs/content/locales/ar-SA/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/ar-SA/mcp-clients.mdx +31 -3
- package/corpus/core/docs/content/locales/ar-SA/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/ar-SA/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/ar-SA/server.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/de-DE/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/de-DE/mcp-clients.mdx +37 -3
- package/corpus/core/docs/content/locales/de-DE/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/de-DE/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/de-DE/server.mdx +2 -2
- package/corpus/core/docs/content/locales/de-DE/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/de-DE/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/es-ES/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +32 -19
- package/corpus/core/docs/content/locales/es-ES/mcp-clients.mdx +17 -3
- package/corpus/core/docs/content/locales/es-ES/mcp-protocol.mdx +38 -15
- package/corpus/core/docs/content/locales/es-ES/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/es-ES/server.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/fr-FR/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/fr-FR/mcp-clients.mdx +17 -3
- package/corpus/core/docs/content/locales/fr-FR/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/fr-FR/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/fr-FR/server.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/hi-IN/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +31 -19
- package/corpus/core/docs/content/locales/hi-IN/mcp-clients.mdx +17 -3
- package/corpus/core/docs/content/locales/hi-IN/mcp-protocol.mdx +36 -15
- package/corpus/core/docs/content/locales/hi-IN/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/hi-IN/server.mdx +2 -2
- package/corpus/core/docs/content/locales/hi-IN/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/hi-IN/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/ja-JP/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/ja-JP/mcp-clients.mdx +34 -3
- package/corpus/core/docs/content/locales/ja-JP/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/ja-JP/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/ja-JP/server.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/ko-KR/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +30 -19
- package/corpus/core/docs/content/locales/ko-KR/mcp-clients.mdx +33 -3
- package/corpus/core/docs/content/locales/ko-KR/mcp-protocol.mdx +36 -15
- package/corpus/core/docs/content/locales/ko-KR/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/ko-KR/server.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/pt-BR/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +32 -19
- package/corpus/core/docs/content/locales/pt-BR/mcp-clients.mdx +34 -3
- package/corpus/core/docs/content/locales/pt-BR/mcp-protocol.mdx +32 -15
- package/corpus/core/docs/content/locales/pt-BR/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/pt-BR/server.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-CN/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/zh-CN/mcp-clients.mdx +28 -3
- package/corpus/core/docs/content/locales/zh-CN/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/zh-CN/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-CN/server.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-TW/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/zh-TW/mcp-clients.mdx +28 -3
- package/corpus/core/docs/content/locales/zh-TW/mcp-protocol.mdx +30 -15
- package/corpus/core/docs/content/locales/zh-TW/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-TW/server.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/template-plan.mdx +3 -3
- package/corpus/core/docs/content/mcp-clients.mdx +31 -4
- package/corpus/core/docs/content/mcp-protocol.mdx +35 -15
- package/corpus/core/docs/content/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/server.mdx +2 -2
- package/corpus/core/docs/content/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/template-assets.mdx +1 -1
- package/corpus/core/docs/content/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/template-plan.mdx +3 -3
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/client.ts +3 -0
- package/corpus/core/src/a2a/handlers.ts +95 -7
- package/corpus/core/src/cli/connect.ts +50 -24
- package/corpus/core/src/cli/mcp-config-writers.ts +10 -0
- package/corpus/core/src/cli/mcp.ts +5 -5
- package/corpus/core/src/cli/skills-content/assets-skill.ts +1 -1
- package/corpus/core/src/cli/skills-content/design-exploration-skill.ts +1 -1
- package/corpus/core/src/cli/skills-content/help.ts +1 -1
- package/corpus/core/src/cli/skills-content/plan-setup-auth.ts +1 -1
- package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +1 -1
- package/corpus/core/src/cli/skills-content/visual-recap-skill.ts +2 -2
- package/corpus/core/src/cli/skills.ts +23 -12
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +5 -0
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +17 -0
- package/corpus/core/src/embedding/agent.ts +8 -6
- package/corpus/core/src/localization/default-messages.ts +7 -0
- package/corpus/core/src/mcp/ask-app-inline-tasks.ts +125 -0
- package/corpus/core/src/mcp/build-server.ts +65 -3
- package/corpus/core/src/mcp/builtin-tools.ts +186 -22
- package/corpus/core/src/mcp/connect-route.ts +17 -14
- package/corpus/core/src/mcp/oauth-route.ts +38 -13
- package/corpus/core/src/mcp/route-paths.ts +34 -0
- package/corpus/core/src/mcp/server.ts +21 -10
- package/corpus/core/src/mcp/stdio.ts +34 -16
- package/corpus/core/src/mcp/workspace-resolve.ts +2 -1
- package/corpus/core/src/mcp-client/manager.ts +5 -3
- package/corpus/core/src/mcp-client/remote-store.ts +10 -10
- package/corpus/core/src/server/agent-chat-plugin.ts +59 -8
- package/corpus/core/src/server/auth.ts +22 -6
- package/corpus/core/src/server/core-routes-plugin.ts +30 -24
- package/corpus/core/src/server/csrf.ts +17 -0
- package/corpus/core/src/server/framework-request-handler.ts +8 -2
- package/corpus/core/src/server/google-oauth.ts +6 -0
- package/corpus/core/src/server/http-response-telemetry.ts +6 -1
- package/corpus/core/src/server/recap-image-route.ts +3 -3
- package/corpus/core/src/server/security-headers.ts +7 -1
- package/corpus/core/src/server/ssr-handler.ts +2 -0
- package/corpus/core/src/shared/cache-control.ts +6 -4
- package/corpus/core/src/templates/default/.agents/skills/security/SKILL.md +10 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +15 -6
- package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +16 -10
- package/corpus/core/src/templates/workspace-core/.agents/skills/performance/SKILL.md +20 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/analytics/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/analytics/app/global.css +63 -4
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +8 -5
- package/corpus/templates/analytics/changelog/2026-07-13-daily-dashboard-emails-recover-more-reliably-from-serverless.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-session-replays-keep-a-visible-mac-style-cursor-over-the-vis.md +6 -0
- package/corpus/templates/analytics/server/jobs/dashboard-report.ts +21 -2
- package/corpus/templates/analytics/server/lib/dashboard-report-subscriptions.ts +57 -1
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +266 -28
- package/corpus/templates/analytics/server/routes/[...page].get.ts +0 -2
- package/corpus/templates/assets/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/assets/agent-native.app-skill.json +1 -1
- package/corpus/templates/brain/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/calendar/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/calendar/AGENTS.md +2 -1
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +0 -19
- package/corpus/templates/calendar/app/lib/attendee-local-time.ts +14 -5
- package/corpus/templates/calendar/changelog/2026-07-13-your-local-time-now-follows-your-browser-timezone-and-event-.md +6 -0
- package/corpus/templates/chat/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/clips/.agents/skills/recording/SKILL.md +7 -2
- package/corpus/templates/clips/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/clips/AGENTS.md +7 -0
- package/corpus/templates/clips/actions/list-meetings.ts +19 -4
- package/corpus/templates/clips/actions/start-meeting-recording.ts +7 -1
- package/corpus/templates/clips/app/components/meetings/transcript-bubbles.tsx +75 -78
- package/corpus/templates/clips/app/components/recorder/confetti-canvas.tsx +18 -1
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +6 -12
- package/corpus/templates/clips/app/components/recorder/recording-toolbar.tsx +19 -2
- package/corpus/templates/clips/app/lib/camera-composite.ts +70 -10
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +1 -1
- package/corpus/templates/clips/app/routes/record.tsx +5 -25
- package/corpus/templates/clips/changelog/2026-07-13-clips-desktop-now-requires-macos-13-for-native-capture.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-clips-hide-solo-meeting-reminders.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-clips-now-removes-duplicate-mic-and-system-transcript-turns-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-desktop-recordings-run-cooler-and-quieter-live-transcription.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-meeting-recordings-now-stop-after-a-calendar-meeting-ends-an.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-meeting-transcripts-now-use-a-clean-agent-chat-style-reading.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-screen-recordings-use-less-processing-power-during-longer-ca.md +6 -0
- package/corpus/templates/clips/chrome-extension/src/background.ts +5 -3
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +17 -14
- package/corpus/templates/clips/chrome-extension/src/overlay.ts +8 -2
- package/corpus/templates/clips/desktop/README.md +3 -0
- package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +9 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +8 -2
- package/corpus/templates/clips/desktop/src/lib/silence-events.ts +1 -0
- package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +5 -0
- package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +134 -5
- package/corpus/templates/clips/desktop/src/lib/upload-video-stream.ts +28 -0
- package/corpus/templates/clips/desktop/src/overlays/flow-bar.tsx +10 -3
- package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +42 -9
- package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +10 -2
- package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +6 -1
- package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +77 -1
- package/corpus/templates/clips/desktop/src-tauri/src/silence_detector.rs +104 -25
- package/corpus/templates/clips/desktop/src-tauri/src/system_audio.rs +4 -0
- package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +287 -32
- package/corpus/templates/clips/desktop/src-tauri/tauri.conf.json +1 -1
- package/corpus/templates/clips/server/lib/calendar-event-classification.ts +28 -0
- package/corpus/templates/clips/server/routes/[...page].get.ts +1 -59
- package/corpus/templates/clips/shared/recording-capture.ts +37 -0
- package/corpus/templates/content/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/content/agent-native.app-skill.json +1 -1
- package/corpus/templates/content/server/routes/[...page].get.ts +1 -15
- package/corpus/templates/design/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/design/actions/connect-assets-mcp.ts +1 -1
- package/corpus/templates/design/agent-native.app-skill.json +1 -1
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +88 -12
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +1 -0
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +4 -1
- package/corpus/templates/design/changelog/2026-07-13-adding-shapes-preserves-canvas-background.md +6 -0
- package/corpus/templates/design/changelog/2026-07-13-clicking-quickly-between-overlapping-elements-no-longer-bounc.md +6 -0
- package/corpus/templates/design/server/plugins/assets-mcp.ts +1 -1
- package/corpus/templates/design/server/routes/[...page].get.ts +0 -2
- package/corpus/templates/dispatch/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/forms/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/macros/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/mail/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/plan/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +1 -1
- package/corpus/templates/plan/.agents/skills/visual-recap/SKILL.md +2 -2
- package/corpus/templates/plan/agent-native.app-skill.json +1 -1
- package/corpus/templates/plan/app/lib/plan-local-bridge.ts +6 -1
- package/corpus/templates/plan/app/pages/PlansPage.tsx +15 -6
- package/corpus/templates/plan/changelog/2026-07-13-fixed-local-plan-previews-continuously-flickering-while-revi.md +6 -0
- package/corpus/templates/plan/server/routes/[...page].get.ts +0 -2
- package/corpus/templates/slides/.agents/skills/security/SKILL.md +10 -0
- package/dist/a2a/client.d.ts +2 -0
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +2 -0
- package/dist/a2a/client.js.map +1 -1
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +84 -7
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/cli/connect.d.ts +2 -2
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +45 -23
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/mcp-config-writers.d.ts.map +1 -1
- package/dist/cli/mcp-config-writers.js +7 -0
- package/dist/cli/mcp-config-writers.js.map +1 -1
- package/dist/cli/mcp.js +5 -3
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/skills-content/assets-skill.d.ts +1 -1
- package/dist/cli/skills-content/assets-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/assets-skill.js +1 -1
- package/dist/cli/skills-content/assets-skill.js.map +1 -1
- package/dist/cli/skills-content/design-exploration-skill.d.ts +1 -1
- package/dist/cli/skills-content/design-exploration-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/design-exploration-skill.js +1 -1
- package/dist/cli/skills-content/design-exploration-skill.js.map +1 -1
- package/dist/cli/skills-content/help.d.ts +1 -1
- package/dist/cli/skills-content/help.d.ts.map +1 -1
- package/dist/cli/skills-content/help.js +1 -1
- package/dist/cli/skills-content/help.js.map +1 -1
- package/dist/cli/skills-content/plan-setup-auth.d.ts +1 -1
- package/dist/cli/skills-content/plan-setup-auth.d.ts.map +1 -1
- package/dist/cli/skills-content/plan-setup-auth.js +1 -1
- package/dist/cli/skills-content/plan-setup-auth.js.map +1 -1
- package/dist/cli/skills-content/visual-plan-skill.d.ts +1 -1
- package/dist/cli/skills-content/visual-plan-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/visual-plan-skill.js +1 -1
- package/dist/cli/skills-content/visual-plan-skill.js.map +1 -1
- package/dist/cli/skills-content/visual-recap-skill.d.ts +1 -1
- package/dist/cli/skills-content/visual-recap-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/visual-recap-skill.js +2 -2
- package/dist/cli/skills-content/visual-recap-skill.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +16 -12
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +1 -1
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +14 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/embedding/agent.d.ts.map +1 -1
- package/dist/embedding/agent.js +6 -7
- package/dist/embedding/agent.js.map +1 -1
- package/dist/localization/default-messages.d.ts +5 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +5 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/ask-app-inline-tasks.d.ts +47 -0
- package/dist/mcp/ask-app-inline-tasks.d.ts.map +1 -0
- package/dist/mcp/ask-app-inline-tasks.js +87 -0
- package/dist/mcp/ask-app-inline-tasks.js.map +1 -0
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +56 -3
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +141 -21
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/mcp/connect-route.d.ts +12 -10
- package/dist/mcp/connect-route.d.ts.map +1 -1
- package/dist/mcp/connect-route.js +17 -14
- package/dist/mcp/connect-route.js.map +1 -1
- package/dist/mcp/oauth-route.d.ts +1 -1
- package/dist/mcp/oauth-route.d.ts.map +1 -1
- package/dist/mcp/oauth-route.js +30 -13
- package/dist/mcp/oauth-route.js.map +1 -1
- package/dist/mcp/route-paths.d.ts +13 -0
- package/dist/mcp/route-paths.d.ts.map +1 -0
- package/dist/mcp/route-paths.js +27 -0
- package/dist/mcp/route-paths.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +14 -6
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/stdio.d.ts +7 -6
- package/dist/mcp/stdio.d.ts.map +1 -1
- package/dist/mcp/stdio.js +27 -15
- package/dist/mcp/stdio.js.map +1 -1
- package/dist/mcp/workspace-resolve.d.ts +2 -1
- package/dist/mcp/workspace-resolve.d.ts.map +1 -1
- package/dist/mcp/workspace-resolve.js +2 -1
- package/dist/mcp/workspace-resolve.js.map +1 -1
- package/dist/mcp-client/manager.js +6 -3
- package/dist/mcp-client/manager.js.map +1 -1
- package/dist/mcp-client/remote-store.js +5 -7
- package/dist/mcp-client/remote-store.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/secrets/routes.d.ts +6 -6
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +60 -9
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +16 -6
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts +4 -3
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +20 -15
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/csrf.js +11 -0
- package/dist/server/csrf.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +8 -2
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/google-oauth.d.ts +2 -0
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +5 -0
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/http-response-telemetry.d.ts.map +1 -1
- package/dist/server/http-response-telemetry.js +4 -1
- package/dist/server/http-response-telemetry.js.map +1 -1
- package/dist/server/recap-image-route.js +3 -3
- package/dist/server/recap-image-route.js.map +1 -1
- package/dist/server/security-headers.d.ts.map +1 -1
- package/dist/server/security-headers.js +4 -1
- package/dist/server/security-headers.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +3 -1
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/cache-control.d.ts +7 -6
- package/dist/shared/cache-control.d.ts.map +1 -1
- package/dist/shared/cache-control.js +4 -3
- package/dist/shared/cache-control.js.map +1 -1
- package/dist/templates/default/.agents/skills/security/SKILL.md +10 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +15 -6
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +16 -10
- package/dist/templates/workspace-core/.agents/skills/performance/SKILL.md +20 -1
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +10 -0
- package/docs/content/actions.mdx +1 -1
- package/docs/content/authentication.mdx +1 -1
- package/docs/content/dispatch.mdx +3 -3
- package/docs/content/external-agents.mdx +30 -19
- package/docs/content/locales/ar-SA/actions.mdx +1 -1
- package/docs/content/locales/ar-SA/authentication.mdx +1 -1
- package/docs/content/locales/ar-SA/dispatch.mdx +3 -3
- package/docs/content/locales/ar-SA/external-agents.mdx +23 -19
- package/docs/content/locales/ar-SA/mcp-clients.mdx +31 -3
- package/docs/content/locales/ar-SA/mcp-protocol.mdx +29 -15
- package/docs/content/locales/ar-SA/plan-plugin.mdx +3 -3
- package/docs/content/locales/ar-SA/server.mdx +2 -2
- package/docs/content/locales/ar-SA/skills-guide.mdx +1 -1
- package/docs/content/locales/ar-SA/template-assets.mdx +1 -1
- package/docs/content/locales/ar-SA/template-dispatch.mdx +2 -2
- package/docs/content/locales/ar-SA/template-plan.mdx +3 -3
- package/docs/content/locales/de-DE/actions.mdx +1 -1
- package/docs/content/locales/de-DE/authentication.mdx +1 -1
- package/docs/content/locales/de-DE/dispatch.mdx +3 -3
- package/docs/content/locales/de-DE/external-agents.mdx +23 -19
- package/docs/content/locales/de-DE/mcp-clients.mdx +37 -3
- package/docs/content/locales/de-DE/mcp-protocol.mdx +29 -15
- package/docs/content/locales/de-DE/plan-plugin.mdx +3 -3
- package/docs/content/locales/de-DE/server.mdx +2 -2
- package/docs/content/locales/de-DE/skills-guide.mdx +1 -1
- package/docs/content/locales/de-DE/template-assets.mdx +1 -1
- package/docs/content/locales/de-DE/template-dispatch.mdx +2 -2
- package/docs/content/locales/de-DE/template-plan.mdx +3 -3
- package/docs/content/locales/es-ES/actions.mdx +1 -1
- package/docs/content/locales/es-ES/authentication.mdx +1 -1
- package/docs/content/locales/es-ES/dispatch.mdx +3 -3
- package/docs/content/locales/es-ES/external-agents.mdx +32 -19
- package/docs/content/locales/es-ES/mcp-clients.mdx +17 -3
- package/docs/content/locales/es-ES/mcp-protocol.mdx +38 -15
- package/docs/content/locales/es-ES/plan-plugin.mdx +3 -3
- package/docs/content/locales/es-ES/server.mdx +2 -2
- package/docs/content/locales/es-ES/skills-guide.mdx +1 -1
- package/docs/content/locales/es-ES/template-assets.mdx +1 -1
- package/docs/content/locales/es-ES/template-dispatch.mdx +2 -2
- package/docs/content/locales/es-ES/template-plan.mdx +3 -3
- package/docs/content/locales/fr-FR/actions.mdx +1 -1
- package/docs/content/locales/fr-FR/authentication.mdx +1 -1
- package/docs/content/locales/fr-FR/dispatch.mdx +3 -3
- package/docs/content/locales/fr-FR/external-agents.mdx +23 -19
- package/docs/content/locales/fr-FR/mcp-clients.mdx +17 -3
- package/docs/content/locales/fr-FR/mcp-protocol.mdx +29 -15
- package/docs/content/locales/fr-FR/plan-plugin.mdx +3 -3
- package/docs/content/locales/fr-FR/server.mdx +2 -2
- package/docs/content/locales/fr-FR/skills-guide.mdx +1 -1
- package/docs/content/locales/fr-FR/template-assets.mdx +1 -1
- package/docs/content/locales/fr-FR/template-dispatch.mdx +2 -2
- package/docs/content/locales/fr-FR/template-plan.mdx +3 -3
- package/docs/content/locales/hi-IN/actions.mdx +1 -1
- package/docs/content/locales/hi-IN/authentication.mdx +1 -1
- package/docs/content/locales/hi-IN/dispatch.mdx +3 -3
- package/docs/content/locales/hi-IN/external-agents.mdx +31 -19
- package/docs/content/locales/hi-IN/mcp-clients.mdx +17 -3
- package/docs/content/locales/hi-IN/mcp-protocol.mdx +36 -15
- package/docs/content/locales/hi-IN/plan-plugin.mdx +3 -3
- package/docs/content/locales/hi-IN/server.mdx +2 -2
- package/docs/content/locales/hi-IN/skills-guide.mdx +1 -1
- package/docs/content/locales/hi-IN/template-assets.mdx +1 -1
- package/docs/content/locales/hi-IN/template-dispatch.mdx +2 -2
- package/docs/content/locales/hi-IN/template-plan.mdx +3 -3
- package/docs/content/locales/ja-JP/actions.mdx +1 -1
- package/docs/content/locales/ja-JP/authentication.mdx +1 -1
- package/docs/content/locales/ja-JP/dispatch.mdx +3 -3
- package/docs/content/locales/ja-JP/external-agents.mdx +23 -19
- package/docs/content/locales/ja-JP/mcp-clients.mdx +34 -3
- package/docs/content/locales/ja-JP/mcp-protocol.mdx +29 -15
- package/docs/content/locales/ja-JP/plan-plugin.mdx +3 -3
- package/docs/content/locales/ja-JP/server.mdx +2 -2
- package/docs/content/locales/ja-JP/skills-guide.mdx +1 -1
- package/docs/content/locales/ja-JP/template-assets.mdx +1 -1
- package/docs/content/locales/ja-JP/template-dispatch.mdx +2 -2
- package/docs/content/locales/ja-JP/template-plan.mdx +3 -3
- package/docs/content/locales/ko-KR/actions.mdx +1 -1
- package/docs/content/locales/ko-KR/authentication.mdx +1 -1
- package/docs/content/locales/ko-KR/dispatch.mdx +3 -3
- package/docs/content/locales/ko-KR/external-agents.mdx +30 -19
- package/docs/content/locales/ko-KR/mcp-clients.mdx +33 -3
- package/docs/content/locales/ko-KR/mcp-protocol.mdx +36 -15
- package/docs/content/locales/ko-KR/plan-plugin.mdx +3 -3
- package/docs/content/locales/ko-KR/server.mdx +2 -2
- package/docs/content/locales/ko-KR/skills-guide.mdx +1 -1
- package/docs/content/locales/ko-KR/template-assets.mdx +1 -1
- package/docs/content/locales/ko-KR/template-dispatch.mdx +2 -2
- package/docs/content/locales/ko-KR/template-plan.mdx +3 -3
- package/docs/content/locales/pt-BR/actions.mdx +1 -1
- package/docs/content/locales/pt-BR/authentication.mdx +1 -1
- package/docs/content/locales/pt-BR/dispatch.mdx +3 -3
- package/docs/content/locales/pt-BR/external-agents.mdx +32 -19
- package/docs/content/locales/pt-BR/mcp-clients.mdx +34 -3
- package/docs/content/locales/pt-BR/mcp-protocol.mdx +32 -15
- package/docs/content/locales/pt-BR/plan-plugin.mdx +3 -3
- package/docs/content/locales/pt-BR/server.mdx +2 -2
- package/docs/content/locales/pt-BR/skills-guide.mdx +1 -1
- package/docs/content/locales/pt-BR/template-assets.mdx +1 -1
- package/docs/content/locales/pt-BR/template-dispatch.mdx +2 -2
- package/docs/content/locales/pt-BR/template-plan.mdx +3 -3
- package/docs/content/locales/zh-CN/actions.mdx +1 -1
- package/docs/content/locales/zh-CN/authentication.mdx +1 -1
- package/docs/content/locales/zh-CN/dispatch.mdx +3 -3
- package/docs/content/locales/zh-CN/external-agents.mdx +23 -19
- package/docs/content/locales/zh-CN/mcp-clients.mdx +28 -3
- package/docs/content/locales/zh-CN/mcp-protocol.mdx +29 -15
- package/docs/content/locales/zh-CN/plan-plugin.mdx +3 -3
- package/docs/content/locales/zh-CN/server.mdx +2 -2
- package/docs/content/locales/zh-CN/skills-guide.mdx +1 -1
- package/docs/content/locales/zh-CN/template-assets.mdx +1 -1
- package/docs/content/locales/zh-CN/template-dispatch.mdx +2 -2
- package/docs/content/locales/zh-CN/template-plan.mdx +3 -3
- package/docs/content/locales/zh-TW/actions.mdx +1 -1
- package/docs/content/locales/zh-TW/authentication.mdx +1 -1
- package/docs/content/locales/zh-TW/dispatch.mdx +3 -3
- package/docs/content/locales/zh-TW/external-agents.mdx +23 -19
- package/docs/content/locales/zh-TW/mcp-clients.mdx +28 -3
- package/docs/content/locales/zh-TW/mcp-protocol.mdx +30 -15
- package/docs/content/locales/zh-TW/plan-plugin.mdx +3 -3
- package/docs/content/locales/zh-TW/server.mdx +2 -2
- package/docs/content/locales/zh-TW/skills-guide.mdx +1 -1
- package/docs/content/locales/zh-TW/template-assets.mdx +1 -1
- package/docs/content/locales/zh-TW/template-dispatch.mdx +2 -2
- package/docs/content/locales/zh-TW/template-plan.mdx +3 -3
- package/docs/content/mcp-clients.mdx +31 -4
- package/docs/content/mcp-protocol.mdx +35 -15
- package/docs/content/plan-plugin.mdx +3 -3
- package/docs/content/server.mdx +2 -2
- package/docs/content/skills-guide.mdx +1 -1
- package/docs/content/template-assets.mdx +1 -1
- package/docs/content/template-dispatch.mdx +2 -2
- package/docs/content/template-plan.mdx +3 -3
- package/package.json +1 -1
- package/src/templates/default/.agents/skills/security/SKILL.md +10 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +15 -6
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +16 -10
- package/src/templates/workspace-core/.agents/skills/performance/SKILL.md +20 -1
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +10 -0
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/
|
|
2
|
+
* `/mcp/connect` — frictionless external-agent connection. The legacy
|
|
3
|
+
* `/_agent-native/mcp/connect` alias is mounted by the core route plugin.
|
|
3
4
|
*
|
|
4
5
|
* A logged-in user on a deployed agent-native app (e.g. mail.agent-native.com)
|
|
5
6
|
* mints a per-user, scoped, revocable MCP bearer token WITHOUT ever copying a
|
|
6
7
|
* shared deployment secret. Two surfaces:
|
|
7
8
|
*
|
|
8
|
-
* 1. Browser — `GET /connect` renders a minimal in-app page (same inline
|
|
9
|
+
* 1. Browser — `GET /mcp/connect` renders a minimal in-app page (same inline
|
|
9
10
|
* HTML approach as the auth pages). The Authorize button POSTs to
|
|
10
11
|
* `/connect/token`, then shows the ready-to-paste `.mcp.json` entry, the
|
|
11
12
|
* `agent-native connect <origin>` one-liner, and the user's existing
|
|
12
13
|
* tokens with Revoke buttons.
|
|
13
14
|
* 2. CLI — an OAuth-2.0-device-authorization-style flow:
|
|
14
|
-
* POST /connect/device/start (unauth) → device_code + user_code
|
|
15
|
-
* GET /connect?user_code=… (browser) → user signs in & approves
|
|
16
|
-
* POST /connect/device/authorize (session) → binds user to the code
|
|
17
|
-
* POST /connect/device/poll (unauth) → mints + returns the token
|
|
15
|
+
* POST /mcp/connect/device/start (unauth) → device_code + user_code
|
|
16
|
+
* GET /mcp/connect?user_code=… (browser) → user signs in & approves
|
|
17
|
+
* POST /mcp/connect/device/authorize (session) → binds user to the code
|
|
18
|
+
* POST /mcp/connect/device/poll (unauth) → mints + returns the token
|
|
18
19
|
*
|
|
19
20
|
* When A2A_SECRET exists, the minted token reuses the existing A2A signer
|
|
20
21
|
* (`signA2AToken`) and adds a random `jti` + `scope: "mcp-connect"` claim so
|
|
@@ -64,6 +65,7 @@ import {
|
|
|
64
65
|
MCP_OAUTH_DEFAULT_SCOPE,
|
|
65
66
|
signMcpOAuthAccessToken,
|
|
66
67
|
} from "./oauth-token.js";
|
|
68
|
+
import { MCP_PUBLIC_ROUTE_PREFIX } from "./route-paths.js";
|
|
67
69
|
|
|
68
70
|
/** Device-flow poll interval hint (seconds). */
|
|
69
71
|
const DEVICE_POLL_INTERVAL_S = 3;
|
|
@@ -383,7 +385,7 @@ function mcpResultPayload(
|
|
|
383
385
|
}
|
|
384
386
|
|
|
385
387
|
function mcpResourceUrl(appUrl: string): string {
|
|
386
|
-
return `${appUrl}
|
|
388
|
+
return `${appUrl}${MCP_PUBLIC_ROUTE_PREFIX}`;
|
|
387
389
|
}
|
|
388
390
|
|
|
389
391
|
// ---------------------------------------------------------------------------
|
|
@@ -415,7 +417,7 @@ function renderConnectPage(params: {
|
|
|
415
417
|
params;
|
|
416
418
|
const safeEmail = escapeHtml(email);
|
|
417
419
|
const safeApp = escapeHtml(appName);
|
|
418
|
-
const mcpUrl = `${appUrl}
|
|
420
|
+
const mcpUrl = `${appUrl}${MCP_PUBLIC_ROUTE_PREFIX}`;
|
|
419
421
|
const safeMcpUrl = escapeHtml(mcpUrl);
|
|
420
422
|
const safeServerId = escapeHtml(serverId);
|
|
421
423
|
const safeClaudeCodeCmd = escapeHtml(
|
|
@@ -948,7 +950,7 @@ function renderConnectPage(params: {
|
|
|
948
950
|
</div>
|
|
949
951
|
<script>
|
|
950
952
|
(function () {
|
|
951
|
-
var BASE = ${JSON.stringify(joinAppPath(connectBasePath, "/
|
|
953
|
+
var BASE = ${JSON.stringify(joinAppPath(connectBasePath, MCP_PUBLIC_ROUTE_PREFIX + "/connect"))};
|
|
952
954
|
var USER_CODE = ${JSON.stringify(safeUserCode || null)};
|
|
953
955
|
var msgEl = document.getElementById("msg");
|
|
954
956
|
var connectionsEl = document.getElementById("connections");
|
|
@@ -1182,10 +1184,11 @@ function renderConnectPage(params: {
|
|
|
1182
1184
|
// ---------------------------------------------------------------------------
|
|
1183
1185
|
|
|
1184
1186
|
/**
|
|
1185
|
-
* Handle a `/
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1187
|
+
* Handle a `/mcp/connect[...]` request. The legacy
|
|
1188
|
+
* `/_agent-native/mcp/connect` alias is mounted too. `subpath` is the part
|
|
1189
|
+
* after `/connect` (empty string = the page itself, otherwise e.g. `/token`,
|
|
1190
|
+
* `/device/start`). The core-routes-plugin computes it from the stripped event
|
|
1191
|
+
* path so this module stays mount-agnostic.
|
|
1189
1192
|
*/
|
|
1190
1193
|
export async function handleMcpConnect(
|
|
1191
1194
|
event: H3Event,
|
|
@@ -1291,7 +1294,7 @@ export async function handleMcpConnect(
|
|
|
1291
1294
|
if (method !== "POST") return json({ error: "Method not allowed" }, 405);
|
|
1292
1295
|
try {
|
|
1293
1296
|
const row = await createDeviceCode();
|
|
1294
|
-
const verificationUri = `${appUrl}/
|
|
1297
|
+
const verificationUri = `${appUrl}${MCP_PUBLIC_ROUTE_PREFIX}/connect`;
|
|
1295
1298
|
return json({
|
|
1296
1299
|
device_code: row.deviceCode,
|
|
1297
1300
|
user_code: row.userCode,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These routes let MCP hosts such as Claude Code and ChatGPT authenticate
|
|
5
5
|
* through their native remote-MCP OAuth flow instead of pasting bearer tokens.
|
|
6
|
-
* The issued access tokens are audience-bound to `/
|
|
6
|
+
* The issued access tokens are audience-bound to `/mcp`, carry
|
|
7
7
|
* the same user/org identity as the existing connect flow, and are mediated by
|
|
8
8
|
* `verifyAuth` before any MCP tool/resource request runs.
|
|
9
9
|
*/
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
normalizeOAuthScope,
|
|
36
36
|
signMcpOAuthAccessToken,
|
|
37
37
|
} from "./oauth-token.js";
|
|
38
|
+
import { MCP_PUBLIC_ROUTE_PREFIX, MCP_ROUTE_PREFIXES } from "./route-paths.js";
|
|
38
39
|
|
|
39
40
|
export interface McpOAuthRouteOptions {
|
|
40
41
|
appId?: string;
|
|
@@ -172,7 +173,16 @@ export function getMcpOAuthIssuer(event: H3Event): string | undefined {
|
|
|
172
173
|
export function getMcpOAuthResource(event: H3Event): string | undefined {
|
|
173
174
|
const issuer = getMcpOAuthIssuer(event);
|
|
174
175
|
if (!issuer) return undefined;
|
|
175
|
-
return `${issuer}
|
|
176
|
+
return `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function mcpResourcesForIssuer(issuer: string): string[] {
|
|
180
|
+
return [
|
|
181
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
182
|
+
...MCP_ROUTE_PREFIXES.filter(
|
|
183
|
+
(prefix) => prefix !== MCP_PUBLIC_ROUTE_PREFIX,
|
|
184
|
+
),
|
|
185
|
+
].map((prefix) => `${issuer}${prefix}`);
|
|
176
186
|
}
|
|
177
187
|
|
|
178
188
|
/**
|
|
@@ -185,18 +195,21 @@ export function getMcpOAuthResource(event: H3Event): string | undefined {
|
|
|
185
195
|
* accepts either without issuing a 401.
|
|
186
196
|
*/
|
|
187
197
|
export function getMcpOAuthAudiences(event: H3Event): string[] {
|
|
188
|
-
const
|
|
189
|
-
const configured = (() => {
|
|
198
|
+
const configuredIssuer = (() => {
|
|
190
199
|
const base = configuredPublicBaseUrl();
|
|
191
200
|
if (!base) return undefined;
|
|
192
201
|
// Re-apply base path if present so the configured resource is also
|
|
193
202
|
// base-path-aware, consistent with how getMcpOAuthResource computes it.
|
|
194
|
-
|
|
195
|
-
return `${withPath}/_agent-native/mcp`;
|
|
203
|
+
return appendConfiguredBasePath(base);
|
|
196
204
|
})();
|
|
197
205
|
const seen = new Set<string>();
|
|
198
206
|
const out: string[] = [];
|
|
199
|
-
for (const r of [
|
|
207
|
+
for (const r of [
|
|
208
|
+
...(getMcpOAuthIssuer(event)
|
|
209
|
+
? mcpResourcesForIssuer(getMcpOAuthIssuer(event) as string)
|
|
210
|
+
: []),
|
|
211
|
+
...(configuredIssuer ? mcpResourcesForIssuer(configuredIssuer) : []),
|
|
212
|
+
]) {
|
|
200
213
|
const n = r?.replace(/\/+$/, "");
|
|
201
214
|
if (n && !seen.has(n)) {
|
|
202
215
|
seen.add(n);
|
|
@@ -224,17 +237,21 @@ export function buildMcpOAuthChallenge(event: H3Event): string {
|
|
|
224
237
|
|
|
225
238
|
function authorizationEndpoint(event: H3Event): string | undefined {
|
|
226
239
|
const issuer = getMcpOAuthIssuer(event);
|
|
227
|
-
return issuer
|
|
240
|
+
return issuer
|
|
241
|
+
? `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}/oauth/authorize`
|
|
242
|
+
: undefined;
|
|
228
243
|
}
|
|
229
244
|
|
|
230
245
|
function tokenEndpoint(event: H3Event): string | undefined {
|
|
231
246
|
const issuer = getMcpOAuthIssuer(event);
|
|
232
|
-
return issuer ? `${issuer}/
|
|
247
|
+
return issuer ? `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}/oauth/token` : undefined;
|
|
233
248
|
}
|
|
234
249
|
|
|
235
250
|
function registrationEndpoint(event: H3Event): string | undefined {
|
|
236
251
|
const issuer = getMcpOAuthIssuer(event);
|
|
237
|
-
return issuer
|
|
252
|
+
return issuer
|
|
253
|
+
? `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}/oauth/register`
|
|
254
|
+
: undefined;
|
|
238
255
|
}
|
|
239
256
|
|
|
240
257
|
export function handleMcpOAuthProtectedResourceMetadata(
|
|
@@ -707,8 +724,11 @@ async function handleAuthorize(
|
|
|
707
724
|
const state = params.state;
|
|
708
725
|
const clientId = params.client_id;
|
|
709
726
|
const redirectUri = params.redirect_uri;
|
|
710
|
-
const resource = params.resource || getMcpOAuthResource(event)
|
|
711
|
-
|
|
727
|
+
const resource = (params.resource || getMcpOAuthResource(event))?.replace(
|
|
728
|
+
/\/+$/,
|
|
729
|
+
"",
|
|
730
|
+
);
|
|
731
|
+
const expectedResources = getMcpOAuthAudiences(event);
|
|
712
732
|
|
|
713
733
|
if (params.response_type !== "code") {
|
|
714
734
|
return oauthError(
|
|
@@ -716,7 +736,12 @@ async function handleAuthorize(
|
|
|
716
736
|
"response_type must be code",
|
|
717
737
|
);
|
|
718
738
|
}
|
|
719
|
-
if (
|
|
739
|
+
if (
|
|
740
|
+
!clientId ||
|
|
741
|
+
!redirectUri ||
|
|
742
|
+
!resource ||
|
|
743
|
+
!expectedResources.includes(resource)
|
|
744
|
+
) {
|
|
720
745
|
return oauthError("invalid_request", "Invalid OAuth authorization request");
|
|
721
746
|
}
|
|
722
747
|
if (params.code_challenge_method !== "S256" || !params.code_challenge) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP's public protocol path and the framework path kept for compatibility.
|
|
3
|
+
*
|
|
4
|
+
* Only the protocol and its OAuth/connect companions use the public alias.
|
|
5
|
+
* Other framework-owned MCP management routes remain under `/_agent-native`.
|
|
6
|
+
*/
|
|
7
|
+
export const MCP_PUBLIC_ROUTE_PREFIX = "/mcp";
|
|
8
|
+
export const MCP_LEGACY_ROUTE_PREFIX = "/_agent-native/mcp";
|
|
9
|
+
|
|
10
|
+
export const MCP_ROUTE_PREFIXES = [
|
|
11
|
+
MCP_LEGACY_ROUTE_PREFIX,
|
|
12
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
export function joinMcpRoute(prefix: string, suffix: string): string {
|
|
16
|
+
const normalizedSuffix = suffix.startsWith("/") ? suffix : `/${suffix}`;
|
|
17
|
+
return `${prefix}${normalizedSuffix}` || normalizedSuffix;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function isMcpPublicPath(pathname: string): boolean {
|
|
21
|
+
return (
|
|
22
|
+
pathname === MCP_PUBLIC_ROUTE_PREFIX ||
|
|
23
|
+
pathname.startsWith(`${MCP_PUBLIC_ROUTE_PREFIX}/`)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isMcpProtocolPath(pathname: string): boolean {
|
|
28
|
+
return (
|
|
29
|
+
pathname === MCP_PUBLIC_ROUTE_PREFIX ||
|
|
30
|
+
pathname === MCP_LEGACY_ROUTE_PREFIX ||
|
|
31
|
+
pathname === `${MCP_PUBLIC_ROUTE_PREFIX}/` ||
|
|
32
|
+
pathname === `${MCP_LEGACY_ROUTE_PREFIX}/`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -28,6 +28,11 @@ import {
|
|
|
28
28
|
getMcpOAuthProtectedResourceMetadataUrl,
|
|
29
29
|
getMcpOAuthResource,
|
|
30
30
|
} from "./oauth-route.js";
|
|
31
|
+
import {
|
|
32
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
33
|
+
MCP_ROUTE_PREFIXES,
|
|
34
|
+
joinMcpRoute,
|
|
35
|
+
} from "./route-paths.js";
|
|
31
36
|
|
|
32
37
|
// Re-export the shared MCP server builder + types so the stdio transport and
|
|
33
38
|
// any (future) external importer of `@agent-native/core/mcp` keep resolving
|
|
@@ -183,7 +188,7 @@ function buildWebRequest(event: H3Event, method: string): Request {
|
|
|
183
188
|
forwardedProto?.split(",")[0]?.trim() ||
|
|
184
189
|
(/^(localhost|127\.0\.0\.1)(:|$)/.test(host) ? "http" : "https");
|
|
185
190
|
const basePath = getConfiguredAppBasePath();
|
|
186
|
-
const url = `${proto}://${host}${basePath}
|
|
191
|
+
const url = `${proto}://${host}${basePath}${MCP_PUBLIC_ROUTE_PREFIX}`;
|
|
187
192
|
|
|
188
193
|
// No body here on purpose: the JSON-RPC payload is forwarded via the
|
|
189
194
|
// transport's `parsedBody` option (the same mechanism the Node transport
|
|
@@ -220,7 +225,7 @@ function buildUnauthorizedBody(event: H3Event): {
|
|
|
220
225
|
? `npx @agent-native/core@latest connect ${issuer}`
|
|
221
226
|
: undefined;
|
|
222
227
|
const authorizeUrl = issuer
|
|
223
|
-
? `${issuer}/
|
|
228
|
+
? `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}/oauth/authorize`
|
|
224
229
|
: undefined;
|
|
225
230
|
const message = command
|
|
226
231
|
? `Authentication required. Run \`${command}\` to re-authenticate this ` +
|
|
@@ -454,7 +459,8 @@ export async function handleMcpRequest(
|
|
|
454
459
|
/**
|
|
455
460
|
* Mount an MCP remote server on an H3/Nitro app.
|
|
456
461
|
*
|
|
457
|
-
*
|
|
462
|
+
* Endpoints: `/mcp` (public) and `/_agent-native/mcp` (compatibility).
|
|
463
|
+
* A custom route prefix only mounts that custom endpoint.
|
|
458
464
|
*
|
|
459
465
|
* Uses stateless Streamable HTTP transport — no in-memory sessions, JSON
|
|
460
466
|
* request/response (no SSE), and no standalone GET stream, so it survives
|
|
@@ -473,15 +479,20 @@ export function mountMCP(
|
|
|
473
479
|
config: MCPConfig,
|
|
474
480
|
routePrefix = "/_agent-native",
|
|
475
481
|
): void {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
+
const routePaths =
|
|
483
|
+
routePrefix === "/_agent-native"
|
|
484
|
+
? [...MCP_ROUTE_PREFIXES]
|
|
485
|
+
: [joinMcpRoute(routePrefix, "/mcp")];
|
|
486
|
+
const handler = defineEventHandler(async (event) => {
|
|
487
|
+
return handleMcpRequest(event as H3Event, config);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
for (const routePath of routePaths) {
|
|
491
|
+
getH3App(nitroApp).use(routePath, handler);
|
|
492
|
+
}
|
|
482
493
|
|
|
483
494
|
if (process.env.DEBUG)
|
|
484
495
|
console.log(
|
|
485
|
-
`[mcp] Mounted MCP server at ${
|
|
496
|
+
`[mcp] Mounted MCP server at ${routePaths.join(" and ")} (${Object.keys(config.actions).length} tools${config.askAgent ? " + ask-agent" : ""})`,
|
|
486
497
|
);
|
|
487
498
|
}
|
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
*
|
|
8
8
|
* - **proxy (default)** — connect an MCP `Client` over
|
|
9
9
|
* `StreamableHTTPClientTransport` to the *already-running* local app's
|
|
10
|
-
* `http://127.0.0.1:<port>/
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* it lazily on first
|
|
10
|
+
* `http://127.0.0.1:<port>/mcp` (falling back to the legacy
|
|
11
|
+
* `/_agent-native/mcp` path), and run a stdio `Server` that forwards tools
|
|
12
|
+
* and optional MCP App resources to it. The live app is the single source
|
|
13
|
+
* of truth: HMR'd actions, the real registry, correct per-request deep
|
|
14
|
+
* links, and tenant scoping all come for free. If the app isn't running,
|
|
15
|
+
* we wait briefly for it (the workspace gateway boots it lazily on first
|
|
16
|
+
* request).
|
|
16
17
|
*
|
|
17
18
|
* - **standalone (`--standalone`)** — no running server, no HMR. Build the
|
|
18
19
|
* MCP server in-process from `autoDiscoverActions(cwd)` +
|
|
@@ -25,6 +26,10 @@
|
|
|
25
26
|
|
|
26
27
|
import type { ServerCapabilities } from "@modelcontextprotocol/sdk/types.js";
|
|
27
28
|
|
|
29
|
+
import {
|
|
30
|
+
MCP_LEGACY_ROUTE_PREFIX,
|
|
31
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
32
|
+
} from "./route-paths.js";
|
|
28
33
|
import { resolveLocalAppOrigin } from "./workspace-resolve.js";
|
|
29
34
|
|
|
30
35
|
export interface RunMCPStdioOptions {
|
|
@@ -42,7 +47,10 @@ export interface RunMCPStdioOptions {
|
|
|
42
47
|
waitForAppMs?: number;
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
const
|
|
50
|
+
const MCP_SUBPATHS = [
|
|
51
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
52
|
+
MCP_LEGACY_ROUTE_PREFIX,
|
|
53
|
+
] as const;
|
|
46
54
|
|
|
47
55
|
function log(msg: string): void {
|
|
48
56
|
// stderr only — stdout is the MCP protocol channel and must stay clean.
|
|
@@ -74,9 +82,13 @@ function authHeaders(env: NodeJS.ProcessEnv): Record<string, string> {
|
|
|
74
82
|
return headers;
|
|
75
83
|
}
|
|
76
84
|
|
|
77
|
-
async function probeOrigin(
|
|
85
|
+
async function probeOrigin(
|
|
86
|
+
origin: string,
|
|
87
|
+
subpath: string,
|
|
88
|
+
timeoutMs = 800,
|
|
89
|
+
): Promise<boolean> {
|
|
78
90
|
try {
|
|
79
|
-
const res = await fetch(`${origin}${
|
|
91
|
+
const res = await fetch(`${origin}${subpath}`, {
|
|
80
92
|
method: "GET",
|
|
81
93
|
signal: AbortSignal.timeout(timeoutMs),
|
|
82
94
|
});
|
|
@@ -87,6 +99,13 @@ async function probeOrigin(origin: string, timeoutMs = 800): Promise<boolean> {
|
|
|
87
99
|
}
|
|
88
100
|
}
|
|
89
101
|
|
|
102
|
+
async function resolveMcpSubpath(origin: string): Promise<string | null> {
|
|
103
|
+
for (const subpath of MCP_SUBPATHS) {
|
|
104
|
+
if (await probeOrigin(origin, subpath)) return subpath;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
|
|
90
109
|
/**
|
|
91
110
|
* Proxy mode: stdio Server ⇄ HTTP Client to the running app.
|
|
92
111
|
*
|
|
@@ -103,27 +122,26 @@ async function runProxy(opts: RunMCPStdioOptions): Promise<void> {
|
|
|
103
122
|
port: opts.port,
|
|
104
123
|
});
|
|
105
124
|
const env = opts.env ?? process.env;
|
|
106
|
-
const target = `${origin}${MCP_SUBPATH}`;
|
|
107
|
-
|
|
108
125
|
// Wait for the app to come up. The workspace gateway lazily boots an app's
|
|
109
126
|
// dev server on first request, so a fresh `mcp serve` may briefly race the
|
|
110
127
|
// boot. Hit the gateway path too so the lazy start is triggered.
|
|
111
128
|
const deadline = Date.now() + (opts.waitForAppMs ?? 60_000);
|
|
112
|
-
let
|
|
113
|
-
if (!
|
|
129
|
+
let mcpSubpath = await resolveMcpSubpath(origin);
|
|
130
|
+
if (!mcpSubpath) {
|
|
114
131
|
log(`Waiting for ${appId} at ${origin} …`);
|
|
115
|
-
while (!
|
|
132
|
+
while (!mcpSubpath && Date.now() < deadline) {
|
|
116
133
|
await new Promise((r) => setTimeout(r, 750));
|
|
117
|
-
|
|
134
|
+
mcpSubpath = await resolveMcpSubpath(origin);
|
|
118
135
|
}
|
|
119
136
|
}
|
|
120
|
-
if (!
|
|
137
|
+
if (!mcpSubpath) {
|
|
121
138
|
throw new Error(
|
|
122
139
|
`Timed out waiting for the local app at ${origin}. Start it with ` +
|
|
123
140
|
`\`agent-native dev\` (or \`agent-native workspace-dev\`), or run ` +
|
|
124
141
|
`\`agent-native mcp serve --standalone\` to build the server from disk.`,
|
|
125
142
|
);
|
|
126
143
|
}
|
|
144
|
+
const target = `${origin}${mcpSubpath}`;
|
|
127
145
|
|
|
128
146
|
const { Client } = await import("@modelcontextprotocol/sdk/client/index.js");
|
|
129
147
|
const { StreamableHTTPClientTransport } =
|
|
@@ -213,7 +213,8 @@ export async function resolveWorkspace(
|
|
|
213
213
|
/**
|
|
214
214
|
* Resolve the local app the stdio proxy should connect its MCP HTTP client
|
|
215
215
|
* to. Honours an explicit `--app` / appId and `--port` / explicit port.
|
|
216
|
-
* Returns the chosen app's origin (where `/
|
|
216
|
+
* Returns the chosen app's origin (where `/mcp` is mounted; the legacy
|
|
217
|
+
* `/_agent-native/mcp` alias is supported too).
|
|
217
218
|
*
|
|
218
219
|
* Order of precedence:
|
|
219
220
|
* 1. explicit `port` → http://127.0.0.1:<port>
|
|
@@ -954,9 +954,11 @@ function firstPartyMcpAudienceForUrl(rawUrl: string): string | undefined {
|
|
|
954
954
|
try {
|
|
955
955
|
const url = new URL(rawUrl);
|
|
956
956
|
const pathname = url.pathname.replace(/\/+$/, "");
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
957
|
+
if (pathname.endsWith("/_agent-native/mcp")) {
|
|
958
|
+
url.pathname = `${pathname.slice(0, -"/_agent-native/mcp".length)}/mcp`;
|
|
959
|
+
} else {
|
|
960
|
+
url.pathname = pathname.endsWith("/mcp") ? pathname : `${pathname}/mcp`;
|
|
961
|
+
}
|
|
960
962
|
url.search = "";
|
|
961
963
|
url.hash = "";
|
|
962
964
|
return url.toString().replace(/\/+$/, "");
|
|
@@ -438,22 +438,22 @@ function normalizeEndpointPath(pathname: string): string {
|
|
|
438
438
|
return pathname.replace(/\/+$/, "") || "/";
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
function
|
|
441
|
+
function expectedFirstPartyMcpUrls(appUrl: string): URL[] {
|
|
442
442
|
try {
|
|
443
|
-
|
|
443
|
+
const base = appUrl.replace(/\/+$/, "");
|
|
444
|
+
return [new URL(`${base}/mcp`), new URL(`${base}/_agent-native/mcp`)];
|
|
444
445
|
} catch {
|
|
445
|
-
return
|
|
446
|
+
return [];
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
449
|
|
|
449
450
|
function sameFirstPartyMcpEndpoint(endpointUrl: URL, appUrl: string): boolean {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
endpointUrl.search === expected.search
|
|
451
|
+
return expectedFirstPartyMcpUrls(appUrl).some(
|
|
452
|
+
(expected) =>
|
|
453
|
+
endpointUrl.origin === expected.origin &&
|
|
454
|
+
normalizeEndpointPath(endpointUrl.pathname) ===
|
|
455
|
+
normalizeEndpointPath(expected.pathname) &&
|
|
456
|
+
endpointUrl.search === expected.search,
|
|
457
457
|
);
|
|
458
458
|
}
|
|
459
459
|
|
|
@@ -168,6 +168,7 @@ import {
|
|
|
168
168
|
import { mountRealtimeVoiceRoutes } from "./realtime-voice.js";
|
|
169
169
|
import {
|
|
170
170
|
runWithRequestContext,
|
|
171
|
+
getRequestContext,
|
|
171
172
|
getRequestOrgId,
|
|
172
173
|
getRequestUserEmail,
|
|
173
174
|
getRequestRunContext,
|
|
@@ -1255,6 +1256,35 @@ export function createAgentChatPlugin(
|
|
|
1255
1256
|
const { getOwnerActiveApiKey } =
|
|
1256
1257
|
await import("../agent/production-agent.js");
|
|
1257
1258
|
const ownerApiKey = await getOwnerActiveApiKey(userEmail);
|
|
1259
|
+
// A2A runs are reconstructed in a fresh processor request, so they
|
|
1260
|
+
// do not pass through the interactive handler's prepareRun hook.
|
|
1261
|
+
// Seed the same mutable run context before resolving the engine and
|
|
1262
|
+
// building tools. Provider credentials, team/fetch helpers, and
|
|
1263
|
+
// other action closures read this context rather than the engine
|
|
1264
|
+
// argument alone; without it delegated runs can silently fall back
|
|
1265
|
+
// to an unscoped/unconfigured provider path even though interactive
|
|
1266
|
+
// chat works for the same owner.
|
|
1267
|
+
const a2aRunContext = ensureRequestRunContext();
|
|
1268
|
+
if (a2aRunContext) {
|
|
1269
|
+
a2aRunContext.owner = userEmail;
|
|
1270
|
+
a2aRunContext.userApiKey = ownerApiKey;
|
|
1271
|
+
// The async processor restores the original request origin from
|
|
1272
|
+
// task metadata. Only derive a fallback for synchronous A2A calls
|
|
1273
|
+
// where the inbound event is still the caller request.
|
|
1274
|
+
if (!a2aRunContext.requestOrigin) {
|
|
1275
|
+
const restoredOrigin = getRequestContext()?.requestOrigin;
|
|
1276
|
+
if (restoredOrigin) {
|
|
1277
|
+
a2aRunContext.requestOrigin = restoredOrigin;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
if (!a2aRunContext.requestOrigin) {
|
|
1281
|
+
try {
|
|
1282
|
+
a2aRunContext.requestOrigin = getOrigin(context.event as any);
|
|
1283
|
+
} catch {
|
|
1284
|
+
// Keep the owner context even when no browser origin exists.
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1258
1288
|
const a2aEngine = await resolveEngine({
|
|
1259
1289
|
engineOption: options?.engine,
|
|
1260
1290
|
apiKey: ownerApiKey ?? options?.apiKey,
|
|
@@ -1274,14 +1304,6 @@ export function createAgentChatPlugin(
|
|
|
1274
1304
|
? ""
|
|
1275
1305
|
: await buildSchemaBlock(owner, databaseToolsMode);
|
|
1276
1306
|
const extra = await resolveExtraContext(context.event, owner);
|
|
1277
|
-
// Stable content first, most-volatile-per-day last: the
|
|
1278
|
-
// runtime-context block is appended after resources/schema/extra so
|
|
1279
|
-
// a day rollover (or the resources/extra content changing) only
|
|
1280
|
-
// invalidates the cached prompt prefix as late as possible.
|
|
1281
|
-
const runtimeContext = runtimeContextForEvent(context.event);
|
|
1282
|
-
const systemPrompt = devActive
|
|
1283
|
-
? devPrompt + resources + schemaBlock + extra + runtimeContext
|
|
1284
|
-
: basePrompt + resources + schemaBlock + extra + runtimeContext;
|
|
1285
1307
|
|
|
1286
1308
|
const a2aModelCandidate =
|
|
1287
1309
|
options?.model ??
|
|
@@ -1290,6 +1312,34 @@ export function createAgentChatPlugin(
|
|
|
1290
1312
|
})) ??
|
|
1291
1313
|
a2aEngine.defaultModel;
|
|
1292
1314
|
const model = normalizeModelForEngine(a2aEngine, a2aModelCandidate);
|
|
1315
|
+
if (a2aRunContext) {
|
|
1316
|
+
a2aRunContext.engine = a2aEngine;
|
|
1317
|
+
a2aRunContext.model = model;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
// Keep delegated runs aligned with the interactive production
|
|
1321
|
+
// prompt's model-specific behavior without importing interactive
|
|
1322
|
+
// onboarding into a background/cross-app task.
|
|
1323
|
+
const modelOverlay = getModelFamilyOverlay(model);
|
|
1324
|
+
// Stable content first, most-volatile-per-day last: the
|
|
1325
|
+
// runtime-context block is appended after resources/schema/extra so
|
|
1326
|
+
// a day rollover (or the resources/extra content changing) only
|
|
1327
|
+
// invalidates the cached prompt prefix as late as possible.
|
|
1328
|
+
const runtimeContext = runtimeContextForEvent(context.event);
|
|
1329
|
+
const systemPrompt = devActive
|
|
1330
|
+
? devPrompt +
|
|
1331
|
+
resources +
|
|
1332
|
+
schemaBlock +
|
|
1333
|
+
extra +
|
|
1334
|
+
modelOverlay +
|
|
1335
|
+
runtimeContext
|
|
1336
|
+
: basePrompt +
|
|
1337
|
+
resources +
|
|
1338
|
+
schemaBlock +
|
|
1339
|
+
extra +
|
|
1340
|
+
modelOverlay +
|
|
1341
|
+
runtimeContext;
|
|
1342
|
+
if (a2aRunContext) a2aRunContext.systemPrompt = systemPrompt;
|
|
1293
1343
|
|
|
1294
1344
|
// Build tools — same as interactive handler but WITHOUT call-agent
|
|
1295
1345
|
// to prevent infinite recursive A2A loops (agent calling itself).
|
|
@@ -5343,6 +5393,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
5343
5393
|
"/_agent-native/actions",
|
|
5344
5394
|
"/_agent-native/agent-model-defaults",
|
|
5345
5395
|
"/_agent-native/mcp",
|
|
5396
|
+
"/mcp",
|
|
5346
5397
|
],
|
|
5347
5398
|
});
|
|
5348
5399
|
};
|
|
@@ -74,6 +74,11 @@ import {
|
|
|
74
74
|
} from "../db/client.js";
|
|
75
75
|
import { ensureColumnExists, ensureTableExists } from "../db/ddl-guard.js";
|
|
76
76
|
import { widenIntColumnsToBigInt } from "../db/widen-columns.js";
|
|
77
|
+
import {
|
|
78
|
+
MCP_LEGACY_ROUTE_PREFIX,
|
|
79
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
80
|
+
isMcpProtocolPath,
|
|
81
|
+
} from "../mcp/route-paths.js";
|
|
77
82
|
import { readBody } from "../server/h3-helpers.js";
|
|
78
83
|
import { putSetting } from "../settings/store.js";
|
|
79
84
|
import { DEFAULT_SSR_CACHE_HEADERS } from "../shared/cache-control.js";
|
|
@@ -718,8 +723,9 @@ async function getBearerLegacySession(
|
|
|
718
723
|
* `agent-native connect` mints this token for the local Plans publish flow and
|
|
719
724
|
* POSTs it to the HOSTED action route
|
|
720
725
|
* `/_agent-native/actions/import-visual-plan-source`. That token is audience-
|
|
721
|
-
* bound to the app's MCP resource (`{appUrl}/
|
|
722
|
-
*
|
|
726
|
+
* bound to the app's canonical MCP resource (`{appUrl}/mcp`; the legacy
|
|
727
|
+
* `/_agent-native/mcp` resource is also accepted), not to the legacy `sessions`
|
|
728
|
+
* table — so the legacy bearer lookup above never matches it.
|
|
723
729
|
* Reuse the MCP surface's canonical `verifyAuth` here so the HTTP action surface
|
|
724
730
|
* honors EXACTLY the tokens the MCP endpoint honors: same signature check, same
|
|
725
731
|
* audience binding to THIS app's resource, same connect-token revocation gate.
|
|
@@ -740,13 +746,13 @@ async function getMcpOAuthBearerSession(
|
|
|
740
746
|
if (!bearerToken) return null;
|
|
741
747
|
|
|
742
748
|
try {
|
|
743
|
-
const [{
|
|
749
|
+
const [{ getMcpOAuthAudiences }, { verifyAuth, resolveOrgIdFromDomain }] =
|
|
744
750
|
await Promise.all([
|
|
745
751
|
import("../mcp/oauth-route.js"),
|
|
746
752
|
import("../mcp/build-server.js"),
|
|
747
753
|
]);
|
|
748
754
|
const result = await verifyAuth(authHeader, undefined, {
|
|
749
|
-
resourceUrl:
|
|
755
|
+
resourceUrl: getMcpOAuthAudiences(event),
|
|
750
756
|
allowDevOpen: false,
|
|
751
757
|
});
|
|
752
758
|
const identity = result.authed ? result.identity : undefined;
|
|
@@ -1775,7 +1781,11 @@ function createAuthGuardFn(): (
|
|
|
1775
1781
|
// the stdio proxy or HTTP can never reach it. Exact protocol endpoint only:
|
|
1776
1782
|
// tolerate the common trailing slash, but keep
|
|
1777
1783
|
// `/_agent-native/mcp/*` management subroutes on normal session auth.
|
|
1778
|
-
if (
|
|
1784
|
+
if (
|
|
1785
|
+
isMcpProtocolPath(p) ||
|
|
1786
|
+
p === `${MCP_PUBLIC_ROUTE_PREFIX}/` ||
|
|
1787
|
+
p === `${MCP_LEGACY_ROUTE_PREFIX}/`
|
|
1788
|
+
) {
|
|
1779
1789
|
return;
|
|
1780
1790
|
}
|
|
1781
1791
|
|
|
@@ -1806,7 +1816,13 @@ function createAuthGuardFn(): (
|
|
|
1806
1816
|
p === "/_agent-native/mcp/connect/device/poll" ||
|
|
1807
1817
|
p === "/_agent-native/mcp/oauth/authorize" ||
|
|
1808
1818
|
p === "/_agent-native/mcp/oauth/token" ||
|
|
1809
|
-
p === "/_agent-native/mcp/oauth/register"
|
|
1819
|
+
p === "/_agent-native/mcp/oauth/register" ||
|
|
1820
|
+
p === `${MCP_PUBLIC_ROUTE_PREFIX}/connect` ||
|
|
1821
|
+
p === `${MCP_PUBLIC_ROUTE_PREFIX}/connect/device/start` ||
|
|
1822
|
+
p === `${MCP_PUBLIC_ROUTE_PREFIX}/connect/device/poll` ||
|
|
1823
|
+
p === `${MCP_PUBLIC_ROUTE_PREFIX}/oauth/authorize` ||
|
|
1824
|
+
p === `${MCP_PUBLIC_ROUTE_PREFIX}/oauth/token` ||
|
|
1825
|
+
p === `${MCP_PUBLIC_ROUTE_PREFIX}/oauth/register`
|
|
1810
1826
|
) {
|
|
1811
1827
|
return;
|
|
1812
1828
|
}
|