Tugboat MCP Server

Tugboat MCP Server

与拖船 API 交互的模型上下文协议 (MCP) 服务器。

简介

这是一个允许 AI 助手(如 Claude)通过模型上下文协议(MCP)与 Tugboat API 交互的服务器,用于访问和管理 Tugboat 资源。

安装

git clone https://github.com/yourusername/tugboat-mcp.git
cd tugboat-mcp
npm install
npm run build

基本配置

设置以下环境变量:

  • TUGBOAT_API_KEY:您的 Tugboat API 密钥(必需)
  • TRANSPORT_TYPEstdio(默认)或 http
  • PORT:HTTP 传输的端口(默认 3000

在 Claude Desktop 中设置

  1. 创建/编辑 Claude Desktop 配置文件:

    macOS:

    touch "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
    open -e "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
    

    Windows:

    code %APPDATA%\Claude\claude_desktop_config.json
    
  2. 添加服务器配置:

    {
      "mcpServers": {
        "tugboat-mcp": {
          "command": "node",
          "args": ["/path/to/tugboat-mcp/dist/index.js"],
          "env": {
            "TUGBOAT_API_KEY": "your-api-key-here"
          }
        }
      }
    }
    
  3. 重启 Claude Desktop

在 Cursor 中设置

  1. 打开 Cursor 设置 → 功能 → MCP 服务器
  2. 点击"+ 添加新的 MCP 服务器"
  3. 填写表单:
    • 名称: tugboat-mcp
    • 类型: 命令
    • 命令: env TUGBOAT_API_KEY=your-api-key-here node /path/to/tugboat-mcp/dist/index.js

使用 HTTP 传输(可选)

  1. 启动服务器:

    TUGBOAT_API_KEY=your-api-key TRANSPORT_TYPE=http npm start
    
  2. 身份验证:

    curl -X POST http://localhost:3000/auth/login
    
  3. 访问 MCP 端点:

    curl -X POST http://localhost:3000/mcp \
      -H "Authorization: Bearer your-tugboat-api-key" \
      -H "Content-Type: application/json" \
      -d '{"jsonrpc":"2.0","method":"initialize","params":{},"id":1}'
    

与 AI 助手交互示例

使用 Claude 或 Cursor 发送请求,如:

  • "列出我的 Tugboat 项目"
  • "显示'网站重新设计'项目的预览"
  • "在仓库 def456 中使用分支'feature/new-button'创建一个名为'Button Feature Test'的新预览"

可用资源和工具

主要资源

  • tugboat://projects - 所有项目
  • tugboat://project/{id} - 特定项目
  • tugboat://previews - 所有预览
  • tugboat://preview/{id} - 特定预览
  • tugboat://repositories - 所有仓库

常用工具

  • 列出项目和预览
  • 创建、构建、刷新和删除预览
  • 查看预览日志
  • 搜索 Tugboat 资源

现在您已准备好使用 Tugboat MCP 服务器与您的 AI 助手互动!