内容
# 在 React Server Components 中测试 Neon MCP Server
本仓库使用 [waku](https://waku.gg/) 和 React Server Components 来演示如何将 Neon's MCP Server 与 Anthropic API 和自定义聊天界面结合使用。
您可以在我的博客上阅读更多关于这个实验的内容:[如何将 Neon's MCP Server 与 React Server Components 结合使用](https://www.paulie.dev/posts/2025/03/how-to-use-neons-mcp-server-with-react-server-components/)
## 开始使用
本仓库需要一个 Neon API 密钥和一个 Anthropic API 密钥。将 `.env.example` 重命名为 `.env` 并更新您的 API 密钥。
### 安装依赖
```shell
npm install
```
### 运行开发服务器
```shell
npm run dev
```
## 💬 聊天
测试 Neon's MCP Server 与 Anthropic API 需要两个组件。它们的详细信息如下。
### 聊天组件 (仅服务器)
位于 `src/components/chat.tsx` 的 `<Chat />` 组件负责处理服务器端请求。
### 聊天表单组件 (仅客户端)
位于 `src/components/chat-form.txt` 的 `<ChatForm />` 组件负责处理 `textarea` 输入,并将消息发送到服务器。
## 有用的链接
- [Neon MCP Server (文档)](https://neon.tech/guides/neon-mcp-server)
- [Neon MCP Server (GitHub)](https://github.com/neondatabase-labs/mcp-server-neon)
- [Smithery - Neon 数据库 (快速开始)](https://smithery.ai/server/neon/api)
- [Smithery Typescript SDK (GitHub)](https://github.com/smithery-ai/typescript-sdk)