Skip to content
Back to search

fastapi-mcp-langgraph-template

A modern template for agentic orchestration — built for rapid iteration and scalable deployment using highly customizable, community-supported tools like MCP, LangGraph, and more.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/nicholasgoh--fastapi-mcp-langgraph-template/badge.svg)](/listings/nicholasgoh--fastapi-mcp-langgraph-template)

HTML

<a href="/listings/nicholasgoh--fastapi-mcp-langgraph-template"><img src="/api/listings/nicholasgoh--fastapi-mcp-langgraph-template/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

The current template does not connect to all MCP servers. Additionally, the API server communicates with the database using a SQL ORM.

graph LR

  subgraph localhost
    A[API Server]
    B[DBHub Server]
    C[Youtube Server]
    D[Custom Server]
  end

  subgraph Supabase Cloud
    E[Supabase DB]
  end

  A<-->|Protocol|D
  A<-->E

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 310 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/nicholasgoh-fastapi-mcp-langgraph-template-badge.png)](https://mseep.ai/app/nicholasgoh-fastapi-mcp-langgraph-template)
  2. # FastAPI MCP LangGraph Template
  3. A modern template for agentic orchestration — built for rapid iteration and scalable deployment using highly customizable, community-supported tools like MCP, LangGraph, and more.
  4. Visit the Github: [![FastAPI MCP LangGraph Template](https://img.shields.io/github/stars/nicholasgoh/fastapi-mcp-langgraph-template?label=FastAPI%20MCP%20LangGraph%20Template)](https://github.com/NicholasGoh/fastapi-mcp-langgraph-template) [![FastAPI MCP LangGraph Template](https://img.shields.io/github/v/tag/nicholasgoh/fastapi-mcp-langgraph-template?style=flat)](https://github.com/NicholasGoh/fastapi-mcp-langgraph-template)
  5. > [!NOTE]
  6. > Read the docs with demo videos [here](https://nicholas-goh.com/docs/intro?ref=fastapi-mcp-langgraph-template). This repo will not contain demo videos.
  7. <!--toc:start-->
  8. - [FastAPI MCP LangGraph Template](#fastapi-mcp-langgraph-template)
  9. - [Core Features](#core-features)
  10. - [Technology Stack and Features](#technology-stack-and-features)
  11. - [Planned Features](#planned-features)
  12. - [Architecture](#architecture)
  13. - [Inspector](#inspector)
  14. - [Template Setup](#template-setup)
  15. - [Reverse Proxy](#reverse-proxy)
  16. - [Planned Features Diagrams](#planned-features-diagrams)
  17. - [Monitoring and Observability](#monitoring-and-observability)
  18. - [Authentication and Authorization](#authentication-and-authorization)
  19. - [Quick Start](#quick-start)
  20. - [Development](#development)
  21. - [VSCode Devcontainer](#vscode-devcontainer)
  22. - [Without VSCode Devcontainer](#without-vscode-devcontainer)
  23. - [Debugging](#debugging)
  24. - [Refactored Markdown Files](#refactored-markdown-files)
  25. - [MCP](#mcp)
  26. - [LangGraph](#langgraph)
  27. - [Supabase](#supabase)
  28. - [Langfuse](#langfuse)
  29. - [Grafana Stack](#grafana-stack)
  30. <!--toc:end-->
  31. ## Core Features
  32. [![MCP Client](https://img.shields.io/github/stars/modelcontextprotocol/python-sdk?logo=modelcontextprotocol&label=MCP-Client)](https://github.com/modelcontextprotocol/python-sdk) is an open protocol that standardizes how apps provide context to LLMs.
  33. - Seamlessly integrates LLM with growing list of community integrations found here [![MCP Server](https://img.shields.io/github/stars/modelcontextprotocol/servers?logo=modelcontextprotocol&label=MCP-Servers)](https://github.com/modelcontextprotocol/servers)
  34. - No LLM provider lock in
  35. [![LangGraph](https://img.shields.io/github/stars/langchain-ai/langgraph?logo=langgraph&label=LangGraph)](https://github.com/langchain-ai/langgraph) for Customizable Agentic Orchestration
  36. - Native streaming for UX in complex Agentic Workflows
  37. - Native persisted chat history and state management
  38. ### Technology Stack and Features
  39. - [![FastAPI](https://img.shields.io/github/stars/fastapi/fastapi?logo=fastapi&label=fastapi)](https://github.com/fastapi/fastapi) for Python backend API
  40. - [![SQLModel](https://img.shields.io/github/stars/fastapi/sqlmodel?logo=sqlmodel&label=SQLModel)](https://github.com/fastapi/sqlmodel) for Python SQL database interactions (ORM + Validation).
  41. - Wrapper of [![SQLAlchemy](https://img.shields.io/github/stars/sqlalchemy/sqlalchemy?logo=sqlalchemy&label=SQLAlchemy)](https://github.com/sqlalchemy/sqlalchemy)
  42. - [![LangFuse](https://img.shields.io/github/stars/langfuse/langfuse?logo=langfuse&label=LangFuse)](https://github.com/langfuse/langfuse) for LLM Observability and LLM Metrics
  43. - [![Pydantic](https://img.shields.io/github/stars/pydantic/pydantic?logo=pydantic&label=Pydantic)](https://github.com/pydantic/pydantic) for Data Validation and Settings Management.
  44. - [![Supabase](https://img.shields.io/github/stars/supabase/supabase?logo=supabase&label=Supabase)](https://github.com/supabase/supabase) for DB RBAC
  45. - [![PostgreSQL](https://img.shields.io/github/stars/postgres/postgres?logo=postgresql&label=Postgres)](https://github.com/postgres/postgres) Relational DB
  46. - [![PGVector](https://img.shields.io/github/stars/pgvector/pgvector?logo=postgresql&label=PGVector)](https://github.com/pgvector/pgvector) Vector Store
  47. - [![Nginx](https://img.shields.io/github/stars/nginx/nginx?logo=nginx&label=Nginx)](https://github.com/nginx/nginx) Reverse Proxy
  48. - [![Compose](https://img.shields.io/github/stars/docker/compose?logo=docker&label=Compose)](https://github.com/docker/compose) for development and production.
  49. ### Planned Features
  50. - [![Prometheus](https://img.shields.io/github/stars/prometheus/prometheus?logo=prometheus&label=Prometheus)](https://github.com/prometheus/prometheus) for scraping Metrics
  51. - [![Grafana](https://img.shields.io/github/stars/prometheus/prometheus?logo=grafana&label=Grafana)](https://github.com/grafana/grafana) for visualizing Metrics
  52. - [![Auth0](https://img.shields.io/badge/Auth0-white?logo=auth0)](https://auth0.com/docs) SaaS for Authentication and Authorization with OIDC & JWT via OAuth 2.0
  53. - CI/CD via Github Actions
  54. - :dollar: Deploy live demo to [![Fargate](https://img.shields.io/badge/Fargate-white.svg?logo=awsfargate)](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html)
  55. - Provision with [![Terraform](https://img.shields.io/github/stars/hashicorp/terraform?logo=terraform&label=Terraform)](https://github.com/hashicorp/terraform) IaC
  56. - Push built images to ECR and Dockerhub
  57. ## Architecture
  58. This section outlines the architecture of the services, their interactions, and planned features.
  59. ### Inspector
  60. Inspector communicates via SSE protocol with each MCP Server, while each server adheres to MCP specification.
  61. ```mermaid
  62. graph LR
  63. subgraph localhost
  64. A[Inspector]
  65. B[DBHub Server]
  66. C[Youtube Server]
  67. D[Custom Server]
  68. end
  69. subgraph Supabase Cloud
  70. E[Supabase DB]
  71. end
  72. subgraph Google Cloud
  73. F[Youtube API]
  74. end
  75. A<-->|Protocol|B
  76. A<-->|Protocol|C
  77. A<-->|Protocol|D
  78. B<-->E
  79. C<-->F
  80. ```
  81. ### Template Setup
  82. The current template does not connect to all MCP servers. Additionally, the API server communicates with the database using a SQL ORM.
  83. ```mermaid
  84. graph LR
  85. subgraph localhost
  86. A[API Server]
  87. B[DBHub Server]
  88. C[Youtube Server]
  89. D[Custom Server]
  90. end
  91. subgraph Supabase Cloud
  92. E[Supabase DB]
  93. end
  94. A<-->|Protocol|D
  95. A<-->E
  96. ```
  97. ### Reverse Proxy
  98. Can be extended for other services like Frontend and/or certain backend services self-hosted instead of on cloud (e.g., Langfuse).
  99. ```mermaid
  100. graph LR
  101. A[Web Browser]
  102. subgraph localhost
  103. B[Nginx Reverse Proxy]
  104. C[API Server]
  105. end
  106. A-->B
  107. B-->C
  108. ```
  109. ### Planned Features Diagrams
  110. #### Monitoring and Observability
  111. ```mermaid
  112. graph LR
  113. subgraph localhost
  114. A[API Server]
  115. end
  116. subgraph Grafana Cloud
  117. B[Grafana]
  118. end
  119. subgraph Langfuse Cloud
  120. C[Langfuse]
  121. end
  122. A -->|Metrics & Logs| B
  123. A -->|Traces & Events| C
  124. ```
  125. #### Authentication and Authorization
  126. ![Auth0 Diagram](https://images.ctfassets.net/cdy7uua7fh8z/7mWk9No612EefC8uBidCqr/821eb60b0aa953b0d8e4afe897228844/Auth-code-flow-diagram.png)
  127. [Auth0 Source](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow)
  128. ## Quick Start
  129. Setup to run the repository in both production and development environments.
  130. Build community youtube MCP image with:
  131. ```bash
  132. ./community/youtube/build.sh
  133. ```
  134. :::tip
  135. Instead of cloning or submoduling the repository locally, then building the image, this script builds the Docker image inside a temporary Docker-in-Docker container. This approach avoids polluting your local environment with throwaway files by cleaning up everything once the container exits.
  136. :::
  137. Then build the other images with:
  138. ```bash
  139. docker compose -f compose-dev.yaml build
  140. ```
  141. Copy environment file:
  142. ```bash
  143. cp .env.sample .env
  144. ```
  145. Add your following API keys and value to the respective file: `./envs/backend.env`, `./envs/youtube.env` and `.env`.
  146. ```bash
  147. OPENAI_API_KEY=sk-proj-...
  148. POSTGRES_DSN=postgresql://postgres...
  149. LANGFUSE_PUBLIC_KEY=pk-lf-...
  150. LANGFUSE_SECRET_KEY=sk-lf-...
  151. LANGFUSE_HOST=https://cloud.langfuse.com
  152. ENVIRONMENT=production
  153. YOUTUBE_API_KEY=...
  154. ```
  155. Set environment variables in shell: (compatible with `bash` and `zsh`)
  156. ```bash
  157. set -a; for env_file in ./envs/*; do source $env_file; done; set +a
  158. ```
  159. Start production containers:
  160. ```bash
  161. docker compose up -d
  162. ```
  163. <ReactPlayer playing controls url='/vid/fastapi-mcp-langgraph-template/api.mp4' />
  164. ## Development
  165. First, set environment variables as per above.
  166. ### VSCode Devcontainer
  167. <ReactPlayer playing controls url='/vid/fastapi-mcp-langgraph-template/vscode.mp4' />
  168. <br/>
  169. :::warning
  170. Only replace the following if you plan to start debugger for FastAPI server in VSCode.
  171. :::
  172. Replace `./compose-dev.yaml` entrypoint to allow debugging FastAPI server:
  173. ```yaml title="./compose-dev.yaml"
  174. api:
  175. image: api:prod
  176. build:
  177. dockerfile: ./backend/api/Dockerfile
  178. # highlight-next-line
  179. entrypoint: bash -c "sleep infinity"
  180. env_file:
  181. - ./envs/backend.env
  182. ```
  183. Then:
  184. ```bash
  185. code --no-sandbox .
  186. ```
  187. Press `F1` and type `Dev Containers: Rebuild and Reopen in Container` to open containerized environment with IntelliSense and Debugger for FastAPI.
  188. ### Without VSCode Devcontainer
  189. Run development environment with:
  190. ```bash
  191. docker compose -f compose-dev.yaml up -d
  192. ```
  193. ## Debugging
  194. Sometimes in development, nginx reverse proxy needs to reload its config to route services properly.
  195. ```bash
  196. docker compose -f compose-dev.yaml exec nginx sh -c "nginx -s reload"
  197. ```
  198. ## Refactored Markdown Files
  199. The following markdown files provide additional details on other features:
  200. ### MCP
  201. [`./docs/mcp.md`](./docs/mcp.md)
  202. ### LangGraph
  203. [`./docs/langgraph.md`](./docs/langgraph.md)
  204. ### Supabase
  205. [`./docs/supabase.md`](./docs/supabase.md)
  206. ### Langfuse
  207. [`./docs/langfuse.md`](./docs/langfuse.md)
  208. ### Grafana Stack
  209. [`./docs/grafana-stack.md`](./docs/grafana-stack.md)
  210. [![Star History Chart](https://api.star-history.com/svg?repos=nicholasgoh/fastapi-mcp-langgraph-template&type=Date)](https://www.star-history.com/#nicholasgoh/fastapi-mcp-langgraph-template&Date)
  211. > [!NOTE]
  212. > Click above to view live update on star history as per their [article](https://www.star-history.com/blog/a-message-to-github-star-history-users):
  213. > Ongoing Broken Live Chart
  214. > you can still use this website to view and download charts (though you may need to provide your own token).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.