Linear 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

  • Allows access to Linear's issue tracking system, enabling users to create, update, search, and delete issues, add comments, retrieve projects and team information, manage labels, and track parent/child relationships among issues.

线性 MCP 服务器

模型上下文协议 (MCP) 服务器实现,通过标准化接口提供对 Linear 问题跟踪系统的访问。

特征

  • 创建带有标签支持的新问题和子问题
  • 检索线性项目列表
  • 检索项目更新
  • 创建具有健康状态的新项目更新
  • 通过完整字段修改来更新现有问题
  • 删除验证问题
  • 使用“我”关键字自行分配问题
  • 利用 Linear 强大的过滤功能进行高级搜索
  • 按周期过滤问题(当前周期、下一个周期、上一个周期或按 UUID 或编号指定的周期)
  • 使用 Markdown 支持向问题添加评论
  • 通过 ID 或键查询线性问题(可选关系)
  • 使用具有增强元数据的自定义查询搜索问题
  • 使用 Linear 官方 SDK 进行类型安全操作
  • 全面的错误处理
  • 速率限制处理
  • 清洁数据转换
  • 通过团队继承跟踪父/子关系
  • 标签管理和同步

先决条件

  • Bun运行时(v1.0.0 或更高版本)
  • 具有 API 访问权限的线性帐户

环境变量

LINEAR_API_KEY=your_api_key # Your Linear API token

安装和设置

1.克隆存储库:

git clone [repository-url] cd linear-mcp

2.安装依赖项并构建:

bun install bun run build

3. 配置MCP服务器:

编辑适当的配置文件:

macOS:

  • Cline: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  • Claude 桌面: ~/Library/Application Support/Claude/claude_desktop_config.json

视窗:

  • Cline: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
  • 克劳德桌面: %APPDATA%\Claude Desktop\claude_desktop_config.json

Linux:

  • Cline: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  • Claude Desktop:遗憾的是尚不存在

mcpServers对象下添加以下配置:

{ "mcpServers": { "linear": { "command": "node", "args": ["/absolute/path/to/linear-mcp/build/index.js"], "env": { "LINEAR_API_KEY": "your_api_key" } } } }

4. 重新启动 MCP 服务器。

在 Cline 的 MCP 设置中,重启 MCP 服务器。重启 Claude Desktop 以加载新的 MCP 服务器。

发展

运行开发服务器:

bun run dev

构建项目:

bun run build

可用的 MCP 工具

所有工具的详细使用示例,请参见USAGE.md

创建问题

创建新的线性问题或子问题。

输入模式:

{ "teamId": "string", "title": "string", "description": "string", "parentId": "string", "status": "string", "priority": "number", "assigneeId": "string | 'me'", "labelIds": ["string"] }

更新问题

更新现有的线性问题。

输入模式:

{ "issueId": "string", "title": "string", "description": "string", "status": "string", // Expects status NAME (e.g., "In Progress"). Must be valid for the issue's team. "priority": "number", // Expects 0 (None) to 4 (Low). "assigneeId": "string | 'me'", "labelIds": ["string"], "cycleId": "string" }

获取问题

获取有关具有可选关系的特定线性问题的详细信息。

输入模式:

{ "issueId": "string", "includeRelationships": "boolean" }

搜索问题

使用查询字符串和高级过滤器搜索 Linear 问题。支持 Linear 强大的过滤功能。

输入模式:

{ "query": "string", "includeRelationships": "boolean", "filter": { "title": { "contains": "string", "eq": "string", ... }, "description": { "contains": "string", "eq": "string", ... }, "priority": { "gte": "number", "lt": "number", ... }, "estimate": { "eq": "number", "in": ["number"], ... }, "dueDate": { "lt": "string", "gt": "string", ... }, "createdAt": { "gt": "P2W", "lt": "2024-01-01", ... }, "updatedAt": { "gt": "P1M", ... }, "completedAt": { "null": true, ... }, "assignee": { "id": { "eq": "string" }, "name": { "contains": "string" } }, "creator": { "id": { "eq": "string" }, "name": { "contains": "string" } }, "team": { "id": { "eq": "string" }, "key": { "eq": "string" } }, "state": { "type": { "eq": "started" }, "name": { "eq": "string" } }, "labels": { "name": { "in": ["string"] }, "every": { "name": { "eq": "string" } } }, "project": { "id": { "eq": "string" }, "name": { "contains": "string" } }, "and": [{ /* filters */ }], "or": [{ /* filters */ }], "assignedTo": "string | 'me'", "createdBy": "string | 'me'" }, "projectId": "string", "projectName": "string" }

支持的比较器:

  • 字符串字段: eqneqinnincontainsstartsWithendsWith (以及不区分大小写的变体)
  • 数字字段: eqneqltltegtgteinnin
  • 日期字段: eqneqltltegtgte (支持 ISO 8601 持续时间)

获取团队

获取具有可选名称/密钥过滤的线性团队列表。

输入模式:

{ "nameFilter": "string" }

删除问题

删除现有的线性问题。

输入模式:

{ "issueId": "string" }

创建评论

对线性问题创建新评论。

输入模式:

{ "issueId": "string", "body": "string" }

获取项目

获取具有可选名称过滤和分页的线性项目列表。

输入模式:

{ "nameFilter": "string", "includeArchived": "boolean", "first": "number", "after": "string" }

获取项目更新

使用可选的过滤参数获取给定项目 ID 的项目更新。

输入模式:

{ "projectId": "string", "includeArchived": "boolean", "first": "number", "after": "string", "createdAfter": "string", "createdBefore": "string", "userId": "string | 'me'", "health": "string" }

创建项目更新

为 Linear 项目创建新的更新。

输入模式:

{ "projectId": "string", "body": "string", "health": "onTrack | atRisk | offTrack", "isDiffHidden": "boolean" }

技术细节

  • 使用 TypeScript 在严格模式下构建
  • 使用 Linear 的官方 SDK (@linear/sdk)
  • 使用 MCP SDK (@modelcontextprotocol/sdk 1.4.0)
  • 通过 API 令牌进行身份验证
  • 全面的错误处理
  • 速率限制注意事项
  • Bun 运行时以提高性能
  • 贯穿始终的 ESM 模块
  • Vite 构建系统
  • 类型安全操作
  • 数据清理功能:
    • 问题提及提取(ABC-123 格式)
    • 用户提及提取(@username 格式)
    • Markdown 内容清理
    • 针对 AI 上下文的内容优化
  • 自我分配支持:
    • 自动当前用户解析
    • 创建/更新操作中支持“me”关键字
    • 高效的用户ID缓存
  • 高级搜索功能:
    • 使用 Linear 的 API 进行全面过滤
    • 支持所有字段比较器
    • 关系过滤
    • 逻辑运算符(与、或)
    • 相对日期过滤
    • 按受让人/创建者(包括自己)过滤
    • 支持特定用户 ID
    • 按 ID 或名称过滤项目
    • 高效的查询优化
  • 项目管理功能:
    • 带有过滤和分页的项目列表
    • 通过健康状态跟踪创建项目更新
    • 使用过滤选项检索项目更新

错误处理

服务器实现了全面的错误处理策略:

  • 网络错误检测和适当的消息传递
  • HTTP 状态代码处理
  • 带有状态代码的详细错误消息
  • 错误详细信息记录到控制台
  • 所有参数的输入验证
  • 标签验证和同步
  • 通过 MCP 协议安全传播错误
  • 速率限制检测和处理
  • 身份验证错误处理
  • 无效查询处理
  • 子问题的团队继承验证
  • 用户解析验证
  • 搜索过滤器验证

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENCE文件。

ID: 83wkbjoqvn