feat(mcp): MCP server for AI clients, consuming the REST API
New app apps/mcp (NestJS + @nestjs-mcp/server 2): Streamable HTTP at POST /mcp, stateless. - 24 tools: projects (mine, public, details with settings, board, stats, analytics, activity), tickets (my work, search, details with comments and history, create, update, move, assign, release, comment, link), releases (list, upcoming, details with progress and burnup, create, publish) and users (whoami, search). Admin operations stay in the web. - No credentials of its own: each call's Authorization header (a Pireon token) is forwarded to the API; without it only public projects are read. - Typed REST client generated from apps/api/openapi.json (openapi-fetch + openapi-typescript via `nx run mcp:openapi-types`); API refusals become readable tool errors; parameters validated with zod. - Tests: the real MCP against a simulated API (token forwarding, errors, validation, writes). - Docker target `mcp` (Node 24) and an optional compose service under the `mcp` profile; zod declared as a root dependency. - Docs: chapter 9 «Servidor MCP», references in 01/06/07 and the index; Word/PDF regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
63
apps/mcp/src/app/tools/summaries.ts
Normal file
63
apps/mcp/src/app/tools/summaries.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import type { Schemas } from '../api/taskstream-api';
|
||||
|
||||
/*
|
||||
* Compact views for listings: what the model needs to reason, without ids
|
||||
* and nested objects it rarely uses (full detail through the get_* tools).
|
||||
*/
|
||||
|
||||
type Issue = Schemas['IssueDto'];
|
||||
type Project = Schemas['ProjectDto'];
|
||||
type Release = Schemas['ReleaseDto'];
|
||||
|
||||
export const issueLine = (issue: Issue) => ({
|
||||
key: issue.key,
|
||||
title: issue.title,
|
||||
type: issue.type,
|
||||
status: issue.status,
|
||||
statusCategory: issue.statusCategory,
|
||||
priority: issue.priority,
|
||||
area: issue.area,
|
||||
assignee: issue.assignee?.name ?? null,
|
||||
release: issue.release?.name ?? null,
|
||||
labels: issue.labels,
|
||||
updatedAt: issue.updatedAt,
|
||||
});
|
||||
|
||||
export const projectLine = (project: Project) => ({
|
||||
key: project.key,
|
||||
name: project.name,
|
||||
description: project.description,
|
||||
isPublic: project.isPublic,
|
||||
owner: project.owner.name,
|
||||
members: project.members.length,
|
||||
updatedAt: project.updatedAt,
|
||||
});
|
||||
|
||||
/** Statuses, types and areas by id: what create/update/move tools accept. */
|
||||
export const projectSettings = (project: Project) => ({
|
||||
statuses: project.settings.statuses.map((s) => ({
|
||||
id: s.id,
|
||||
name: s.name,
|
||||
category: s.category,
|
||||
requiresReason: s.requiresReason,
|
||||
archived: s.archived,
|
||||
})),
|
||||
issueTypes: project.settings.issueTypes.map((t) => ({
|
||||
id: t.id,
|
||||
name: t.name,
|
||||
archived: t.archived,
|
||||
})),
|
||||
areas: project.settings.areas.map((a) => ({
|
||||
id: a.id,
|
||||
name: a.name,
|
||||
archived: a.archived,
|
||||
})),
|
||||
});
|
||||
|
||||
export const releaseLine = (release: Release) => ({
|
||||
id: release.id,
|
||||
name: release.name,
|
||||
status: release.status,
|
||||
targetDate: release.targetDate,
|
||||
releasedAt: release.releasedAt,
|
||||
});
|
||||
Reference in New Issue
Block a user