ZenStack MCP Auth Server
Enables auto-generated CRUD operations with authentication and authorization for database models defined in ZenStack schema.
README
ZenStack Remote MCP Server with Authorization
A Model Context Protocol (MCP) Streamable HTTP server supporting auto-generated CRUD tools of database with Authorization and credential Authentication.
Features
- MCP Streamable HTTP Protocol: Multiple simultaneous MCP server connections with credential Authentication support.
- ZenStack Integration: Automatically generates MCP tools for the CRUD operations of the models defined in the ZenStack schema. This demo will use a simple blog application with
UserandPostmodels.
Auto-generated Tools
The server automatically generates MCP tools for each model defined in the ZenStack schema. Here are the supported tools:
- findUnique
- findFirst
- findMany
- create
- createMany
- delete
- deleteMany
- update
- updateMany
- upsert
- aggregate
- groupBy
- count
You can opt-in available tools for functionNames variable in mcp-server.ts
Quick Start
-
Install dependencies:
npm install -
Set up the database:
npx zenstack generate npx prisma db push -
Seed the database (optional):
npx prisma db seedIt create 3 users with posts. The passwords for all users are
password123.- alex@zenstack.dev
- sarah@stripe.com
- jordan@vercel.com
-
Start the server:
npm run dev
Testing the MCP Server
MCP Inspector
The easiest way to test the MCP server is to run
npx @modelcontextprotocol/inspector
MCP Client
If your chosen MCP client supports remote OAuth2 MCP server, you can directly connect. Otherwise, you can use mcp-remote to do it
All the most popular MCP clients (Claude Desktop, Cursor, Github Copilot) use the following config format:
{
"servers": {
"my-mcp-server": {
"command": "npx",
"args": ["-y", "mcp-remote", "http://localhost:3001/mcp"]
}
}
}
Troubleshooting
Clear your ~/.mcp-auth directory
If you encounter an invalid client error when connecting to the MCP server, it may be due to that mcp-remote only register oauth client for the first time.you can fix it by removing the cached client state:
rm -rf ~/.mcp-auth
Delete old versions of Node in NVM for Claude Desktop
When using Claude Desktop, if you didn't see any OAuth window open in your browser, it may be due to the fact that Claude Desktop is using an old version of Node.js even if you have a newer version installed. You can fix it by deleting old versions of Node.js in NVM.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.