微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🧠

托管OAuth驱动的Jira自动化中枢

Jira · v1.0.8
开发 安全 B 级 作者 byungkyu 公开目录收录
6.6k 下载 7 安装 22.7k 收藏 11 浏览

简介

基于托管OAuth的Jira Cloud API集成,支持JQL搜索、Issue全生命周期管理及工作流自动化,需Maton API密钥授权。

原始描述

Jira API integration with managed OAuth. Search issues with JQL, create and update issues, manage projects and transitions. Use this skill when users want to interact with Jira issues, projects, or workflows. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gate

通过你的 Agent 添加

安装目录:jira/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/jira-15553/
Codex CLI~/.codex/skills/jira-15553/
DeepSeek Harness~/.agents/skills/jira-15553/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

本技能提供Jira Cloud API的托管OAuth集成,通过Maton代理层统一访问Atlassian官方API。核心能力覆盖:

  • JQL智能搜索:支持复杂查询语法(如project = PROJ AND status = "In Progress"),可限定字段、分页结果
  • Issue全生命周期管理:创建、读取、更新、删除Issue,支持分配责任人、添加评论、状态流转
  • 项目与元数据操作:列举项目、获取Issue类型/优先级/状态等枚举值
  • 多连接管理:支持多Jira账户的OAuth连接切换,通过--connection参数指定目标账户

关键前提:所有操作需先获取cloudId(通过/oauth/token/accessible-resources),这是Jira Cloud的租户标识。

显著优点

  1. 零OAuth基础设施:Maton托管OAuth流程,开发者无需处理token刷新、scope管理
  2. 多语言SDK覆盖:提供CLI、Python、JavaScript完整示例,降低接入门槛
  3. 权限粒度可控:读操作即时可用,写操作需用户显式授权,符合最小权限原则
  4. 原生API透传:直接映射Atlassian REST API v3,功能完整度等同于官方SDK

潜在局限

  • 速率限制:10 req/sec/账户的硬限制,高频场景需客户端缓存或队列
  • Agile API受限:Scrum/Kanban看板操作需额外OAuth scope,需联系支持开通
  • URL编码负担:JQL参数需手动URL编码,复杂查询构建易出错
  • Shell管道陷阱:curl管道至jq时环境变量可能失效,文档已标注但仍易踩坑

适合人群

  • 需快速集成Jira自动化脚本的DevOps工程师
  • 构建内部工单系统的全栈开发者
  • 多Jira实例企业的平台集成团队

常规风险

  • 数据误操作:delete、transition等不可逆操作需二次确认机制
  • 密钥泄露:MATON_API_KEY暴露将导致全账户访问权限泄露,建议配合密钥管理服务
  • 租户隔离失效:多连接场景下未指定--connection可能操作错误账户

技能正文


name: jira description: | Jira API integration with managed OAuth. Search issues with JQL, create and update issues, manage projects and transitions. Use this skill when users want to interact with Jira issues, projects, or workflows. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). compatibility: Requires network access and valid Maton API key metadata: author: maton version: "1.0" clawdbot: emoji: 🧠 requires: env: - MATON_API_KEY

Jira

Access the Jira Cloud API with managed OAuth authentication. Search issues with JQL, create and manage issues, and automate workflows.

Quick Start

CLI:

maton jira issue search 'project = PROJ AND status = "In Progress"' --cloud-id abc-123
maton api '/jira/ex/jira/{cloudId}/rest/api/3/search/jql?jql=project%3DKEY&maxResults=10'

Python:

# First, get your cloud ID
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/jira/oauth/token/accessible-resources')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

# Then search issues
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/jira/ex/jira/{cloudId}/rest/api/3/search/jql?jql=project%3DKEY&maxResults=10')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

https://api.maton.ai/jira/{native-api-path}

Maton proxies requests to api.atlassian.com and automatically injects your OAuth token.

Getting Cloud ID

Jira Cloud requires a cloud ID. Get it first:

GET /jira/oauth/token/accessible-resources

Example:

maton jira cloud list

Response:

[{
  "id": "62909843-b784-4c35-b770-e4e2a26f024b",
  "url": "https://yoursite.atlassian.net",
  "name": "yoursite"
}]

Installation

NPM:

npm install -g @maton/cli

Homebrew:

brew install maton-ai/cli/maton

Authentication

CLI:

maton login                          # Opens browser for API key
maton login --interactive            # Skip browser, paste API key directly
maton whoami                         # Show current auth state

Manual:

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key
  4. Set your API key as MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"

Connection Management

Manage your Jira OAuth connections at https://api.maton.ai.

List Connections

CLI:

maton connection list jira --status ACTIVE
maton api -X GET /connections -f app=jira -f status=ACTIVE

Python:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections?app=jira&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

CLI:

maton connection create jira
maton api /connections -f app=jira

Python:

python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'jira'}).encode()
req = urllib.request.Request('https://api.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Get Connection

CLI:

maton connection view {connection_id}
maton api /connections/{connection_id}

Python:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Response:

{
  "connection": {
    "connection_id": "{connection_id}",
    "status": "ACTIVE",
    "creation_time": "2025-12-08T07:20:53.488460Z",
    "last_updated_time": "2026-01-31T20:03:32.593153Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "jira",
    "metadata": {}
  }
}

Open the returned url in a browser to complete OAuth authorization.

Delete Connection

CLI:

maton connection delete {connection_id}
maton api -X DELETE /connections/{connection_id}

Python:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Specifying Connection

If you have multiple Jira connections, specify which one to use:

CLI:

maton jira project list --cloud-id abc-123 --connection {connection_id}
maton api /jira/ex/jira/{cloudId}/rest/api/3/project --connection {connection_id}

Python:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/jira/ex/jira/{cloudId}/rest/api/3/project')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '{connection_id}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

If you have multiple connections, always specify the connection to ensure requests go to the intended account.

Security & Permissions

  • Access is scoped to issues, projects, boards, sprints, and users within the connected Jira account.
  • All write operations require explicit user approval. Before executing any create, update, or delete call, confirm the target resource and intended effect with the user.

API Reference

Projects

List Projects
GET /jira/ex/jira/{cloudId}/rest/api/3/project

Example:

maton jira project list --cloud-id abc-123
Get Project
GET /jira/ex/jira/{cloudId}/rest/api/3/project/{projectKeyOrId}

Example:

maton jira project view PROJ --cloud-id abc-123

Issues

Search Issues (JQL)
GET /jira/ex/jira/{cloudId}/rest/api/3/search/jql?jql=project%3DPROJ%20order%20by%20created%20DESC&maxResults=20&fields=summary,status,assignee

Example:

maton jira issue search 'project = PROJ order by created DESC' --cloud-id abc-123 --limit 20 --fields summary,status,assignee
Get Issue
GET /jira/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}

Example:

maton jira issue view PROJ-123 --cloud-id abc-123
Create Issue
POST /jira/ex/jira/{cloudId}/rest/api/3/issue
Content-Type: application/json

{
  "fields": {
    "project": {"key": "PROJ"},
    "summary": "Fix login",
    "issuetype": {"name": "Task"}
  }
}

Example:

maton jira issue create --cloud-id abc-123 --project PROJ --summary 'Fix login' --type Task
Update Issue
PUT /jira/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}
Content-Type: application/json

{
  "fields": {
    "summary": "Updated summary"
  }
}

Example:

maton jira issue update PROJ-123 --cloud-id abc-123 --summary 'Updated summary'
Delete Issue
DELETE /jira/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}

Example:

maton jira issue delete PROJ-123 --cloud-id abc-123
Assign Issue
PUT /jira/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}/assignee
Content-Type: application/json

{
  "accountId": "712020:5aff718e-6fe0-4548-82f4-f44ec481e5e7"
}

Example:

maton jira issue update PROJ-123 --cloud-id abc-123 --assignee 712020:5aff718e-6fe0-4548-82f4-f44ec481e5e7

Transitions

Get Transitions
GET /jira/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}/transitions

Example:

maton jira transition list PROJ-123 --cloud-id abc-123
Transition Issue (change status)
POST /jira/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}/transitions
Content-Type: application/json

{
  "transition": {"id": "31"}
}

Example:

maton jira transition apply PROJ-123 --cloud-id abc-123 --id 31

Comments

Get Comments
GET /jira/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}/comment

Example:

maton jira comment list PROJ-123 --cloud-id abc-123
Add Comment
POST /jira/ex/jira/{cloudId}/rest/api/3/issue/{issueIdOrKey}/comment
Content-Type: application/json

{
  "body": {
    "type": "doc",
    "version": 1,
    "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Comment text"}]}]
  }
}

Example:

maton jira comment add PROJ-123 --cloud-id abc-123 --body 'Comment text'

Users

Get Current User
GET /jira/ex/jira/{cloudId}/rest/api/3/myself

Example:

maton jira whoami --cloud-id abc-123
Search Users
GET /jira/ex/jira/{cloudId}/rest/api/3/user/search?query=john

Example:

maton jira user search john --cloud-id abc-123

Metadata

List Issue Types
GET /jira/ex/jira/{cloudId}/rest/api/3/issuetype

Example:

maton jira issuetype list --cloud-id abc-123
List Priorities
GET /jira/ex/jira/{cloudId}/rest/api/3/priority

Example:

maton jira priority list --cloud-id abc-123
List Statuses
GET /jira/ex/jira/{cloudId}/rest/api/3/status

Example:

maton jira status list --cloud-id abc-123

Code Examples

CLI

# Discover accessible Jira Cloud resources
maton jira cloud list

# Search issues with JQL
maton jira issue search 'project = PROJ AND status = "In Progress"' --cloud-id abc-123

# Filter with jq
maton jira issue search 'project = PROJ' --cloud-id abc-123 \
  --json --jq '.issues | map(select(.fields.status.name == "In Progress"))'

# Create an issue
maton jira issue create --cloud-id abc-123 --project PROJ --summary 'Fix login'

JavaScript

// Get cloud ID first
const resources = await fetch(
  'https://api.maton.ai/jira/oauth/token/accessible-resources',
  { headers: { 'Authorization': `Bearer ${process.env.MATON_API_KEY}` } }
).then(r => r.json());

const cloudId = resources[0].id;

// Search issues
const issues = await fetch(
  `https://api.maton.ai/jira/ex/jira/${cloudId}/rest/api/3/search/jql?jql=project=KEY`,
  { headers: { 'Authorization': `Bearer ${process.env.MATON_API_KEY}` } }
).then(r => r.json());

Python

import os
import requests

headers = {'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}

# Get cloud ID
resources = requests.get(
    'https://api.maton.ai/jira/oauth/token/accessible-resources',
    headers=headers
).json()

cloud_id = resources[0]['id']

# Search issues
issues = requests.get(
    f'https://api.maton.ai/jira/ex/jira/{cloud_id}/rest/api/3/search/jql',
    headers=headers,
    params={'jql': 'project=KEY', 'maxResults': 10}
).json()

Notes

  • Always fetch cloud ID first using /oauth/token/accessible-resources
  • JQL queries must be bounded (e.g., project=KEY)
  • Use URL encoding for JQL query parameters
  • Update, Delete, Transition return HTTP 204 on success
  • Agile API requires additional OAuth scopes. If you receive a scope error, contact Maton support at support@maton.ai with the specific operations/APIs you need and your use-case
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsing
  • IMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments. You may get "Invalid API key" errors when piping.

Error Handling

Status Meaning
400 Missing Jira connection or invalid JQL
401 Invalid or missing Maton API key
429 Rate limited (10 req/sec per account)
4xx/5xx Passthrough error from Jira API

Troubleshooting: API Key Issues

CLI:

  1. Check your auth state:
maton whoami
  1. Verify the API key is valid by listing connections:
maton connection list

Manual:

  1. Check that the MATON_API_KEY environment variable is set:
echo $MATON_API_KEY
  1. Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Troubleshooting: Invalid App Name

  1. Ensure your URL path starts with jira. For example:
  • Correct: https://api.maton.ai/jira/ex/jira/{cloudId}/rest/api/3/project
  • Incorrect: https://api.maton.ai/ex/jira/{cloudId}/rest/api/3/project

Resources

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

jiraproject-managementoauthapi-integrationatlassiandevopsautomationworkflow

同类 Skill