chatgpt-mcp-data-platform
Click on "Deploy 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., "@chatgpt-mcp-data-platformsubmit a new customer record validated by the CRM schema"
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.
Multi-Tenant Structured Data Platform with Remote MCP for ChatGPT
A production-minded, multi-tenant structured data platform that enables authenticated organization members to submit, query, and manage validated records through ChatGPT using a remote Model Context Protocol (MCP) server over Streamable HTTP, accompanied by a protected Next.js 15 admin dashboard.
Key Architecture & Security Invariants
Zero-Trust Identity & Authorization: No request can read or mutate organization data unless the server independently verifies identity from cryptographically validated bearer tokens (OIDC/OAuth 2.0), checks organization membership status, role, and operation permissions. Caller-supplied identity claims, roles, or tenant IDs in tool arguments are strictly ignored.
Admin Approval Workflow: Users authenticate and request access to an organization (
request_access). Organization owners or admins review, approve, reject, suspend, or revoke memberships. Only approved, active members can execute data operations. Revocation immediately cuts off access.Strict Tenant Isolation: Every database query scopes to
organization_id. PostgreSQL Row-Level Security (RLS) is applied as defense-in-depth, backed by service-layer isolation.Schema Validation & Guardrails: Records are strictly validated against registered JSON Schemas before persistence. Unsupported JSON Schema keywords are rejected. Payload size, nesting depth, batch sizes, and filter operators are bounded to prevent abuse and denial of service.
Audited Mutations: All approvals, rejections, suspensions, revocations, record creations, updates, and deletions are recorded in an append-only audit log with actor ID, organization ID, action, target, and safe metadata (never logging sensitive payloads or credentials).
Dual Interface:
Remote MCP Server (Streamable HTTP) for ChatGPT integration.
Protected REST API & Next.js Admin Dashboard for tenant management, membership approvals, schema authoring, and audit inspection.
Related MCP server: MCP for Work
Technology Stack
Backend: Python 3.12, FastAPI, official Model Context Protocol (
mcp) SDK, StarletteDatabase & ORM: PostgreSQL (production) / SQLite (
aiosqlitefor local dev), SQLAlchemy 2.0 (async), AlembicValidation: Pydantic v2,
jsonschema(Draft 7/2020-12 restricted dialect)Frontend: Next.js 15 (App Router), TypeScript, Tailwind CSS, Heroicons
Auth & Security: OAuth 2.0 / OIDC Bearer Tokens (PyJWT + cryptography), scoped permissions, zero-trust context resolution
Quality:
pytest,pytest-asyncio,pytest-cov,httpx,ruff,mypy, ESLint
Repository Structure
.
├── backend/
│ └── app/
│ ├── main.py # FastAPI app & MCP Streamable HTTP mount
│ ├── config.py # Pydantic Settings v2 with safety validators
│ ├── logging_config.py # Structured JSON logger & payload redaction
│ ├── auth/ # Bearer validation, JWT/OIDC, Principals
│ │ ├── dependencies.py # FastAPI auth dependencies
│ │ ├── token_validation.py # OIDC JWKS & JWT verification
│ │ └── principal.py # AuthenticatedPrincipal & UserContext
│ ├── mcp/ # Remote MCP Server & Tool handlers
│ │ ├── server.py # FastMCP instance & ASGI lifespan
│ │ └── tools/ # access, records, admin tools
│ ├── api/ # REST API endpoints
│ │ ├── health.py # Liveness & readiness probes
│ │ ├── memberships.py # Membership requests & user org resolution
│ │ ├── records.py # Schema-validated CRUD & search
│ │ └── admin.py # Admin membership approvals & audits
│ ├── services/ # Business logic layer
│ │ ├── membership_service.py # State transitions & lifecycle
│ │ ├── authorization_service.py# RBAC & permission checking
│ │ ├── schema_service.py # JSON schema registration & validation
│ │ ├── record_service.py # Atomic validation & tenant-scoped queries
│ │ └── audit_service.py # Append-only audit trail logging
│ ├── db/ # Database persistence
│ │ ├── session.py # Async engine & sessionmaker
│ │ └── models.py # SQLAlchemy 2.x declarative models
│ ├── schemas/ # Pydantic models for API & MCP contracts
│ └── errors/ # Structured domain exceptions & HTTP mappings
├── frontend/ # Next.js 15+ TypeScript Admin Dashboard
│ ├── src/
│ │ ├── app/ # App Router pages (overview, members, records, schemas, audit, settings)
│ │ ├── components/ # Navbar, StatusBadge, ConfirmationModal
│ │ └── types/ # TypeScript definitions
│ └── patch-node26.js # Node.js 26 Windows filesystem patch
├── tests/
│ ├── unit/ # State transitions, permissions, schema validation
│ ├── integration/ # Full vertical slice flows
│ ├── security/ # Cross-tenant isolation, negative security tests
│ └── mcp/ # Tool discovery, argument validation, execution
├── docs/
│ ├── architecture.md # Component & request flow architecture
│ ├── security.md # Threat model, isolation & defense-in-depth
│ ├── oauth-chatgpt-setup.md # ChatGPT remote MCP OAuth configuration
│ └── deployment.md # Deployment guide & operational checklists
├── compose.yaml # Docker Compose local development stack
├── Dockerfile # Production multi-stage container
├── alembic.ini # Alembic database migration config
├── pyproject.toml # Python 3.12 dependencies
└── seed_demo.py # Standalone demo data seeder & token generatorQuickstart & Local Development
Prerequisites
Python 3.12+ (or
uv)Node.js 20+ and npm
Git
1. Backend Setup
# Clone the repository
git clone https://github.com/adityakhadsecode/chatgpt-mcp-data-platform.git
cd chatgpt-mcp-data-platform
# Create virtual environment and install dependencies
uv venv --python 3.12
.venv\Scripts\activate # On Windows (or source .venv/bin/activate on Linux/macOS)
uv pip install -e ".[dev]"
# Copy environment variables
cp .env.example .env2. Initialize & Seed Demo Data
Run the demo seeder to initialize the database with Acme Corporation, an Owner / Admin user, a sample contact schema, and pre-signed test JWT tokens:
python seed_demo.pyThe script prints ready-to-use JWT tokens for:
Alice Admin: Owner of Acme Corporation (full admin permissions).
Bob Newbie: Unapproved user (for testing the approval workflow).
3. Run Backend & MCP Server
uvicorn backend.app.main:app --host 127.0.0.1 --port 8000 --reloadLiveness Probe: http://127.0.0.1:8000/health/live
Readiness Probe: http://127.0.0.1:8000/health/ready
Interactive Swagger Docs: http://127.0.0.1:8000/docs
Remote MCP Endpoint: http://127.0.0.1:8000/mcp (Streamable HTTP)
4. Run Admin Dashboard
In a new terminal:
cd frontend
npm install
npm run devOpen http://localhost:3000 in your browser:
Navigate to
/settings.Paste the Alice Admin Token generated in step 2.
Manage members, register schemas, query records, and inspect audit logs.
Remote MCP Tools Reference
The platform registers the following MCP tools over Streamable HTTP at /mcp:
Tool Name | Permissions Required | Description |
| Any Authenticated User | Inspect caller's organizations, roles, and membership status. |
| Any Authenticated User | Submit a membership request to an organization. |
| Approved Member / Admin / Owner | List all active data schemas in the authorized organization. |
| Approved Member / Admin / Owner | Ingest batch records after validating against declared JSON schema. |
| Approved Member / Admin / Owner | Query, filter, and paginate organization records. |
| Org Admin / Owner | Approve, reject, suspend, or revoke a member. |
Running Automated Tests
Run the full automated test suite (unit, integration, security, and MCP tests):
pytest -vRun test suite with coverage:
pytest --cov=backend.app --cov-report=term-missingRun code formatting and type checks:
ruff check .
ruff format --check .
mypy backend/appProduction Deployment & Docker
Run the entire platform with containerized PostgreSQL:
docker compose up -d --buildFor production configuration, OIDC provider setup (Auth0, Supabase, Okta, Keycloak), and ChatGPT integration, refer to the documentation:
License
MIT License. See LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared tables and Markdown docs for teams and AI-built apps, with scoped access and audited changes.
An agent-native database over MCP: shared, validated, structured records in every AI chat.
- HutchDBOAuthcom.hutchdb
Store, query, and update structured data from any AI agent
CRM and business database for AI agents: search and update records, documents and workspace schema.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceGoverned knowledge base for AI agents via the Model Context Protocol (MCP), enabling agents to search, read, and contribute persisted knowledge with versioning, audit trails, and approval workflows.48 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables your own ChatGPT to build and manage a collaborative work board—dashboards, categories, datasets, monitors, and policies—through typed WebMCP tools, with human approval, audit trails, and guardrails enforced on every action.MIT
- AlicenseNot gradedqualityBmaintenanceTurns Google Sheets, CSV, Excel, and Parquet files into durable, queryable data for AI agents. Lets clients securely discover datasets, inspect semantic models, run bounded analytics, and manage approved semantic overlays.Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to keep structured, typed records in SQLite sheets with stable row ids, versions, and per-write audit history, so data survives across sessions and multiple agents. Lookups are fuzzy with an explicit match status, writes are version-checked and dry-run by default, and sheets can be created, queried, searched, and analyzed through MCP tools.-