← Files URLMatcherARCHIVED FILE
docs/mcp-contract.md
8.19 KB · Nov 30, 2026 · 07:40 UTC
# URLMatcher MCP contract ## Endpoint and discovery - Server name: `urlmatcher` - Transport: MCP Streamable HTTP - MCP endpoint: `https://api.urlmatcher.com/functions/v1/mcp` - Protected-resource metadata: `https://api.urlmatcher.com/functions/v1/mcp/.well-known/oauth-protected-resource` - OAuth issuer: `https://afkdcazjwbjaiucsphjb.supabase.co/auth/v1` - Authorization-server discovery: `https://afkdcazjwbjaiucsphjb.supabase.co/.well-known/oauth-authorization-server/auth/v1` The MCP resource uses URLMatcher's custom domain. Supabase currently advertises its original domain as the OAuth issuer; clients should follow the authorization server in the protected-resource metadata. Unauthenticated MCP calls return `401 Unauthorized` with a `WWW-Authenticate` challenge pointing to the protected-resource metadata. ## Authentication and authorization URLMatcher uses Supabase OAuth 2.1 authorization code flow with PKCE and Dynamic Client Registration. MCP clients discover and register themselves; users do not enter an API key, client ID, or client secret. Supabase access tokens use the standard `authenticated` audience. The server requires an OAuth `client_id` claim, forwards the bearer token to Supabase, and lets existing RLS policies enforce user-level access. IDs supplied as tool arguments are selectors, never authorization evidence. User IDs supplied by a caller are ignored. Project ownership, subscriptions, feature access, and credits are enforced by RLS and server-side business rules. ## Tools (26) ### Projects and crawls (11) - `projects_list`: list projects accessible to the authenticated user. - `project_create`: create a project for a public site under the authenticated account. It does not start a crawl. - `project_get`: return metadata for one accessible project. - `project_overview_get`: return `active_crawl`, `latest_completed_crawl`, and stored metrics with their own crawl/timestamp provenance. - `project_crawls_list`: list a project's crawl history, filterable by public status `running`, `finished`, or `failed`, with bounded cursor pagination. - `project_crawl_start`: start an asynchronous crawl for an owned project, or return the existing active crawl. The account and crawl limits used by the app apply. - `project_issues_list`: return issue counts and severities for one selected crawl. - `project_issue_urls_list`: return URL evidence for a supported issue key in one selected crawl. - `project_urls_list`: explore URL records for one selected crawl using filters such as `status_code`, `noindex`, and URL search. - `project_url_get`: return the complete record for one exact URL in one selected crawl. - `project_keywords_list`: return keyword snapshots with their date range and `fetched_at` timestamp. A snapshot with `data.source: synthetic_demo` contains illustrative sample figures, not Google Search Console measurements. To crawl a new website, call `projects_list`, `project_create` if needed, then `project_crawl_start`. Poll `project_crawls_list` until `finished` before treating results as complete. These writes are not idempotent. After a lost response, inspect the project or crawl list before retrying. Sites requiring HTTP Basic Auth must start their crawl in the app, where credentials are handled. A finished free trial cannot start new crawls unless the account has a paid plan. ### Migration checks (7) - `migration_runs_list`: list migration runs accessible to the authenticated user. - `migration_run_get`: return one migration run. - `migration_summary_get`: return the computed summary for a migration run. - `migration_findings_list`: return bounded, filterable migration findings. - `migration_finding_get`: return the finding for one URL and optional snapshot date. - `migration_queries_list`: return query snapshot data with date windows and source metric units. Filter with `old` for the old-site baseline, `new` for the new-site follow-up, or `old_follow` for the old-site follow-up. - `migration_repairs_list`: return technical repair findings with source evidence and proposed next steps. Migration tools may return `subscription_required` with `tier_needed` and `upgrade_url` when the user's plan does not include them. ### Matching analyses (5) - `link_opportunities_find`: run the app's Link Finder for up to ten selected target pages. - `redirect_suggestions_find`: run the app's 404 matching engine for measured crawl errors. - `analyses_list`: list saved MCP analyses. - `analysis_get`: read a saved analysis or export one page of results as CSV. - `not_found_sessions_list`: inspect existing 404 Finder sessions from the app. Both matching tools require a completed crawl. A new successful link analysis consumes one account credit per target URL; a redirect analysis consumes one per crawled error URL processed. Explain expected credit use before starting. Reuse the same `idempotency_key` with identical input for a retry. Suggestions are for review; the tools do not change a website or publish redirects. ### Existing redirect jobs (3) - `redirect_job_status`: return status and progress for one accessible redirect job. - `redirect_jobs_list`: list redirect jobs accessible to the authenticated user. - `redirect_job_cancel`: cancel an accessible job when its current state permits cancellation. Cancellation is a write. The old `redirect_plan_preview` and `redirect_plan_create` tools were removed because the job queue had no worker. ## Crawl selection The crawl-scoped project tools `project_issues_list`, `project_issue_urls_list`, `project_urls_list`, and `project_url_get` accept either: - `crawl_id`: an exact opaque crawl ID; or - `crawl_selector`: a semantic selector such as `latest_completed` or `active`. Do not send both. Omitting both selects `latest_completed`. For complete-data requests, clients should still resolve the crawl through `project_overview_get` or `project_crawls_list` and pass an explicit `crawl_id` so every follow-up is pinned to the same source. `latest_completed` selects the newest crawl whose public status is `finished`. It must never resolve to a newer running crawl. Selecting `active` returns partial data and response metadata with `is_partial: true`. Each crawl-scoped response identifies its source crawl, including `crawl_id`, crawl status, `started_at`, `finished_at` when available, and `is_partial`. Clients must state `finished_at` for completed results or `started_at` plus partial status for active results. `project_overview_get` keeps three concepts separate: - `active_crawl`: the currently running crawl, if any; - `latest_completed_crawl`: the latest crawl with status `finished`, if any; - `metrics`: stored metrics with their own `crawl_id` when bound, plus timestamps such as `computed_at` or `last_checked_at`. Metrics with a different or null `crawl_id` are not evidence for the selected URL/issue crawl and must be labelled separately. ## Pagination List endpoints are bounded and use opaque `next_cursor` values. Crawl-scoped cursors are fixed to the resolved `crawl_id`; every subsequent page must use the same crawl selection. A request for “all” records follows the cursor until `next_cursor` is `null`, while large results should be summarized or emitted compactly rather than dumped indiscriminately. ## Crawl-selection errors - `invalid_selection`: conflicting or unsupported crawl selection, including sending incompatible selectors. - `no_completed_crawl`: `latest_completed` was requested but the project has no crawl with status `finished`. - `no_active_crawl`: `active` was requested but no crawl is running. - `crawl_not_found`: the requested `crawl_id` does not exist or is inaccessible for the project. - `cursor_crawl_mismatch`: the supplied pagination cursor belongs to a different crawl than the current request. These errors are not reasons to silently switch crawls. ## Output and safety rules - Tools return concise text plus machine-readable `structuredContent`. - Timestamps use ISO 8601. - User-scoped Supabase tokens preserve RLS isolation. - Subscription and credit checks run server-side. - Matching analyses atomically save the result and charge the applicable credits. Replaying the same request with the same idempotency key returns the saved result; changing the payload returns a conflict. - Secrets and access tokens must never appear in logs or tool results.
SHA-256: 6e08b6eabab614f7143d44299e22d85bb264f9e946ece45aa8aa2420149dfc44