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:
23
Dockerfile
23
Dockerfile
@@ -1,6 +1,7 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
# TaskStream images (one Dockerfile, two targets):
|
||||
# docker compose up -d --build → api + web + infrastructure
|
||||
# TaskStream images (one Dockerfile, three targets):
|
||||
# docker compose up -d --build → api + web + infrastructure
|
||||
# docker compose --profile mcp up -d --build → plus the MCP server
|
||||
#
|
||||
# @pi/ui comes from Pireon's private Nexus. Its token is passed as a build
|
||||
# secret (compose: `secrets.nexus_token` ← $NEXUS_TOKEN) and never lands in a
|
||||
@@ -35,6 +36,24 @@ HEALTHCHECK --interval=10s --timeout=3s --start-period=20s --retries=5 \
|
||||
CMD wget -qO- http://127.0.0.1:3000/api/health > /dev/null || exit 1
|
||||
CMD ["node", "main.js"]
|
||||
|
||||
# ---- MCP: server for AI clients, consumes the API over REST ------------
|
||||
FROM deps AS build-mcp
|
||||
COPY . .
|
||||
RUN npx nx run mcp:prune
|
||||
|
||||
# @nestjs-mcp/server 2 targets Node 24.
|
||||
FROM node:24-alpine AS mcp
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production MCP_PORT=3010
|
||||
COPY --from=build-mcp /workspace/dist/apps/mcp/package.json /workspace/dist/apps/mcp/package-lock.json ./
|
||||
RUN npm ci --omit=dev --ignore-scripts --no-audit --no-fund && npm cache clean --force
|
||||
COPY --from=build-mcp /workspace/dist/apps/mcp/main.js ./
|
||||
USER node
|
||||
EXPOSE 3010
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=5 \
|
||||
CMD wget -qO- http://127.0.0.1:3010/health > /dev/null || exit 1
|
||||
CMD ["node", "main.js"]
|
||||
|
||||
# ---- Web: Angular SPA behind nginx (proxies /api and /graphql) ---------
|
||||
FROM deps AS build-web
|
||||
COPY . .
|
||||
|
||||
Reference in New Issue
Block a user