Related MCP Server Resources

Explore more AI models, providers, and integration options:

  • Explore AI Models
  • Explore AI Providers
  • Explore MCP Servers
  • LangDB Pricing
  • Documentation
  • AI Industry Blog
  • SQLite MCP Server
  • Ollama MCP Database Assistant
  • Powertools MCP Search Server
  • Ollama MCP Server
  • Xano MCP Server for Smithery
Back to MCP Servers
MCP Chatbot

MCP Chatbot

Public
rick-noya/mcp-chatbot

Serverless FastAPI backend leveraging OpenAI GPT models to generate and execute SQL queries on Postgres databases, delivering structured JSON responses via a REST API for seamless chatbot integration and deployment on AWS Lambda, Docker, or locally.

python
0 tools
May 30, 2025
Updated Jun 4, 2025

Supercharge Your AI with MCP Chatbot

MCP Server

Unlock the full potential of MCP Chatbot through LangDB's AI Gateway. Get enterprise-grade security, analytics, and seamless integration with zero configuration.

Unified API Access
Complete Tracing
Instant Setup
Get Started Now

Free tier available • No credit card required

Instant Setup
99.9% Uptime
10,000+Monthly Requests

MCP Chat Backend

This project is a serverless FastAPI backend for a chatbot that generates and executes SQL queries on a Postgres database using OpenAI's GPT models, then returns structured, UI-friendly responses. It is designed to run on AWS Lambda via AWS SAM, but can also be run locally or in Docker.

Features

  • FastAPI REST API with a single /ask endpoint
  • Uses OpenAI GPT models to generate and summarize SQL queries
  • Connects to a Postgres (Supabase) database
  • Returns structured JSON responses for easy frontend rendering
  • CORS enabled for frontend integration
  • Deployable to AWS Lambda (SAM), or run locally/Docker
  • Verbose logging for debugging (CloudWatch)

Project Structure

├── main.py            # Main FastAPI app and Lambda handler
├── requirements.txt   # Python dependencies
├── template.yaml      # AWS SAM template for Lambda deployment
├── samconfig.toml     # AWS SAM deployment config
├── Dockerfile         # For local/Docker deployment
├── .gitignore         # Files to ignore in git
└── .env               # (Not committed) Environment variables

Setup

1. Clone the repository

git clone cd mcp-chat-3

2. Install Python dependencies

python -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate on Windows pip install -r requirements.txt

3. Set up environment variables

Create a .env file (not committed to git):

OPENAI_API_KEY=your-openai-key
SUPABASE_DB_NAME=your-db
SUPABASE_DB_USER=your-user
SUPABASE_DB_PASSWORD=your-password
SUPABASE_DB_HOST=your-host
SUPABASE_DB_PORT=your-port

Running Locally

With Uvicorn

uvicorn main:app --reload --port 8080

With Docker

docker build -t mcp-chat-backend . docker run -p 8080:8080 --env-file .env mcp-chat-backend

Deploying to AWS Lambda (SAM)

  1. Install AWS SAM CLI
  2. Build and deploy:
sam build sam deploy --guided
  • Configure environment variables in template.yaml or via the AWS Console.
  • The API will be available at the endpoint shown after deployment (e.g. https://xxxxxx.execute-api.region.amazonaws.com/Prod/ask).

API Usage

POST /ask

  • Body: { "question": "your question here" }
  • Response: Structured JSON for chatbot UI, e.g.
{ "messages": [ { "type": "text", "content": "Sample 588 has a resistance of 1.2 ohms.", "entity": { "entity_type": "sample", "id": "588" } }, { "type": "list", "items": ["Item 1", "Item 2"] } ] }
  • See main.py for the full schema and more details.

Environment Variables

  • OPENAI_API_KEY: Your OpenAI API key
  • SUPABASE_DB_NAME, SUPABASE_DB_USER, SUPABASE_DB_PASSWORD, SUPABASE_DB_HOST, SUPABASE_DB_PORT: Your Postgres database credentials

Development Notes

  • All logs are sent to stdout (and CloudWatch on Lambda)
  • CORS is enabled for all origins by default
  • The backend expects the frontend to handle the structured response format

License

MIT (or your license here)

Publicly Shared Threads0

Discover shared experiences

Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!

Share your threads to help others
Related MCPs5
  • SQLite MCP Server
    SQLite MCP Server

    A Model Context Protocol server enabling AI models to execute SQL queries, manage SQLite database sc...

    Added May 30, 2025
  • Ollama MCP Database Assistant
    Ollama MCP Database Assistant

    Interactive chat interface leveraging Model Context Protocol to enable natural language queries and ...

    Added May 30, 2025
  • Powertools MCP Search Server
    Powertools MCP Search Server

    Model Context Protocol server enabling efficient local search of AWS Lambda Powertools documentation...

    2 tools
    Added May 30, 2025
  • Ollama MCP Server
    Ollama MCP Server

    Enables seamless integration of local Ollama LLM models with MCP-compatible applications, offering m...

    Added May 30, 2025
  • Xano MCP Server for Smithery
    Xano MCP Server for Smithery

    Model Context Protocol server enabling seamless integration between Claude AI and Xano databases wit...

    Added May 30, 2025