{"id":27837981,"url":"https://github.com/NicholasGoh/fastapi-mcp-langgraph-template","last_synced_at":"2025-05-02T23:01:10.594Z","repository":{"id":289580761,"uuid":"967463473","full_name":"NicholasGoh/fastapi-mcp-langgraph-template","owner":"NicholasGoh","description":"A modern template for agentic orchestration — built for rapid iteration and scalable deployment using highly customizable, community-supported tools like MCP, LangGraph, and more.","archived":false,"fork":false,"pushed_at":"2025-05-01T11:35:45.000Z","size":7339,"stargazers_count":336,"open_issues_count":0,"forks_count":49,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-01T12:30:12.360Z","etag":null,"topics":["compose","fastapi","grafana","langfuse","langgraph-python","mcp","nginx","prometheus","sqlmodel","supabase"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NicholasGoh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-16T13:47:46.000Z","updated_at":"2025-05-01T11:23:44.000Z","dependencies_parsed_at":"2025-04-24T02:33:42.777Z","dependency_job_id":"e8c0782d-0590-4739-875d-ccd338366fe3","html_url":"https://github.com/NicholasGoh/fastapi-mcp-langgraph-template","commit_stats":null,"previous_names":["nicholasgoh/fastapi-mcp-langgraph-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicholasGoh%2Ffastapi-mcp-langgraph-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicholasGoh%2Ffastapi-mcp-langgraph-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicholasGoh%2Ffastapi-mcp-langgraph-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NicholasGoh%2Ffastapi-mcp-langgraph-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NicholasGoh","download_url":"https://codeload.github.com/NicholasGoh/fastapi-mcp-langgraph-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252118316,"owners_count":21697583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compose","fastapi","grafana","langfuse","langgraph-python","mcp","nginx","prometheus","sqlmodel","supabase"],"created_at":"2025-05-02T23:01:09.975Z","updated_at":"2025-05-02T23:01:10.584Z","avatar_url":"https://github.com/NicholasGoh.png","language":"Python","funding_links":[],"categories":["📚 Projects (1974 total)","📋 Templates \u0026 Starters","MCP Frameworks and libraries"],"sub_categories":["MCP Servers","🟩 Development Tools 🛠️","Python"],"readme":"# FastAPI MCP LangGraph Template\n\nA modern template for agentic orchestration — built for rapid iteration and scalable deployment using highly customizable, community-supported tools like MCP, LangGraph, and more.\n\nVisit 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)\n\n\u003e [!NOTE]\n\u003e 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.\n\n\u003c!--toc:start--\u003e\n- [FastAPI MCP LangGraph Template](#fastapi-mcp-langgraph-template)\n  - [Core Features](#core-features)\n    - [Technology Stack and Features](#technology-stack-and-features)\n    - [Planned Features](#planned-features)\n  - [Architecture](#architecture)\n    - [Inspector](#inspector)\n    - [Template Setup](#template-setup)\n    - [Reverse Proxy](#reverse-proxy)\n    - [Planned Features Diagrams](#planned-features-diagrams)\n      - [Monitoring and Observability](#monitoring-and-observability)\n      - [Authentication and Authorization](#authentication-and-authorization)\n  - [Quick Start](#quick-start)\n  - [Development](#development)\n    - [VSCode Devcontainer](#vscode-devcontainer)\n    - [Without VSCode Devcontainer](#without-vscode-devcontainer)\n  - [Debugging](#debugging)\n  - [Refactored Markdown Files](#refactored-markdown-files)\n    - [MCP](#mcp)\n    - [LangGraph](#langgraph)\n    - [Supabase](#supabase)\n    - [Langfuse](#langfuse)\n    - [Grafana Stack](#grafana-stack)\n\u003c!--toc:end--\u003e\n\n## Core Features\n\n[![MCP Client](https://img.shields.io/github/stars/modelcontextprotocol/python-sdk?logo=modelcontextprotocol\u0026label=MCP-Client)](https://github.com/modelcontextprotocol/python-sdk) is an open protocol that standardizes how apps provide context to LLMs.\n  - Seamlessly integrates LLM with growing list of community integrations found here [![MCP Server](https://img.shields.io/github/stars/modelcontextprotocol/servers?logo=modelcontextprotocol\u0026label=MCP-Servers)](https://github.com/modelcontextprotocol/servers)\n  - No LLM provider lock in\n\n[![LangGraph](https://img.shields.io/github/stars/langchain-ai/langgraph?logo=langgraph\u0026label=LangGraph)](https://github.com/langchain-ai/langgraph) for Customizable Agentic Orchestration\n- Native streaming for UX in complex Agentic Workflows\n- Native persisted chat history and state management\n\n### Technology Stack and Features\n\n- [![FastAPI](https://img.shields.io/github/stars/fastapi/fastapi?logo=fastapi\u0026label=fastapi)](https://github.com/fastapi/fastapi) for Python backend API\n- [![SQLModel](https://img.shields.io/github/stars/fastapi/sqlmodel?logo=sqlmodel\u0026label=SQLModel)](https://github.com/fastapi/sqlmodel) for Python SQL database interactions (ORM + Validation).\n  - Wrapper of [![SQLAlchemy](https://img.shields.io/github/stars/sqlalchemy/sqlalchemy?logo=sqlalchemy\u0026label=SQLAlchemy)](https://github.com/sqlalchemy/sqlalchemy)\n- [![Pydantic](https://img.shields.io/github/stars/pydantic/pydantic?logo=pydantic\u0026label=Pydantic)](https://github.com/pydantic/pydantic) for Data Validation and Settings Management.\n- [![Supabase](https://img.shields.io/github/stars/supabase/supabase?logo=supabase\u0026label=Supabase)](https://github.com/supabase/supabase) for DB RBAC\n  - [![PostgreSQL](https://img.shields.io/github/stars/postgres/postgres?logo=postgresql\u0026label=Postgres)](https://github.com/postgres/postgres) Relational DB\n  - [![PGVector](https://img.shields.io/github/stars/pgvector/pgvector?logo=postgresql\u0026label=PGVector)](https://github.com/pgvector/pgvector) Vector Store\n- [![Nginx](https://img.shields.io/github/stars/nginx/nginx?logo=nginx\u0026label=Nginx)](https://github.com/nginx/nginx) Reverse Proxy\n- [![Compose](https://img.shields.io/github/stars/docker/compose?logo=docker\u0026label=Compose)](https://github.com/docker/compose) for development and production.\n\n### Planned Features\n\n- [![LangFuse](https://img.shields.io/github/stars/langfuse/langfuse?logo=langfuse\u0026label=LangFuse)](https://github.com/langfuse/langfuse) for LLM Observability and LLM Metrics\n- [![Prometheus](https://img.shields.io/github/stars/prometheus/prometheus?logo=prometheus\u0026label=Prometheus)](https://github.com/prometheus/prometheus) for scraping Metrics\n- [![Grafana](https://img.shields.io/github/stars/prometheus/prometheus?logo=grafana\u0026label=Grafana)](https://github.com/grafana/grafana) for visualizing Metrics\n- [![Auth0](https://img.shields.io/badge/Auth0-white?logo=auth0)](https://auth0.com/docs) SaaS for Authentication and Authorization with OIDC \u0026 JWT via OAuth 2.0\n- CI/CD via Github Actions\n  - :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)\n  - Provision with [![Terraform](https://img.shields.io/github/stars/hashicorp/terraform?logo=terraform\u0026label=Terraform)](https://github.com/hashicorp/terraform) IaC\n  - Push built images to ECR and Dockerhub\n\n## Architecture\n\nThis section outlines the architecture of the services, their interactions, and planned features.\n\n### Inspector\n\nInspector communicates via SSE protocol with each MCP Server, while each server adheres to MCP specification.\n\n```mermaid\ngraph LR\n\n  subgraph localhost\n    A[Inspector]\n    B[DBHub Server]\n    C[Youtube Server]\n    D[Custom Server]\n  end\n\n  subgraph Supabase Cloud\n    E[Supabase DB]\n  end\n\n  subgraph Google Cloud\n    F[Youtube API]\n  end\n\n  A\u003c--\u003e|Protocol|B\n  A\u003c--\u003e|Protocol|C\n  A\u003c--\u003e|Protocol|D\n  B\u003c--\u003eE\n  C\u003c--\u003eF\n```\n\n### Template Setup\n\nThe current template does not connect to all MCP servers. Additionally, the API server communicates with the database using a SQL ORM.\n\n```mermaid\ngraph LR\n\n  subgraph localhost\n    A[API Server]\n    B[DBHub Server]\n    C[Youtube Server]\n    D[Custom Server]\n  end\n\n  subgraph Supabase Cloud\n    E[Supabase DB]\n  end\n\n  A\u003c--\u003e|Protocol|D\n  A\u003c--\u003eE\n```\n\n### Reverse Proxy\n\nCan be extended for other services like Frontend and/or certain backend services self-hosted instead of on cloud (e.g., Langfuse).\n\n```mermaid\ngraph LR\n  A[Web Browser]\n\n  subgraph localhost\n    B[Nginx Reverse Proxy]\n    C[API Server]\n  end\n\n  A--\u003eB\n  B--\u003eC\n```\n\n### Planned Features Diagrams\n\n#### Monitoring and Observability\n\n```mermaid\ngraph LR\n\n  subgraph localhost\n    A[API Server]\n  end\n\n  subgraph Grafana Cloud\n    B[Grafana]\n  end\n\n  subgraph Langfuse Cloud\n    C[Langfuse]\n  end\n\n  A --\u003e|Metrics \u0026 Logs| B\n  A --\u003e|Traces \u0026 Events| C\n```\n\n#### Authentication and Authorization\n\n![Auth0 Diagram](https://images.ctfassets.net/cdy7uua7fh8z/7mWk9No612EefC8uBidCqr/821eb60b0aa953b0d8e4afe897228844/Auth-code-flow-diagram.png)\n\n[Auth0 Source](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow)\n\n## Quick Start\n\nSetup to run the repository in both production and development environments.\n\nBuild community youtube MCP image with:\n\n```bash\n./community/youtube/build.sh\n```\n\n:::tip\n\nInstead 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.\n\n:::\n\nThen build the other images with:\n\n```bash\ndocker compose -f compose-dev.yaml build\n```\n\nCopy environment file:\n\n```bash\ncp .env.sample .env\n```\n\nAdd your following API keys and value to the respective file: `./envs/backend.env`, `./envs/youtube.env` and `.env`.\n\n```bash\nOPENAI_API_KEY=sk-proj-...\nPOSTGRES_DSN=postgresql://postgres...\nYOUTUBE_API_KEY=...\n```\n\nSet environment variables in shell: (compatible with `bash` and `zsh`)\n\n```bash\nset -a; for env_file in ./envs/*; do source $env_file; done; set +a\n```\n\nStart production containers:\n\n```bash\ndocker compose up -d\n```\n\n\u003cReactPlayer playing controls url='/vid/fastapi-mcp-langgraph-template/api.mp4' /\u003e\n\n## Development\n\nFirst, set environment variables as per above.\n\n### VSCode Devcontainer\n\n\u003cReactPlayer playing controls url='/vid/fastapi-mcp-langgraph-template/vscode.mp4' /\u003e\n\n\u003cbr/\u003e\n\n:::warning\n\nOnly replace the following if you plan to start debugger for FastAPI server in VSCode.\n\n:::\n\nReplace `./compose-dev.yaml` entrypoint to allow debugging FastAPI server:\n\n```yaml title=\"./compose-dev.yaml\"\n  api:\n    image: api:prod\n    build:\n      dockerfile: ./backend/api/Dockerfile\n    # highlight-next-line\n    entrypoint: bash -c \"sleep infinity\"\n    env_file:\n      - ./envs/backend.env\n```\n\nThen:\n\n```bash\ncode --no-sandbox .\n```\n\nPress `F1` and type `Dev Containers: Rebuild and Reopen in Container` to open containerized environment with IntelliSense and Debugger for FastAPI.\n\n### Without VSCode Devcontainer\n\nRun development environment with:\n\n```bash\ndocker compose -f compose-dev.yaml up -d\n```\n\n## Debugging\n\nSometimes in development, nginx reverse proxy needs to reload its config to route services properly.\n\n```bash\ndocker compose -f compose-dev.yaml exec nginx sh -c \"nginx -s reload\"\n```\n\n## Refactored Markdown Files\n\nThe following markdown files provide additional details on other features:\n\n### MCP\n\n[`./docs/mcp.md`](./docs/mcp.md)\n\n### LangGraph\n\n[`./docs/langgraph.md`](./docs/langgraph.md)\n\n### Supabase\n\n[`./docs/supabase.md`](./docs/supabase.md)\n\n### Langfuse\n\n[`./docs/langfuse.md`](./docs/langfuse.md)\n\n### Grafana Stack\n\n[`./docs/grafana-stack.md`](./docs/grafana-stack.md)\n\n[![Star History Chart](https://api.star-history.com/svg?repos=nicholasgoh/fastapi-mcp-langgraph-template\u0026type=Date)](https://www.star-history.com/#nicholasgoh/fastapi-mcp-langgraph-template\u0026Date)\n\n\u003e [!NOTE]\n\u003e 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):\n\u003e Ongoing Broken Live Chart\n\u003e you can still use this website to view and download charts (though you may need to provide your own token).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNicholasGoh%2Ffastapi-mcp-langgraph-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNicholasGoh%2Ffastapi-mcp-langgraph-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNicholasGoh%2Ffastapi-mcp-langgraph-template/lists"}