Quiz App MCP server

Quiz App MCP server

A Python MCP server built with FastMCP that exposes tools for a quiz app, optionally backed by a MySQL database.

Category
访问服务器

README

Quiz App MCP server

A Python MCP (Model Context Protocol) server built with FastMCP. Exposes tools to:

  • Claude Desktop, locally, over stdio
  • claude.ai, remotely, over HTTP (deployed on Render)

Optionally backed by a MySQL database via SQLAlchemy.

Project layout

.
├── server.py           # entry point — branches on RENDER env var (stdio vs HTTP)
├── config.py            # loads .env, exposes shared SQLAlchemy engine
├── tools/
│   ├── __init__.py
│   └── quiz.py           # tool definitions — register(mcp) adds them to a FastMCP instance
├── .env                  # secrets — never commit
├── .env.example
└── requirements.txt

Setup

python -m venv venv
.\venv\Scripts\pip install -r requirements.txt
copy .env.example .env
# fill in .env with real DB credentials (or remove the DB_* lines if unused)

Run locally (stdio)

.\venv\Scripts\python.exe server.py

Or use the MCP inspector to call tools manually:

.\venv\Scripts\python.exe -m mcp dev server.py

Connect to Claude Desktop

Add to %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "quizapp": {
      "command": "C:\\path\\to\\project\\venv\\Scripts\\python.exe",
      "args": ["C:\\path\\to\\project\\server.py"]
    }
  }
}

Restart Claude Desktop — tools appear automatically.

Deploy to Render (HTTP, for claude.ai)

  1. Push to GitHub (.env is gitignored — never commit it).

  2. Create a Render Web Service connected to the repo.

  3. Set environment variables in the Render dashboard:

    Variable Value
    RENDER true
    DB_HOST your DB host
    DB_USER your DB user
    DB_PASSWORD your DB password
    DB_NAME your DB name
  4. Start command: python server.py

  5. In server.py, update BASE_URL under the RENDER branch to your actual Render URL.

  6. In claude.ai → Settings → Connectors, add: https://your-app.onrender.com/mcp

No auth is currently configured on the HTTP endpoint — anyone with the URL can call every tool, including DB-backed ones. This was an explicit choice to keep setup simple for now; revisit before exposing anything sensitive (see Security below).

Note

OAuth was removed from the HTTP endpoint for now — we're not using claude.ai against this server's DB/tools yet, so it wasn't worth the extra complexity. Add it back later if needed.

Keep-alive

Render's free tier sleeps after 15 minutes idle, which makes the first request after sleep slow (30–60s) or time out. Mitigations already in place:

  • A background thread in server.py pings /health every 10 minutes.
  • Add an external monitor (e.g. UptimeRobot) on https://your-app.onrender.com/health every 5 minutes — not on /mcp.

Adding a new tool

Open tools/quiz.py and add a function inside register(mcp):

@mcp.tool()
def my_new_tool(param1: str, param2: int) -> dict:
    """
    One-sentence description of what this tool does.
    The agent reads this docstring to decide when to call the tool.

    Args:
        param1: What this string parameter means.
        param2: What this integer parameter means.
    """
    result = do_something(param1, param2)
    return {"result": result}

No separate registration step — register(mcp) is called for both the stdio and HTTP instances.

Security

  • .env is gitignored — never commit it.
  • Tools never return raw SQL or expose the DB schema.
  • All queries use parameterized SQL (text("... WHERE id = :id"), not string interpolation).
  • Any user-supplied table/column name should be checked against an allowlist before use in SQL.
  • The Render HTTP endpoint has no authentication — treat it as public. Don't add tools that expose sensitive data or destructive DB operations until auth is added back.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选