Skip to content

feat(mcp): ship remote MCP server with API keys + 2 initial tools - #20

Merged
gkhngyk merged 1 commit into
mainfrom
feat/mcp-server-foundation
May 15, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feat/mcp-server-foundation

Conversation

@gkhngyk

@gkhngyk gkhngyk commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a remote, zero-install Model Context Protocol endpoint at `/api/mcp` that speaks the MCP Streamable HTTP transport in stateless mode. Claude Desktop, Claude Code, Cursor, Zed, etc. can now talk to Ansvisor data with a single URL + bearer token.
  • New `api_keys` table (`00003_api_keys.sql`) — sha256-hashed long-lived tokens with per-user RLS. Settings → API Keys section to list / create (one-time reveal) / revoke, with the MCP endpoint URL inline for copy-paste.
  • Two initial tools — `list_brands` and `get_visibility_summary` — share a single data layer with the curl-able REST sub-routes (`/api/mcp/brands`, `/api/mcp/visibility-summary`, `/api/mcp/whoami`).
  • Mintlify guide added under Platform Guides with Claude Desktop / Claude Code config snippets.
  • README ‘What's next’ + CONTRIBUTING migration step updated to reflect the new flow.

Why remote-first

  • Cloud users: zero install, no Node/PATH/Windows pain.
  • Self-host: same endpoint on the user's own `/api/mcp`.
  • Auto-updates on deploy — clients don't have to `npm update` anything.
  • Reuses the existing HTTPS + auth surface.

Test plan

  • Migration applied via Supabase MCP — only new `api_keys` table, existing data untouched.
  • Generate a key from Settings → API Keys, confirm one-time reveal modal works.
  • `curl /api/mcp/whoami` returns `{userId, email, organizationId}` with the key.
  • `curl /api/mcp/brands` returns the user's brands list.
  • MCP `initialize` over `/api/mcp` succeeds and tool calls return data.
  • Wire Claude Desktop to the local endpoint, ask "List my brands" — tool call fires and answer is returned in natural language.
  • Revoke a key — same token immediately returns 401.

Follow-up

  • More tools (share-of-voice, prompt list, content briefs, trigger tracking) — landing in subsequent PRs.
  • Claude Code skills on top of these tools — opinionated workflows for the same MCP endpoint.

Add a Streamable HTTP Model Context Protocol endpoint at /api/mcp so
Claude Desktop, Claude Code, Cursor, Zed, and any other MCP-aware
client can query brand visibility data over a single URL + bearer
token — no npm install, no local proxy.

- New api_keys table with sha256-hashed long-lived bearer tokens,
  per-user RLS, prefix shown in the UI for identification.
- Auth helper accepts only ans_-prefixed keys for MCP routes; the
  dashboard's Supabase session is intentionally not honoured here.
- Settings → API Keys section: list / create (one-time reveal) /
  revoke, with the MCP endpoint URL inline for copy-paste.
- Tool handlers and REST sub-routes share a single data layer so the
  curl-able /api/mcp/brands and /api/mcp/visibility-summary endpoints
  return exactly what the MCP tools return.
- Stateless transport: each request gets a fresh McpServer + transport
  bound to the caller's user context, then discarded.
- Mintlify guide added under Platform Guides with Claude Desktop /
  Claude Code config snippets.
@vercel

vercel Bot commented May 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ansvisor Ready Ready Preview, Comment May 15, 2026 4:22pm

Request Review

@mintlify

mintlify Bot commented May 15, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ansvisor 🟢 Ready View Preview May 15, 2026, 4:22 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

This branch was successfully deployed

2 active deployments
Preview — b39f99f6 Deployed May 15, 2026 by vercel[bot]
staging - docs — b39f99f6 Deployed May 15, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant