mcp-server-demo
Allows interaction with a PostgreSQL database, providing tools for listing cases, retrieving case details, and adding notes to cases.
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., "@mcp-server-demoshow me the list of cases"
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 Server Demo — Node/Express + PostgreSQL + Model Context Protocol
A minimal, production-pattern example of an MCP server that exposes database-backed tools to an AI client, secured with an OAuth-style bearer flow. Built to demonstrate the architecture I use in real systems, with demo data only — no real records, keys, or credentials.
Author: Robert Mack · Full-stack / AI-automation engineer · Remote, contract/fractional
What this demonstrates
MCP server exposing typed tools an AI model can call (
list_cases,get_case,add_note)PostgreSQL as the backing store, with a clean data-access layer (no SQL in the route handlers)
OAuth 2.0–style bearer-token auth on the protected endpoints (PKCE-ready pattern)
Express REST API with input validation and structured error handling
Docker / docker-compose for one-command local spin-up (API + database)
Separation of concerns: routes → service layer → db layer
This is the same shape as the production systems I build — an operations platform with an AI control layer that can act on live data safely, because every tool call is authenticated, validated, and scoped.
Related MCP server: mcp-enterprise-starter
Architecture
AI client ──(MCP / bearer token)──> Express API ──> service layer ──> PostgreSQL
│
└── tool registry: list_cases, get_case, add_notesrc/server.js— Express app, auth middleware, MCP endpoint wiringsrc/mcp.js— tool registry: each tool's schema + handlersrc/db.js— PostgreSQL access layer (parameterized queries only)src/auth.js— bearer-token validation (OAuth2/PKCE-ready)schema.sql— demo table + seed datadocker-compose.yml— API + Postgres, one command
Run it locally
# 1. Start Postgres + API together
docker compose up --build
# 2. The API is now on http://localhost:3000
# A demo bearer token is printed on startup (demo only — never hardcode real tokens)
# 3. List the MCP tools
curl -H "Authorization: Bearer demo-token-123" http://localhost:3000/mcp/tools
# 4. Call a tool
curl -X POST http://localhost:3000/mcp/call \
-H "Authorization: Bearer demo-token-123" \
-H "Content-Type: application/json" \
-d '{"tool":"list_cases","args":{}}'Notes on production use
In a real deployment the bearer token is issued via a full OAuth 2.0 + PKCE flow (not the static demo token here), the database runs as a managed/containerized service with secrets injected at runtime (never committed), and the server runs behind TLS. This repo keeps those pieces deliberately simple so the patterns are readable in one sitting.
License
MIT — demo/educational use.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for Argo RPG Platform — connects AI assistants to campaign data via OAuth2
MCP server that lets AI assistants use all OneSchema features exposed via the public API.
Google Keep-style notes app with an MCP server for AI agents to read/write notes.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceNode.js MCP server for ChatGPT with OAuth 2.0 authorization code flow + PKCE, refresh token rotation, and Supabase-backed persistence. Includes sample tools like calculator, get_weather, and search_web.239 npmMIT
- AlicenseAqualityDmaintenanceA production-grade MCP server that gives AI agents safe, authenticated access to a PostgreSQL database.3MIT
- AlicenseNot gradedqualityCmaintenanceA TypeScript/Node.js MCP server that wraps the Metabase REST API, enabling AI agents to execute queries, explore schemas, and build dashboards through structured tool calls.26 npmMIT
- FlicenseNot gradedqualityCmaintenanceMCP server for a full-stack note-taking application, exposing CRUD tools for notes with SSE transport for AI agent integration.1-