Skip to content

feat(mcp): expose prompts and topics through MCP tools and REST endpoints - #35

Merged
gkhngyk merged 1 commit into
mainfrom
feat/mcp-prompts-topics-tools
May 16, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feat/mcp-prompts-topics-tools

Conversation

@gkhngyk

@gkhngyk gkhngyk commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds two new tools / endpoints to the MCP surface so Claude can inspect a brand's prompt coverage and drill into individual prompts, not just visibility totals.
  • Unlocks the next layer of useful questions that were impossible to answer with `list_brands` + `get_visibility_summary` alone: "are my topics balanced?", "what's in my pricing topic?", "any inactive or mis-targeted prompts?"

New tools

Tool Signature Returns
`list_topics` `(brand_id)` `[{ id, name, is_active, prompt_count, created_at }]` — `prompt_count` computed in one round-trip, not N+1.
`list_prompts` `(brand_id, topic_id?, is_active?, limit?)` `[{ id, text, topic_id, topic_name, platforms[], models[], regions[], is_active, created_at }]` — default limit 100, max 500, newest first.

Both ride on the existing Streamable HTTP MCP endpoint and share a single data layer with their REST sub-routes (`/api/mcp/topics`, `/api/mcp/prompts`). Every call goes through the same ownership check — brand must belong to caller's organization — before any data is read.

New skill workflows

Both `ansvisor-aeo-coach` (MCP) and `ansvisor-aeo-coach-standalone` (REST) skills pick up two new opinionated workflows:

  • Prompt coverage audit — `list_topics` → flag empty / under-covered / over-concentrated topics with a single-suggestion next step. Healthy band ≈ 3–8 prompts per topic.
  • Prompt deep-dive — resolve topic by name → `list_prompts` → short list with the operational signals a marketer cares about (platforms, models, active flag). Flags effectively-silent prompts (zero platforms or zero models).

Docs

  • Mintlify `docs/guides/mcp-server.mdx` updated — tool table now lists 4, "Try it" examples include the new prompt-coverage questions.
  • Formal REST API reference for `/api/mcp/*` is still a gap; tracked separately, not blocking this PR.

Test plan

  • `curl /api/mcp/topics?brand_id=` returns topics with `prompt_count`.
  • `curl /api/mcp/prompts?brand_id=&limit=3` returns 3 newest prompts with joined `topic_name`.
  • `/api/mcp/prompts` with `topic_id` filters correctly; with `is_active=false` returns only inactive.
  • MCP tool calls fire from Claude Desktop / Code when asked: "Are my topics balanced?" → `list_topics` invoked; "Show me prompts in my pricing topic" → `list_topics` then `list_prompts` chain.
  • Wrong-org `brand_id` returns 404 (not 200 with empty data).

…ints

Adds two new tools / endpoints to the MCP surface so Claude can
inspect a brand's prompt coverage and drill into individual prompts,
not just visibility totals. This unlocks the next layer of useful
questions ("are my topics balanced?", "what's in my pricing topic?",
"any inactive or mis-targeted prompts?") that were impossible to
answer with list_brands + get_visibility_summary alone.

What's new:

- list_topics(brand_id) — returns each topic on the brand with a
  prompt_count, computed in one round-trip rather than N+1.
- list_prompts(brand_id, topic_id?, is_active?, limit?) — returns
  prompt text, joined topic name, platforms, models, regions, active
  flag. Default limit 100, max 500, newest first.

Both tools live alongside the existing two on the same Streamable
HTTP endpoint and share a single data layer with their parallel REST
sub-routes (/api/mcp/topics, /api/mcp/prompts). Every call goes
through the same ownership check — the brand must belong to the
caller's organization — before any data is read.

The ansvisor-aeo-coach skill (MCP) and ansvisor-aeo-coach-standalone
skill (REST) both pick up two new workflows on top of the tools:
prompt coverage audit (flags empty / under-covered / over-
concentrated topics with a single-suggestion next step) and prompt
deep-dive (resolves a topic by name, lists its prompts with the
operational signals a marketer cares about — platforms, models,
active flag — and flags effectively-silent prompts).

Mintlify guide updated so the public docs reflect the new tool
surface; api-reference for /api/mcp/* is still a gap and tracked
separately.

This branch was successfully deployed

1 active deployment
Preview — e102109c Deployed May 16, 2026 by vercel[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