From 419952737234fba04076a6eede196519a5b9b1d5 Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Thu, 2 Jul 2026 11:48:46 -0500 Subject: [PATCH] Add WebMCP tool registration for agentic browsing (closes #9). Expose public marketing actions as navigator.modelContext tools behind WEBMCP_ENABLED, including contact submission and service navigation helpers with docs and regression tests. --- company_site/company_site/settings.py | 2 + company_site/docs/agentic-browsing.md | 17 +- company_site/docs/webmcp.md | 104 +++++++ company_site/public/context_processors.py | 34 +++ company_site/public/seo.py | 126 +++++++- .../public/static/public/js/webmcp-tools.js | 286 ++++++++++++++++++ company_site/public/templates/base.html | 14 + .../public/templates/public/contact.html | 3 +- company_site/public/tests.py | 60 ++++ 9 files changed, 628 insertions(+), 18 deletions(-) create mode 100644 company_site/docs/webmcp.md create mode 100644 company_site/public/static/public/js/webmcp-tools.js diff --git a/company_site/company_site/settings.py b/company_site/company_site/settings.py index 5fcbf01..0026c84 100644 --- a/company_site/company_site/settings.py +++ b/company_site/company_site/settings.py @@ -26,6 +26,7 @@ SECRET_KEY = 'django-insecure-0$+hho_6%-(ud^t%0zos(q&i@2&)9m+u&dgj77&51g$m#hr^0s # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True TIANJI_ENABLED = not DEBUG +WEBMCP_ENABLED = False ALLOWED_HOSTS = ["*"] @@ -71,6 +72,7 @@ TEMPLATES = [ 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'public.context_processors.tianji_tracking', + 'public.context_processors.webmcp_context', ], }, }, diff --git a/company_site/docs/agentic-browsing.md b/company_site/docs/agentic-browsing.md index c67bc33..0aac6c3 100644 --- a/company_site/docs/agentic-browsing.md +++ b/company_site/docs/agentic-browsing.md @@ -25,8 +25,17 @@ Test at minimum: | **sitemap.xml** | `GET /sitemap.xml` — public marketing URLs | | **Accessibility tree** | Form labels, semantic nav controls, ARIA on dialogs | | **Layout stability** | Fixed cookie banner, reserved hero/marquee space, font fallbacks | +| **WebMCP tools** | `navigator.modelContext` tools behind `WEBMCP_ENABLED` (see [webmcp.md](webmcp.md)) | -WebMCP is intentionally deferred until browser and agent support stabilizes. +## WebMCP (issue #9) + +When `WEBMCP_ENABLED=True`: + +- Navigation tools (`list_services`, `get_page_content`, `navigate_to_service`, `open_contact_with_subject`) load on all public pages +- Contact page registers `submit_contact_inquiry` and annotates the HTML form with `toolname` / `tooldescription` +- Default is **disabled** (`WEBMCP_ENABLED=False`) until deliberately enabled per environment + +Full tool catalog, Chrome flag setup, and reCAPTCHA notes: **[docs/webmcp.md](webmcp.md)** ## Regression checklist @@ -36,10 +45,12 @@ Before merging public-facing template or CSS changes: 2. Nav dropdowns use `