FastAPI backend template with an MCP Streamable HTTP server

FastAPI backend template with an MCP Streamable HTTP server

mcp-rest-sample•bybeaverhouse

A small backend template that serves a mock project and ticket domain through both REST endpoints and an MCP server at /mcp using Streamable HTTP, with MCP tools, resources, and prompts.

License: Not specified•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Exposes one mock domain through both REST endpoints and MCP, covering health, projects, ticket triage, and release notes on the REST side and matching project/ticket tools and resources over MCP.
  • •Provides MCP tools, resources, and prompts defined in an mcp_server module wired into the FastAPI app.
  • •Runs the MCP endpoint as stateless HTTP over Streamable HTTP, targeting the MCP Python SDK v2 beta.
  • •Keeps mock data in memory, leaving persistence to be added once REST and MCP boundaries are clear.

BEST FOR

  • •Developers building a backend that needs to serve both API clients over REST and agents over MCP from a single service.
  • •Learning how to structure a FastAPI app with an MCP Streamable HTTP endpoint and matching tools and resources.

ABOUT MCP-REST-SAMPLE

FastAPI backend template with an MCP Streamable HTTP server is cataloged as an MCP server attributed to beaverhouse. A small backend template that serves a mock project and ticket domain through both REST endpoints and an MCP server at /mcp using Streamable HTTP, with MCP tools, resources, and prompts. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for FastAPI backend template with an MCP Streamable HTTP server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Is this sample intended for production use?

No. The README describes it as a template and learning sample rather than a production MCP compatibility claim.

Does the sample implement OAuth or OpenID Connect discovery?

No. The sample does not implement OAuth or OpenID Connect discovery, and .well-known probe requests can return 404 in this local sample.

上游原版 README

在 GitHub 查看同一版本原文

README.md · de05ccec7284 · 采集于 2026-11-13 11:01:31 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Logo

FastAPI backend template with MCP Streamable HTTP.

Python FastAPI uv MCP License

Description

This repository is a small backend template for services that need both:

  • human/API-client access through REST endpoints
  • agent access through MCP (Model Context Protocol) tools, resources, and prompts

The app exposes one mock domain through both surfaces:

  • REST: /health, /projects, /projects/{project_id}, ticket triage, release notes
  • MCP: /mcp using Streamable HTTP, with matching project/ticket tools and resources

The mock data is intentionally in memory. Add a database only after the REST and MCP boundaries are clear.

MCP Status

This template targets the MCP Python SDK v2 beta and the 2026-07-28 release candidate direction. That means:

  • Streamable HTTP is the primary transport.
  • /mcp is stateless HTTP in this sample.
  • The SDK version is pinned exactly because v2 is still a pre-release.
  • This is a template and learning sample, not a production MCP compatibility claim.

Auth Discovery

This sample does not implement OAuth or OpenID Connect discovery. Some MCP clients may probe .well-known URLs before calling /mcp, such as:

  • /.well-known/oauth-protected-resource/mcp
  • /mcp/.well-known/oauth-protected-resource
  • /.well-known/oauth-authorization-server/mcp
  • /.well-known/openid-configuration/mcp

Those requests can return 404 Not Found in this local sample. That is expected as long as JSON-RPC requests to /mcp return 200 OK or 202 Accepted.

To turn this into an authenticated HTTP MCP server, add:

  • OAuth 2.0 Protected Resource Metadata for the MCP resource server.
  • Authorization Server Metadata or a documented external authorization server.
  • WWW-Authenticate headers on 401 Unauthorized responses that point clients to the protected resource metadata.
  • Bearer token validation on every MCP HTTP request, including audience checks so tokens are scoped to this MCP server.
  • Tests for anonymous access, invalid tokens, valid tokens, metadata discovery, and token audience failures.

Layout

app/
  main.py              # FastAPI app and /mcp route wiring
  mcp_server.py        # MCP tools, resources, prompts
  schemas.py           # Pydantic request/response models
  config.py            # pydantic-settings config
  internal/
    catalog.py         # mock domain logic
  routers/
    health.py
    projects.py
  tests/

Run Locally

cd app
uv sync --python 3.14 --prerelease allow
uv run uvicorn main:app --reload --host 127.0.0.1 --port 8001

Open:

  • REST docs: http://127.0.0.1:8001/docs
  • MCP endpoint: http://127.0.0.1:8001/mcp

Checks

Run the public checks directly with uv:

cd app
uv run ruff check .
uv run ruff format --check .
uv run mypy .
uv run pytest
uv audit

uv audit is included as the modern dependency-health command to run against the lockfile. Keep it visible, but treat upstream advisory availability and the current uv release status as operational context.

Key Notes

  • Keep REST/MCP layers thin: validate transport input, call internal logic, return typed models.
  • Be cautious when you make MCP for irreversible or destructive actions.
  • Add auth, database, background work, and external clients as separate layers.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for FastAPI backend template with an MCP Streamable HTTP server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-rest-sample)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools