Linear集成工具

通过Model Context Protocol (MCP)与Linear集成的AI工具,支持搜索、创建、更新问题,添加评论,获取用户资料和团队信息等功能。

  • by zalab-inc
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 zalab-inc/mcp-linear-app

使用说明

MCP线性应用程序

模型上下文协议(MCP),用于与Linear集成作为人工智能工具。该工具允许您的AI通过模型上下文协议与Linear进行交互。

特性

  • 完全线性积分:
    • 搜索问题
    • 创建新问题
    • 更新问题
    • 添加评论
    • 更新评论
    • 获取用户资料
    • 获取团队信息

先决条件

  • Node.js 18或更新版本
  • 线性API键

如何获取线性API密钥

若要使用此应用程序,您需要一个Linear API键。以下是获得一个的步骤:

  1. 登录或创建线性帐户

    • 访问 线性 登录您现有的帐户或注册以创建新帐户
  2. 访问工作区设置

    • 在主页上,单击左上角的用户名
    • 选择“工作区设置”选项
  3. 打开API设置

    • 在左侧的“设置”列中,向下滚动直到找到“API”
    • 点击“API”选项
  4. 创建新的API密钥

    • 为API键输入标签(例如“MCP线性应用程序”)
    • 单击“新建API密钥”按钮
  5. 安全存储API密钥

    • API键将只显示一次
    • 复制并保存到安全位置,因为Linear不会再次显示它

重要提示:Linear对API密钥的请求速率限制为每小时1500次。确保您的应用程序遵循此限制,以避免429 Too Many Requests错误。

有关获取和使用Linear API密钥的更多详细信息,您可以访问 Merge.dev上的指南.

如何使用该工具

1.初始设置

  1. 克隆此存储库:
git clone git@github.com:zalab-inc/mcp-linear-app.git
cd mcp-linear-app
  1. 安装依赖项:
npm install
  1. 创建一个 .env 根目录中的文件:
LINEAR_API_KEY=your_linear_api_key_here
  1. 构建项目:
npm run build
  1. 这 dist 文件夹现在已准备好用于各种AI平台中的配置。

2.光标配置

  1. 查找您的Cursor MCP配置文件:

    • 窗户: C:\Users\<username>\.cursor\mcp.json
    • macOS: ~/.cursor/mcp.json
    • Linux: ~/.cursor/mcp.json
  2. 编辑文件以添加Linear MCP服务器配置:

    {
      "mcpServers": {
        "linear": {
          "command": "<path-to-node>",
          "args": [
            "<path-to-project>/dist/index.js"
          ],
          "env": {
            "LINEAR_API_KEY": "your_linear_api_key_here"
          }
        }
      }
    }
    
  3. 替换占位符:

    • <path-to-node>:Node.js可执行文件的路径
    • <path-to-project>:MCP线性应用程序项目目录的绝对路径
    • your_linear_api_key_here:您的线性API键

配置示例:

{
  "mcpServers": {
    "linear": {
      "command": "C:\\nvm4w\\nodejs\\node.exe",
      "args": [
        "H:\\mcp\\linear\\dist\\index.js"
      ],
      "env": {
        "LINEAR_API_KEY": "lin_api_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
  1. 保存文件并重新启动Cursor以使更改生效。

3.克劳德配置

要将MCP线性工具与Claude一起使用,您需要将配置添加到Claude的设置文件中。请按照以下步骤操作:

  1. 打开Claude AI桌面应用程序设置
  2. 导航到“开发人员”部分
  3. 查找“工具”配置部分
  4. 添加线性MCP的配置如下:
{
  "tools": {
    "linear": {
      "command": "<path-to-node>",
      "args": [
        "<path-to-project>/dist/index.js"
      ],
      "env": {
        "LINEAR_API_KEY": "your_linear_api_key_here"
      }
    }
  }
}
  1. 替换占位符:
    • <path-to-node>:Node.js可执行文件的路径
    • <path-to-project>:MCP线性应用程序项目目录的绝对路径
    • your_linear_api_key_here:您的线性API键

配置示例:

{
  "tools": {
    "linear": {
      "command": "/usr/local/bin/node",
      "args": [
        "/Users/username/projects/mcp-linear-app/dist/index.js"
      ],
      "env": {
        "LINEAR_API_KEY": "lin_api_xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

4.其他平台上的配置

基本原理与支持MCP的其他AI平台相同:

  1. 查找外部工具或MCP的配置区域
  2. 配置它以运行Node.js dist/index.js 此存储库中的文件
  3. 在环境配置中包含LINEAR_API_KEY

可用工具

配置后,您的AI将可以访问以下线性工具:

  • search_issues -按关键字、状态或优先级搜索问题
  • create_issue -创建新问题
  • get_issue -获取问题详细信息
  • update_issue -更新现有问题
  • create_comment -向问题添加评论
  • get_comment -从问题中获取评论
  • update_comment -更新或删除评论
  • get_profile -获取当前Linear用户配置文件
  • get_team_id -获取团队及其ID列表

支持和帮助

如果您在使用此工具时遇到问题,请:

  1. 请检查您的Linear API密钥是否有效并具有足够的权限
  2. 确保Node.js安装正确
  3. 检查AI平台中的MCP配置
  4. 检查日志文件中可能出现的任何错误消息

在AI环境中使用线性工具

一旦你在人工智能环境中配置了线性工具,你就可以通过提示人工智能来开始使用它们。以下是一些示例:

在游标中使用线性工具

在Cursor中,您可以简单地让Claude执行与线性相关的任务:

Search for high priority issues in our Linear project.
Create a new issue in Linear with the title "Improve login page performance" and add it to the backlog.
Get the details of the issue LIN-123 from Linear.
Add a comment to issue LIN-456 saying "This is fixed in the latest release. Please verify."
Update the priority of issue LIN-789 to urgent.

示例工作流:创建和管理问题

以下是一个示例工作流,显示了如何使用这些工具:

  1. 查找您的团队ID:

    What's my Linear team ID?
    

    克劳德将使用 get_team_id 获取团队信息的工具。

  2. 创建新问题:

    Create a new Linear issue titled "Implement password reset feature" for the Engineering team with a high priority. The description should be "Users need a way to reset their passwords when they forget them."
    

    克劳德将使用 create_issue 工具具有必要的参数。

  3. 搜索问题:

    Find all high priority issues assigned to me that are currently in progress.
    

    克劳德将使用 search_issues 带有适当过滤器的工具。

  4. 更新问题:

    Update issue LIN-456 to add the description "This issue has been verified and tested on all browsers."
    

    克劳德将使用 update_issue 工具来修改问题。

  5. 添加评论:

    Add a comment to issue LIN-789 asking "Is this still a priority for this sprint?"
    

    克劳德将使用 create_comment 添加评论的工具。

  6. 正在检索评论:

    Show me all the comments on issue LIN-321
    

    克劳德将使用 get_comment 获取评论的工具。

这些示例展示了一旦工具配置正确,您可以通过人工智能助手与Linear进行自然交互。

最近的更新

该项目最近通过改进文档和线性工具功能得到了增强。这些改进包括:

  • 更新了README,提供了更清晰的安装和配置说明
  • 通过各种AI平台的示例增强文档
  • 改进的线性工具具有更好的错误处理和响应格式
  • 添加了对管理评论(创建、获取、更新、删除)的支持
  • 通过按状态和优先级过滤改进了搜索能力

许可证

该项目根据MIT许可证获得许可。

https://kelasinovatif.com/