Regent MCP Server
This server lets AI agents operate the Regent website's Supabase backend through MCP tools, covering content, careers, leads, analytics, and transactional email.
Content: List, fetch, create, update, publish/unpublish, and delete blog posts, case studies, and resources.
Careers: Manage job postings and job applications, including creating/updating/deleting postings and updating application statuses.
Leads: Manage consultation requests, append internal inquiry notes, list newsletter subscribers, and view newsletter send history.
Analytics: Retrieve content analytics, insights, daily views, unique visitor counts, audience breakdowns, conversion stats, raw analytics detail, and the admin activity log.
Email: Send real newsletters and reply to consultation requests via the site's Resend-backed edge functions.
Access & security: Supports static API keys and OAuth, with per-agent scopes, revocation, and audit logging of MCP calls.
Enables sending transactional emails such as newsletters and consultation replies through Resend-backed Edge Functions.
Provides tools for managing a website's Supabase backend, including content publishing, job postings and applications, consultation leads, newsletter subscribers, analytics, and admin activity logging.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Regent MCP Server Show me the latest consultation requests and their statuses."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Regent MCP Server
An MCP (Model Context Protocol) server that lets AI agents perform operations on the Regent website's Supabase backend: content publishing, careers/job applications, lead management (consultations + newsletter), analytics, and transactional email (newsletter sends, consultation replies).
What it can do
Domain | Tools |
Content (blog posts, case studies, resources) |
|
Storage (resource files, blog/case-study images) |
|
Careers |
|
Leads |
|
Analytics |
|
Email (Edge Functions) |
|
This covers every table in the site's live schema (blog_posts, case_studies,
resources, careers, job_applications, consultation_requests,
inquiry_notes, newsletter_subscribers, newsletter_sends,
admin_activity_log) plus the analytics RPC functions already defined in the
database, the two storage buckets used by content (resource-files,
content-images), and the two Resend-backed edge functions for actually
sending email.
Storage tools
Resources need a real, publicly reachable file_url before create_content
can point at it — the content tools above only ever write DB rows, so
upload_resource_file is what actually puts bytes into Supabase Storage.
Tool | What it does |
| Lists the buckets an agent can upload into, their Supabase-level config (public/private, size limit, allowed MIME types), and what this server additionally enforces on top. |
| Lists files (and folders) in a bucket, optionally under a path prefix — name, size, content type, last modified. |
| Uploads a base64-encoded file to a bucket and returns its public URL, ready to drop into |
| Downloads a file by path. Files ≤2MB are returned inline as base64; larger files return the public URL instead of inlining the bytes, since both buckets are public. |
Buckets:
Bucket | For | Allowed types (enforced by this server) | Size limit |
| Downloadable resource documents (whitepapers, guides, checklists) | PDF, DOC, DOCX | 10MB |
| Blog/case-study images (covers, inline post images, | PNG, JPEG, WEBP, GIF, SVG | 10MB |
Note: the resource-files Supabase bucket itself doesn't enforce a MIME
restriction — the legacy admin editors (ResourceEditor, PostEditor,
CaseStudyEditor, RichTextEditor in the website repo) still upload images
into that same bucket today. upload_resource_file holds agents to
document types only for that bucket regardless, since that's what resources
are for; the bucket-level restriction can be tightened once those editors are
updated to use content-images for their image uploads.
The 10MB cap is enforced by this server before any bytes are sent to Supabase (checked after base64 decoding, so it reflects real file size, not payload size) — independent of whatever limit is set on the bucket itself.
Related MCP server: Supabase MCP Server
⚠️ Before you run this
This server uses the Supabase service role key, which bypasses Row Level Security entirely. Anything with access to run this server has full read/write/delete access to the production database. Treat the environment this runs in with the same care as production database credentials:
Never commit
.envor hardcode keys in source (see.gitignore).Only give this server to agents/people you'd trust with direct DB access.
The
delete_contentanddelete_job_postingtools are irreversible.delete_contentonly deletes the DB row — it does not remove the underlying file from storage if the row was a resource. Uploaded files are left orphaned in the bucket; there's nodelete_storage_filetool yet.send_newsletterandreply_to_consultationsend real emails — there's no dry-run mode built in yet. Consider adding a confirmation step in your agent's workflow before invoking them.
Setup
1. Install
npm install
npm run build2. Environment variables
Variable | Required | Purpose |
| Yes | Your Supabase project URL, e.g. |
| Yes | Service role key (Supabase dashboard → Settings → API) |
| Only for | Email of a Supabase Auth user with the |
| Only for | Password for that user |
| Yes, for OAuth | This deployment's public base URL, e.g. |
| Yes, for OAuth | Supabase anon/publishable key (Settings -> API). Used only to run |
The two email tools call the site's existing send-newsletter and
reply-consultation Edge Functions, which require a logged-in admin user's
JWT (not the raw service key) for authorization. Create a dedicated service
account user in Supabase Auth, add it to user_roles with role = 'admin',
and use its credentials here — don't reuse a real person's login.
Never put real values in a committed file. Set these as actual environment variables, or in your MCP client's config as shown below.
3. Register with an MCP client
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"regent-website": {
"command": "node",
"args": ["/absolute/path/to/regent-mcp-server/dist/index.js"],
"env": {
"SUPABASE_URL": "https://xxxx.supabase.co",
"SUPABASE_SERVICE_ROLE_KEY": "your-new-rotated-service-role-key",
"REGENT_ADMIN_EMAIL": "agent-service-account@yourdomain.com",
"REGENT_ADMIN_PASSWORD": "your-service-account-password"
}
}
}
}Any other MCP-compatible client (Claude Code, custom agent runtimes, etc.) works the same way — it's a standard stdio MCP server.
4. Test it locally
npx @modelcontextprotocol/inspector node dist/index.jsThis opens a browser UI where you can call each tool manually before wiring up an agent.
Project layout
src/
index.ts - entrypoint, registers all tool modules, starts stdio transport
supabase.ts - single Supabase client instance (service role)
tools/
content.ts - blog_posts / case_studies / resources CRUD + publish toggle + storage tools
careers.ts - job postings + applications
leads.ts - consultation_requests, inquiry_notes, newsletter_subscribers/sends
analytics.ts - wraps the DB's analytics RPC functions
edgeFunctions.ts - send_newsletter, reply_to_consultation (real email sends)Extending it
MCP HTTP hosting, auth, and admin additions
This repository now includes an HTTP-hosted MCP entry that is suitable for running as a Vercel serverless function, plus a lightweight per-agent API key model and audit logging. Files added/changed in this update:
src/auth.ts — agent lookup and helpers
src/logging.ts — input sanitization and fire-and-forget call logging
src/wrap-register.ts — patches McpServer.registerTool to enforce scopes and record mcp_call_log entries
api/mcp.ts — Vercel serverless function example using the SDK's streamable HTTP transport (adjust import if your SDK path differs)
src/create_agent.ts — convenience script to create an agent and print its API key once (run with npm run create-agent)
supabase/migrations/20260902_000001_create_mcp_agents.sql
supabase/migrations/20260902_000002_create_mcp_call_log.sql
See the "Deployment" and "Creating first agent" sections below for how to deploy and bootstrap the system.
OAuth (required for Claude.ai custom connectors)
Claude.ai's custom connector UI only supports OAuth-based authentication for
remote MCP servers - there is no field to paste a static bearer token or API
key (a static_headers option exists but is beta and org-admin-gated; if it
becomes available for your account it's the simpler path). This server
therefore implements a minimal OAuth 2.1 authorization server with Dynamic
Client Registration (RFC 7591) alongside the original static-key auth, so
both work:
Static key (
regent_mcp_sk_..., fromcreate-agent): still works for direct API/script use, e.g.curlor a custom integration.OAuth (
regent_at_...access tokens): used automatically when you add this server as a custom connector in Claude.ai. Claude discovers the OAuth endpoints via/.well-known/oauth-protected-resourceand/.well-known/oauth-authorization-server, registers itself as a client via/api/oauth/register, and sends the user (you) to/api/oauth/authorizeto sign in with your Supabase Auth admin credentials before issuing a token.
Both auth methods resolve to the same mcp_agents row and the same scope
enforcement in wrap-register.ts - OAuth is just a different way to get a
valid agent_id, not a separate permission model.
Setup steps specific to OAuth:
Run the new migration:
supabase/migrations/20260903_000001_create_oauth_tables.sql.Make sure a Supabase Auth user exists with the
adminrole inuser_roles(the same one used forREGENT_ADMIN_EMAILis fine) - this is the account you'll sign in with on the/oauth/authorizescreen.Set
MCP_PUBLIC_URLandSUPABASE_ANON_KEYin Vercel (see table above).In Claude.ai: Settings -> Connectors -> Add custom connector -> paste
https://<your-domain>/api/mcpas the server URL. Leave OAuth Client ID/Secret blank - DCR handles that automatically. Click Connect, sign in with your admin email/password, and approve.
The first time you sign in this way, a new mcp_agents row named
oauth:<your-email> is created automatically with full (*) scope, since
the login is already gated on the Supabase admin role.
Deployment (Vercel)
Create a new Vercel project from this repository (or connect an existing one).
Add the following environment variables to the Vercel project (Environment: Production and Preview):
SUPABASE_URL
SUPABASE_SERVICE_ROLE_KEY (service role key — keep secret)
REGENT_ADMIN_EMAIL (only required for send-email edge function callers)
REGENT_ADMIN_PASSWORD
MCP_ALLOW_LOCAL_NO_AUTH (optional, set to
1for local dev convenience only)
The
api/mcp.tsserverless file is the Vercel entrypoint — the MCP SDK's Streamable HTTP transport must be available at the import path used there. If your installed SDK exposes a different module path, editapi/mcp.tsto import the correct transport.Deploy to Vercel. After deployment, the MCP endpoint will be available as
https://<your-vercel-project>.vercel.app/api/mcp.
Notes:
The Vercel function uses the service role key server-side; requests to the endpoint must be authenticated with
Authorization: Bearer <api_key>where<api_key>is an agent key created via thecreate-agentscript or the admin dashboard (see below).
Creating the first agent (bootstrap)
Because the admin dashboard reads mcp_agents, you need a first agent that
can be used by your AI agents. Two options:
A) Run the one-off script (recommended).
SUPABASE_URL=https://... SUPABASE_SERVICE_ROLE_KEY=... npm run create-agent -- "Admin Agent" "*"
This prints a single API key once. Store it safely. The * scope grants
all permissions — treat it like a full admin key.
B) Use the Supabase SQL editor to insert a row into mcp_agents (not
recommended because you must compute the sha256 of the key yourself first).
When you create the first agent, you may want to immediately restrict it to admin usage and generate additional narrower-scoped keys for production agents.
Manual Supabase dashboard steps
In Supabase SQL editor run the migration files in
supabase/migrations/in the order listed by name. Thepgcryptoextension is enabled first.Create Row Level Security (RLS) policies for
mcp_agentsandmcp_call_logso that only users with theadminrole can read or write them from the web UI. The server-side MCP process uses the service role key and bypasses RLS when callingsupabasevia the service role client.The
resource-filesandcontent-imagesstorage buckets used by the storage tools above are created by migrations in the website repo (regent-website), not this one — apply those there first, orupload_resource_file/list_bucket_contentswill fail with a bucket-not-found error.
Example minimal policies (adjust to your project's role helpers):
-- Allow select/insert/update/delete for admins only create policy "mcp_agents_admins" on public.mcp_agents for all using ( has_role(auth.uid(), 'admin') ); create policy "mcp_call_log_admins" on public.mcp_call_log for select using ( has_role(auth.uid(), 'admin') );
If your project uses a different helper function than has_role, adapt the
policy accordingly.
Security notes
API keys are presented raw only at creation time and are stored hashed in the database (sha256). If a key is lost, revoke the agent and create a new key.
Revoke an agent by setting
revoked = trueandrevoked_at = now(); the wrapper immediately rejects calls from revoked keys.
The site also has these Edge Functions not yet wrapped as tools — add them the
same way as edgeFunctions.ts if you need them:
notify-consultation— internal Slack/email notification on new consultation (likely fires automatically already, probably doesn't need an agent tool)sync-resend-contact— syncs a subscriber to Resend's audience listunsubscribe— handles unsubscribe linksnewsletter-welcome— welcome email on signup
Most of these are triggered automatically by DB writes/webhooks already, so you likely only need to wrap ones an agent should invoke directly and deliberately, like the two included here.
Available Tools
28 toolsadd_inquiry_noteAdd note to consultation requestA
Append an internal note to a consultation request's thread (does not overwrite prior notes).
Inputs: message (required), inquiry_id (required), author_email.
create_contentCreate contentA
Create a new blog post, case study, or resource. Provide a JSON object matching the table's columns. blog_posts: slug, title, excerpt, content, author, date, category, read_time, published, meta_title, meta_description, og_image, image_url. case_studies: slug, title, industry, summary, challenge, solution, results (string array), metrics (JSON array of {label, value}), published, meta_title, meta_description, og_image, image_url. resources: slug, title, type ('Whitepaper'|'Research'|'Documentation'|'Case Study'), description, file_url, featured, published.
Inputs: table (required), fields (required).
create_job_postingCreate job postingC
Create a new job posting on the careers page.
Inputs: title (required), location (required), department (required), description (required), +2 more.
delete_contentDelete contentA
Permanently delete a blog post, case study, or resource by slug. This cannot be undone — confirm with the user before calling.
Inputs: slug (required), table (required).
delete_job_postingDelete job postingA
Permanently delete a job posting. Prefer unpublishing (update_job_posting with published: false) if you just want to close applications while keeping history.
Inputs: id (required).
get_admin_activity_logGet admin activity logB
Recent admin actions taken across the site (content edits, publishes, etc.), most recent first.
Inputs: limit.
get_analytics_detailGet raw analytics detailA
Paginated raw page-view events with full detail: session, device, browser, os, country, city, referrer, scroll depth, time on page, and any conversion. Use for drill-down investigation; prefer the summary tools for regular reporting.
Inputs: limit, offset.
get_audience_breakdownGet audience breakdownB
Visitor breakdown by dimension (e.g. device_type, browser, os, country) with counts per value.
Inputs: no named parameters.
get_consultation_requestGet consultation requestA
Fetch a single consultation request along with its internal notes thread.
Inputs: id (required).
get_contentGet content itemA
Fetch the full record (all fields, including body content) for a single blog post, case study, or resource by slug or id.
Inputs: table (required), id, slug.
get_content_analyticsGet content analyticsA
Per-content-item view counts, average time on page, average scroll depth, and last-viewed timestamp, across blog posts, case studies, and resources. Sorted by view count descending.
Inputs: no named parameters.
get_content_insightsGet content insightsA
Automated content performance categorization: top-performing ('stellar'), recently trending ('improving'), and stale/underperforming content, each with a suggested next action.
Inputs: no named parameters.
get_conversion_statsGet conversion statsA
Conversion counts and rates by conversion type (e.g. newsletter signup, consultation request) derived from tracked content views.
Inputs: no named parameters.
get_daily_viewsGet daily site viewsB
Daily page-view counts and unique session counts over a trailing window.
Inputs: days_back.
get_unique_visitors_countGet unique visitors countA
Total count of distinct visitors tracked across all time.
Inputs: no named parameters.
list_consultation_requestsList consultation requestsA
List inbound consultation/demo requests submitted via the site's contact form. Filter by status (e.g. 'new', 'replied', 'closed' — site-defined).
Inputs: limit, status.
list_contentList contentA
List blog posts, case studies, or resources. Returns published and unpublished items unless filtered.
Inputs: table (required), limit, published_only.
list_job_applicationsList job applicationsA
List applications submitted for job postings. Filter by career_id or status. Status is typically one of: new, reviewing, interviewing, offered, rejected, hired (site-defined, not enforced by DB).
Inputs: limit, status, career_id.
list_job_postingsList job postingsA
List all career/job postings, optionally filtered to published-only.
Inputs: published_only.
list_newsletter_sendsList newsletter send historyA
List past newsletter campaigns that were sent, with subject, sent/failed counts, and timestamps.
Inputs: limit.
list_newsletter_subscribersList newsletter subscribersB
List email newsletter subscribers, most recent first.
Inputs: limit.
reply_to_consultationReply to consultation requestA
Send an email reply to someone who submitted a consultation/demo request, via the site's reply-consultation function. This sends a real email to the requester and marks the request as replied. Confirm the message with the user before calling.
Inputs: body (required), subject (required), to_name (required), to_email (required), +1 more.
send_newsletterSend newsletterA
Send a newsletter campaign to all subscribers via the site's send-newsletter function (Resend). This actually dispatches real emails — confirm the subject and HTML content with the user before calling.
Inputs: html (required), subject (required).
set_content_publishedPublish or unpublish contentA
Toggle the published flag on a blog post, case study, or resource. Optionally set a future publish_at timestamp for scheduled publishing (blog_posts and case_studies only).
Inputs: slug (required), table (required), published (required), publish_at.
update_consultation_requestUpdate consultation requestA
Update a consultation request's status and/or admin_notes. Use add_inquiry_note instead if you want to append a timestamped note rather than overwrite admin_notes.
Inputs: id (required), status, admin_notes.
update_contentUpdate contentA
Update fields on an existing blog post, case study, or resource. Identify the row by slug or id, and pass only the fields you want to change.
Inputs: table (required), fields (required), id, slug.
update_job_application_statusUpdate job application statusC
Update the status of a job application (e.g. move a candidate to 'interviewing').
Inputs: id (required), status (required).
update_job_postingUpdate job postingB
Update fields on an existing job posting, identified by id.
Inputs: id (required), fields (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 28 tools
Most tools are clearly scoped to a single resource and action, and the descriptions clarify boundaries. The main risk is among the seven analytics tools, but their differing timeframes and aggregation levels are distinct enough to avoid serious misselection.
Tool names consistently follow a verb_noun snake_case pattern: list_, get_, create_, update_, delete_, set_, add_, send_, and reply_. Even mixed pluralization like list_job_applications vs get_consultation_request does not undermine the clear convention.
At 28 tools, the server exceeds the 25-tool threshold and feels heavy even though it spans several domains. The tools are individually useful, but the overall surface is large enough that an agent may struggle to scan and choose efficiently.
Content, job postings, consultation requests, newsletters, and analytics are largely well covered with sensible lifecycle operations. Minor gaps exist, such as no single get_job_posting tool and no subscriber management beyond listing and sending, but these can be worked around.
Maintenance
Related MCP Connectors
Supabase-compatible Postgres for agents: projects, branches, SQL, auth, storage, email.
Supabase Edge Functions MCP server with allowlisted tools and PostgreSQL RLS.
Your Supabase account in natural language: run SQL, apply migrations, manage tables, storage, edge f
Admin for your app from your AI agent: users, stats, segments, feature flags and email.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConnects AI assistants to Supabase projects, enabling them to manage tables, query data, deploy Edge Functions, handle migrations, and access project resources through natural language commands.Apache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to access and manage Supabase projects through the Model Context Protocol, supporting database operations, edge functions, storage, and documentation search. It provides a complete toolset for SQL execution, migration management, and real-time project debugging.-
- AlicenseNot gradedqualityDmaintenanceConnects Supabase projects to AI assistants, enabling them to manage database tables, execute SQL queries, and deploy Edge Functions through natural language. It provides a comprehensive suite of tools for project administration, including logs access, documentation search, and environment configuration.Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to safely interact with Supabase through read-only and gated-write tools, with bounded queries, allowlists, and explicit project targeting.-