Windsurf Supabase MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides enhanced database interactions through Supabase, including SQL query processing, PostgREST API access, SQL to REST conversion, and optimized response formatting for UI components, with improved error handling and authentication.

  • Implements strict TypeScript types for response handling, providing type safety for database interactions and standardized JSON response formats.

Windsurf Supabase MCP 服务器

针对 Supabase 集成的 Windsurf 优化 MCP 服务器

此存储库包含针对 Windsurf 优化的 Supabase MCP 服务器版本,并进行了特别增强,以便与 Windsurf 编辑器无缝协作。它基于模型上下文协议(MCP) 标准构建,并添加了关键改进,以更好地处理错误、响应格式和 SQL 查询。

风帆冲浪的关键修改

1.增强错误处理

我们在使用原始错误处理系统时面临几个挑战:

  • 格式错误的 SQL 查询会导致静默失败
  • 流解析错误很难调试
  • 错误消息不适合 LLM

我们的解决方案:

  • 添加了具有详细上下文的结构化错误响应
  • 改进错误消息,以便更好地理解 LLM
  • 添加了 SQL 查询结构验证
  • 增强的流错误检测和恢复

2. 响应格式

原始响应格式存在局限性:

  • 不同响应类型的 JSON 结构不一致
  • 缺少 UI 组件的元数据
  • 有限类型安全

我们的改进:

  • 标准化 JSON 响应格式
  • 添加了用于 UI 组件生成的元数据
  • 实现严格的 TypeScript 类型
  • 增加了对流式复杂数据结构的支持

3. SQL 到 REST 的转换

我们增强了 SQL 到 REST 的转换:

  • 增加了对更复杂的 SQL 操作的支持
  • 改进的查询验证
  • 更好地处理 JOIN 和子查询
  • 增强无效 SQL 的错误消息

4. 身份验证和标头

身份验证处理方面的主要改进:

  • 灵活的 API 密钥管理
  • 支持持有者令牌认证
  • 更好地管理 PostgREST 请求的标头
  • 增强的安全验证

与 Windsurf 集成

该 MCP 服务器专门设计用于与 Windsurf 编辑器配合使用,提供:

  • 通过自然语言进行无缝数据库交互
  • 实时查询验证和更正
  • 增强错误消息以便更好地调试
  • 优化 UI 组件的响应格式

Windsurf 中的使用示例

// Example of enhanced response handling const response = await postgrestRequest({ method: 'GET', path: '/todos?is_completed=eq.false', }); // Response includes metadata for UI components const { data, metadata } = response;

安装

  1. 克隆此存储库:
git clone https://github.com/hertzfelt/windsurf-supabase-mcp.git
  1. 安装依赖项:
npm install
  1. 配置您的 Supabase 连接:
SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_key

与 Windsurf 一起使用

该服务器提供两个主要工具:

  1. postgrestRequest :增强的 PostgREST API 访问
const result = await postgrestRequest({ method: 'GET', path: '/users', });
  1. sqlToRest :改进了 SQL 到 REST 的转换
const query = 'SELECT * FROM users WHERE age > 18'; const { method, path } = await sqlToRest({ sql: query });

贡献

欢迎贡献代码!请阅读我们的贡献指南,详细了解我们的行为准则以及提交 Pull Request 的流程。

执照

本项目遵循 MIT 许可证。详情请参阅LICENSE文件。

-
security - not tested
A
license - permissive license
-
quality - not tested

模型上下文协议服务器针对 Supabase 与 Windsurf 编辑器的集成进行了优化,通过自然语言提供数据库交互,并增强了错误处理和响应格式。

  1. Key Modifications for Windsurf
    1. 1. Enhanced Error Handling
    2. 2. Response Formatting
    3. 3. SQL to REST Conversion
    4. 4. Authentication & Headers
  2. Integration with Windsurf
    1. Example Usage in Windsurf
  3. Installation
    1. Usage with Windsurf
      1. Contributing
        1. License
          ID: jvt7hbms24