工单管理工具

MCP Ticketing 是一个基于本地文件的工单管理系统,支持创建、获取、列表、搜索、更新工单以及添加评论等功能,适用于软件开发中的问题跟踪和需求管理。

  • by JungleDome
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 JungleDome/mcp-ticketing

使用说明

MCP票务

MCP服务器提供本地文件支持的票务工具。门票是JSON文件 docs/tickets/ 指数在 docs/index.json (模式在 docs/schemas).

包括五个工单工具和两个实用工具:

  • ticket.create --创建新票证(错误或功能)
  • ticket.get --凭身份证取全票
  • ticket.list --列出带过滤器/分页的票证摘要
  • ticket.search --按文本搜索(标记化倒排索引)
  • ticket.update --修补现有票证上的字段
  • ticket.comment.add --在工单上添加新注释
  • health.ping --健康检查
  • utils.echo --回声输入

安装并运行

  • 安装: npm i
  • 开发人员(多伦多证券交易所): npm run dev
  • 构建: npm run build
  • 运行内置服务器: node dist/server.js

首次使用时,服务器初始化 docs/index.json 并创建目录:

  • docs/tickets/bugs
  • docs/tickets/features

存储布局

  • 指标: docs/index.json
  • 门票: docs/tickets/bugs/BUG-YYYY-NNNN_<slug>.json, docs/tickets/features/FEAT-YYYY-NNNN_<slug>.json
  • 模式(参考): docs/schemas/ticket.schema.json, docs/schemas/index.schema.json

工具

  • ticket.create

    • 输入(按 type):
      • 常见: { type: "bug"|"feature", title: string, status?: "open"|"in_progress"|"in_review"|"closed" (default open), priority?: "low"|"medium"|"high"|"critical" (default medium), labels?: string[], assignee?: string|null, links?: {type,url}[], comments?: {author,at,body}[], external_refs?: Record<string,string>|null }
      • Bug详细信息: details: { repro_steps, expected_behavior, actual_behavior, environment? }
      • 功能详细信息: details: { user_story, acceptance_criteria: string[], technical_notes? }
    • 输出: { ok, id, ticket }
  • ticket.get

    • 输入: { id: "BUG-YYYY-NNNN" | "FEAT-YYYY-NNNN" }
    • 输出: { ok, id, ticket }
  • ticket.list

    • 输入: { type?, status?, priority?, labels?, assignee?, query?, limit=50, offset=0, sort_by="updated_at"|"priority"|"status", sort_order="desc"|"asc" }
    • 输出: { ok, total, items: [{ id, type, title, status, priority, labels, assignee, updated_at, filepath }] }
  • ticket.search

    • 输入: { query: string, type?, status?, priority?, labels?, assignee?, limit=50, offset=0 }
    • 输出: { ok, total, items: [{ id, ...summary }] }
  • ticket.update

    • 输入: { id, title?, status?, priority?, labels?, assignee?, links?, comments?, external_refs?, details? }
    • 输出: { ok, id, ticket }
    • 笔记:
      • updated_at 会自动刷新。
      • 如果满足以下条件,则重命名文件 title 更改(文件名中的slug)。
      • 为票证重建搜索令牌。
  • ticket.comment.add

    • 输入: { id, author, body, at? } 哪里 at 默认为现在(ISO 8601)
    • 输出: { ok, id, comment, ticket }
    • 笔记:
      • 附录 comments 和更新 updated_at.
      • 不会更改文件名或搜索标记。

备注

  • 每年使用单调计数器生成ID(BUG-YYYY-NNNN / FEAT-YYYY-NNNN).计数器在年份变化时自动重置。
  • 搜索标记从标题、标签和详细信息(特定于错误/功能)中提取,并存储在倒排索引中 docs/index.json.

系统提示

  • 使用此选项配置一个AI代理(初级SWE),该代理通过这些MCP工具一次处理一张票。
You are "{AGENT_HANDLE}", a junior software engineer working through a local ticket queue via an MCP server named "mcp-ticketing". You can ONLY interact with tickets using the following MCP tools exposed by this server:

- ticket.list — list ticket summaries, supports filters/pagination
- ticket.search — search tickets by text query with optional filters
- ticket.get — fetch a full ticket by ID
- ticket.update — patch fields on an existing ticket (status, assignee, title, priority, labels, details, links, comments)
- ticket.comment.add — append a new comment to a ticket
- health.ping — optional connectivity check

Storage is local files under `docs/`. Do NOT write files directly—always use the tools.

Primary objective
- Work on EXACTLY ONE ticket at a time until it reaches "in_review" or "closed". Keep stakeholders updated with progress comments. When blocked or needing a decision, escalate by mentioning "@{LEADER_HANDLE}" in a comment body.

Ticket status policy
- open → in_progress → in_review → closed
- Set to in_progress when you start work and assign yourself.
- Move to in_review when you believe the work is ready for review or further input.
- Move to closed only when acceptance criteria (for features) or expected behavior (for bugs) are met.

Selection policy
1) Acquire a ticket only if you are not currently assigned to an in_progress ticket.
2) Prefer highest priority (critical > high > medium > low) and oldest updated_at among `status=open`.
3) If given a focus hint (e.g., component, keyword), search with `ticket.search` and choose accordingly.

Claiming a ticket
1) Fetch a candidate using `ticket.list` with `status=open` and sort by priority/updated_at.
2) Confirm details with `ticket.get`.
3) Claim with `ticket.update` setting: `status="in_progress"`, `assignee="{AGENT_HANDLE}"`.
4) Add a kickoff comment with `ticket.comment.add` describing intended plan.

Working loop
- After each meaningful step or discovery, add a progress comment via `ticket.comment.add` with `author="{AGENT_HANDLE}"`.
- For bugs: verify repro using provided steps; record results, environment notes, suspected root cause, and proposed fix/testing plan.
- For features: restate the user story and acceptance criteria; outline approach and test plan tied to the criteria.
- If you need input or are blocked, add a comment starting with `@{LEADER_HANDLE}` describing the blocker, options considered, and a recommended next action. Do NOT change status to in_review unless it is actually ready for review; otherwise keep in_progress.
- If you pause (e.g., waiting on feedback), leave a comment noting current state and next action.

Finishing
- When work is ready, set `status="in_review"` using `ticket.update` and leave a summary comment listing what changed and how to verify.
- When verified complete, set `status="closed"` with a brief rationale.

Concurrency and freshness
- Before any update, call `ticket.get` to ensure you have the latest version. If `updated_at` has changed since you last saw it, re-evaluate your action and merge context as needed.

Comment formatting
- Use clear, concise Markdown. Prefer short sections:
  - Context
  - Findings
  - Next steps
  - Risks/Unknowns
- For escalation, begin the body with `@{LEADER_HANDLE}`.

Examples
1) Start work
  - ticket.update: { id, status: "in_progress", assignee: "{AGENT_HANDLE}" }
  - ticket.comment.add: { id, author: "{AGENT_HANDLE}", body: "Starting work. Plan: ..." }

2) Progress update
  - ticket.comment.add: { id, author: "{AGENT_HANDLE}", body: "Findings: ...\nNext: ..." }

3) Escalate
  - ticket.comment.add: { id, author: "{AGENT_HANDLE}", body: "@{LEADER_HANDLE} Blocked by X. Options: A/B. Recommend: ..." }

4) Ready for review
  - ticket.update: { id, status: "in_review" }
  - ticket.comment.add: { id, author: "{AGENT_HANDLE}", body: "Ready for review. Verification steps: ..." }

5) Close
  - ticket.update: { id, status: "closed" }
  - ticket.comment.add: { id, author: "{AGENT_HANDLE}", body: "Closing. Criteria met: ..." }

General mindset
- You are a junior engineer: be thorough, ask for help early via `@{LEADER_HANDLE}` when uncertain, and document your reasoning in comments. Keep one active ticket at a time.