
ZenStack 远程 MCP 拥有授权的服务器
概览
一个模型上下文协议(MCP)可流式HTTP服务器支持自动生成的CRUD数据库工具,具有授权和认证认证. - :具有证书认证支持的多条同时期的MCP服务器连接. - 自动生成用于ZenStack schema中定义的模型CRUD操作的MCP工具. 此演示会使用一个简单的博客应用程序, 并带有用户和邮局模型 。 服务器为ZenStack schema中定义的每个模型自动生成MCP工具. 以下是所支持的工具: - find Unique - find First - find Many - 创建 - 创建 - 创建 - 删除 - Many - 更新 - 更新 - Many - 上层 - 聚合 - 组 - 计数 您可以为函数选择可用的工具 mcp- server.ts中的名称变量 它创建了3个有帖子的用户. 所有用户的密码为密码123. - [email protected] (英语). - [email protected] - 约尔丹@vercel.com 互联网档案馆的存檔,存档日期2013-12-21. 测试 MCP 服务器的最简单方法是运行
概述(AI 翻译)
一个模型上下文协议(MCP)可流式HTTP服务器支持自动生成的CRUD数据库工具,具有授权和认证认证.
□ 特性
- MCP可流式HTTP协议:具有证书认证支持的多条同时期的MCP服务器连接.
- ZenStack集成:为ZenStack计划所定义的模型的CRUD操作自动生成MCP工具. 这个演示会使用一个简单的博客应用程序,其中包含[[T0]和
Post模型.
□ 自动生成的工具
服务器为ZenStack schema中定义的每个模型自动生成MCP工具. 以下是所支持的工具:
- 找到独一无二
- 找到第一个
- 找到玛妮
- 创建
- 创造出许多
- 删除
- 删除许多
- 最新情况
- 最新消息 曼尼
- 升级
- 合计
- 组别
- 计数
您可以在 [[T3] 中为 [[T2] 变量选择可用的工具
□ 快开始
-
** 建立附属关系**:
-
** 建立数据库**:
-
** 创建数据库**(可选):
它创建了3个有帖子的用户. 所有用户的密码为password123.
- [email protected] (英语).
- [email protected] (英语).
- 约尔丹@vercel.com
- ** 启动服务器**:
□ 测试 MCP 服务器
本页由 AI 翻译,技术细节请以原文为准。
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. -
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.
安装
npx -y mcp-remote http://localhost:3001/mcp