mcp-server-product-studio

mcp-server-product-studio

A full-feature MCP server that serves as a product-development copilot, providing RAG search, SQL queries, and inline chart visualizations from seeded product data, with per-user identity and its own OAuth login.

Category
访问服务器

README

mcp-server-product-studio

A full-feature MCP server for the Connext platform — a small product-development copilot. It shows how to combine, in one server:

  • 🔐 Its own login — the server is its own OAuth 2.1 provider with a simple username/password page (same pattern as mcp-server-example).
  • 🔎 A RAG tool — semantic-ish search over product documents (customer interviews, feature requests, PRDs, competitor notes) with a dependency-free BM25 retriever.
  • 🗄️ A SQL tool — a read-only SQL query over a seeded product database (features / experiments / metrics).
  • 📊 A chart MCP App — tools that return an inline-SVG chart Connext renders in the chat, derived from the product data.
  • 👤 Per-user identity — tools run as the signed-in user (e.g. "my features").

It's fully self-contained: a seeded in-memory SQLite database + an in-memory doc corpus, so it clones and runs with zero external services. Built on FastMCP.


What it demonstrates

Capability Tool(s) Backed by
Retrieve unstructured context (the "why") search_product_docs rag.py — BM25 over a doc corpus
Query structured records (the "what/when") run_sql, describe_data db.py — read-only SQLite
Visualise the data chart_roadmap, chart_feature_adoption charts.py — inline SVG MCP App
Know who's asking all of them own OAuth login (auth.py)

The demo interactions that show them working together:

  • "What are customers saying about onboarding?"RAG
  • "Show build-stage features ranked by RICE"SQLchart
  • "How is the Onboarding checklist doing?"SQL + adoption chart
  • "Draft next sprint's priorities"RAG (pain points) + SQL (backlog)

Quick start

Requires Python 3.11+.

# 1. install
python -m venv .venv && source .venv/bin/activate
pip install -e .

# 2. run
python server.py
# -> serving on http://localhost:8000  (MCP endpoint: http://localhost:8000/mcp/)

# 3. in another terminal, connect the way a client does (opens a browser login)
python examples/connect_with_client.py
# sign in as  alice / password123   (or  priya / hunter2)

Demo users are product managers whose usernames own features in the data, so "my features" works:

username password owns
alice password123 Onboarding, Billing, SSO, …
priya hunter2 Growth, Activation, Dashboard, …

The tools

search_product_docs(query, limit=3) — BM25 retrieval over the doc corpus in rag.py (customer interviews, feature requests, support themes, competitor notes, PRDs). Returns the most relevant passages with scores.

describe_data()run_sql(sql) — the model calls describe_data for the schema, then run_sql with a SELECT. The query runs against a SQLite file opened read-only (mode=ro) and is additionally checked to be a single read-only statement — a tool can never mutate the data. The signed-in username is available for WHERE owner = '<username>'.

chart_roadmap(owner=None) and chart_feature_adoption(feature) — MCP Apps. Each returns a ToolResult carrying both a text summary (what the model reads) and a ui:// resource with self-contained HTML+SVG (what the user sees). Connext renders the HTML in a sandboxed iframe.


The data (all seeded, self-contained)

db.py — three tables modelling a team building a SaaS product:

features(id, title, stage, priority, rice_score, effort_weeks, owner, target_release)
  stage ∈ idea → discovery → design → build → beta → ga   (NPD stage-gate)
experiments(id, feature_id, hypothesis, metric, control, variant, lift_pct, status)
metrics(feature_id, week, adoption, retention)            (weekly time series)

rag.py — ~10 short product documents (interviews, requests, PRDs, competitor notes) that reference the same features, so RAG and SQL tell a joined story.


The chart MCP App

An MCP App is a tool whose result includes a ui:// resource carrying HTML. The charts here are inline SVG built in charts.py — no external scripts or assets, so they render under the iframe's strict Content-Security-Policy — and they use the host's var(--mcp-color-*) variables so they match the chat's light/dark theme. The two-series colours are a validated categorical palette (blue/aqua, checked for colour-blind separation and contrast).

# a chart tool returns text (for the model) + a ui:// resource (for the user)
return ToolResult(
    content=[
        TextContent(text="Roadmap chart: 6 alice's features — {...}"),
        EmbeddedResource(resource=TextResourceContents(
            uri="ui://product-studio/chart",
            mimeType="text/html;profile=mcp-app",
            text="<!doctype html>…<svg>…</svg>…")),
    ],
    structured_content={"counts": {...}},
)

Connecting it to Connext

Same as mcp-server-example — this server is its own OAuth provider, so Connext drives standard OAuth 2.1 with dynamic client registration:

  1. Expose the server on a public HTTPS URL and run it with PUBLIC_URL set to that URL (every OAuth discovery endpoint is built from it).
  2. Register it in Connext (Admin → MCP Servers → Add): URL https://<your-host>/mcp, Transport HTTP, Auth OAuth, client id/secret blank (dynamic registration handles it). Enable Allow UI so the charts render.
  3. Connect as a user — click Connect, sign in on this server's login page, and the agent can call the tools as that user.

Taking it to production

This example keeps everything in memory / in a demo file so it's easy to read. For a real deployment:

  • Users: replace DEMO_USERS in auth.py with your real user store + hashed passwords (or delegate to SSO — see the sibling mcp-server-entra-example).
  • SQL: point db.py at your real warehouse (Postgres/Snowflake/…) and keep the read-only + single-statement guardrails (add query timeouts + row limits).
  • RAG: swap the in-memory BM25 for a real vector store + embeddings (pgvector, etc.) and chunk your documents.
  • Charts: the SVG builders scale fine; add a hover/tooltip layer for richer interactivity if your host allows scripts in the MCP App iframe.
  • Tokens/HTTPS: persist tokens (or issue signed JWTs) and terminate TLS in front; set PUBLIC_URL to the https:// URL.

The files

File What it does
server.py Entry point: seeds the DB, builds the FastMCP server with its own OAuth login, registers tools + /health, runs it.
auth.py The OAuth provider + login page + demo users (from mcp-server-example).
db.py Seeded, read-only SQLite: features / experiments / metrics, plus the schema the SQL tool advertises.
rag.py The document corpus + a dependency-free BM25 retriever.
tools.py The five tools: search_product_docs, run_sql, describe_data, chart_roadmap, chart_feature_adoption.
charts.py Theme-aware inline-SVG chart builders + the MCP App HTML wrapper.
examples/connect_with_client.py A client that runs the same OAuth flow Connext does.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选