Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Demographic MCP Server

A FastAPI-based MCP (Model Context Protocol) server for collecting and managing user demographics.

Features

  • Collect user demographics (name, gender, age range, region, ethnicity, language, preferred channel)
  • Store data in SQLite database
  • Send demographics via email
  • MCP protocol support for tool integration
  • Health check endpoint
  • CORS enabled
  • Production-ready with Docker

Setup

  1. Clone the repository
  2. Create virtual environment: python -m venv venv
  3. Activate: venv\Scripts\activate (Windows)
  4. Install dependencies: pip install -r requirements.txt
  5. Copy .env.example to .env and configure environment variables
  6. Run: python demographic_server.py

Production Deployment

Using Railway

  1. Push code to GitHub
  2. Connect Railway to your GitHub repo
  3. Deploy (Railway auto-detects Python app)
  4. Set environment variables in Railway dashboard:
    • SMTP_HOST
    • SMTP_PORT
    • SMTP_USER
    • SMTP_PASSWORD
    • EMAIL_TO
    • PORT (auto-set by Railway)

Note: SQLite database is file-based; data persists during runtime but resets on redeploy. For persistent data, consider upgrading to a managed database.

Using Docker

  1. Build and run with Docker Compose:
    docker-compose up --build

Manual

  1. Set environment variables
  2. Run with uvicorn:
    uvicorn demographic_server:app --host 0.0.0.0 --port 8000 --workers 4

API Endpoints

  • GET / - Service info
  • GET /health - Health check
  • POST /mcp - MCP protocol handler

MCP Tools

  • save_demographics_mail - Save demographics and email
  • get_demographics_mail - Retrieve demographics
  • check_demographics_complete_mail - Check completion status
  • send_complete_session_mail - Send full session via email

Environment Variables

  • SMTP_HOST - SMTP server host
  • SMTP_PORT - SMTP server port
  • SMTP_USER - SMTP username
  • SMTP_PASSWORD - SMTP password
  • EMAIL_TO - Recipient email address
  • PORT - Server port (default: 8000)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages