MCP Chatbot
Allows deployment of the chatbot backend as a serverless function, with CloudWatch integration for logging and API Gateway for endpoint exposure.
Supports containerized deployment of the chatbot backend with Docker, including environment variable configuration.
Implements a REST API with CORS support and structured JSON responses for easy frontend integration.
Uses OpenAI GPT models to generate and execute SQL queries based on natural language questions, then summarizes results in structured format.
Connects to a Supabase Postgres database to execute SQL queries generated from user questions and retrieve relevant data.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Chatbotwhat were our top 5 sales regions last month?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
/askendpointUses 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)
Related MCP server: mcp-db-server
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 variablesSetup
1. Clone the repository
git clone <your-repo-url>
cd mcp-chat-32. Install Python dependencies
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -r requirements.txt3. 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-portRunning Locally
With Uvicorn
uvicorn main:app --reload --port 8080With Docker
docker build -t mcp-chat-backend .
docker run -p 8080:8080 --env-file .env mcp-chat-backendDeploying to AWS Lambda (SAM)
Install AWS SAM CLI
Build and deploy:
sam build
sam deploy --guidedConfigure environment variables in
template.yamlor 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.pyfor the full schema and more details.
Environment Variables
OPENAI_API_KEY: Your OpenAI API keySUPABASE_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)
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceEnables AI to query and manage PostgreSQL and MongoDB databases through natural language. Supports automatic schema discovery, safe data operations, and network-wide database access with zero-configuration deployment.Last updated
- Flicense-qualityDmaintenanceEnables querying PostgreSQL and MySQL databases using natural language, with RESTful endpoints for listing tables, describing schemas, and executing read-only queries.Last updated1
- Alicense-qualityDmaintenanceEnables natural language querying of PostgreSQL databases with intelligent SQL generation using LLMs.Last updated1Apache 2.0
- Alicense-qualityDmaintenanceEnables you to chat with your PostgreSQL database via natural language, with GitHub OAuth authentication and role-based access control for secure read/write operations.Last updatedMIT
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
GibsonAI MCP server: manage your databases with natural language
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rick-noya/mcp-chatbot'
If you have feedback or need assistance with the MCP directory API, please join our Discord server