fix(mcp-server): move default port 4006 → 4007 (conflict with extraction-service Python sidecar); add Dockerfile + docker-compose service + CI workflow
This commit is contained in:
parent
029c28d0c9
commit
3bc8e0e14c
34
.github/workflows/ci-mcp-server.yml
vendored
Normal file
34
.github/workflows/ci-mcp-server.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# CI for mcp-server (TypeScript only)
|
||||||
|
# Triggers on changes to mcp-server or its workspace package dependencies
|
||||||
|
name: CI — MCP Server
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'services/mcp-server/**'
|
||||||
|
- 'packages/errors/**'
|
||||||
|
- 'packages/config/**'
|
||||||
|
- 'packages/auth/**'
|
||||||
|
- 'packages/fastify-core/**'
|
||||||
|
- 'packages/logger/**'
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'services/mcp-server/**'
|
||||||
|
- 'packages/errors/**'
|
||||||
|
- 'packages/config/**'
|
||||||
|
- 'packages/auth/**'
|
||||||
|
- 'packages/fastify-core/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
typescript:
|
||||||
|
name: TypeScript (build + test + typecheck)
|
||||||
|
uses: ./.github/workflows/reusable-pnpm-workspace.yml
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
pnpm-version: '10'
|
||||||
|
command: |
|
||||||
|
pnpm -r --filter @bytelyst/mcp-server... build
|
||||||
|
pnpm --filter @bytelyst/mcp-server test
|
||||||
|
pnpm --filter @bytelyst/mcp-server exec tsc --noEmit
|
||||||
@ -108,6 +108,37 @@ services:
|
|||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
||||||
|
# ── MCP Server (Fastify + TypeScript) ────────────────────────
|
||||||
|
# Exposes tool namespaces: platform.telemetry.*, platform.diagnostics.*,
|
||||||
|
# extraction.*, support.* — consumed by AI agents + admin tooling
|
||||||
|
mcp-server:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: services/mcp-server/Dockerfile
|
||||||
|
ports:
|
||||||
|
- '4007:4007'
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- PORT=4007
|
||||||
|
- PLATFORM_SERVICE_URL=http://platform-service:4003
|
||||||
|
- EXTRACTION_SERVICE_URL=http://extraction-service:4005
|
||||||
|
depends_on:
|
||||||
|
platform-service:
|
||||||
|
condition: service_healthy
|
||||||
|
extraction-service:
|
||||||
|
condition: service_healthy
|
||||||
|
labels:
|
||||||
|
- 'traefik.enable=true'
|
||||||
|
- 'traefik.http.routers.mcp.rule=PathPrefix(`/api/tools`)'
|
||||||
|
- 'traefik.http.services.mcp.loadbalancer.server.port=4007'
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD', 'wget', '-q', '--spider', 'http://127.0.0.1:4007/health']
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
|
||||||
# ── Volumes ───────────────────────────────────────────────────────
|
# ── Volumes ───────────────────────────────────────────────────────
|
||||||
volumes:
|
volumes:
|
||||||
loki-data:
|
loki-data:
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# MCP Server — port 4006
|
# MCP Server — port 4007
|
||||||
PORT=4006
|
PORT=4007
|
||||||
HOST=0.0.0.0
|
HOST=0.0.0.0
|
||||||
LOG_LEVEL=info
|
LOG_LEVEL=info
|
||||||
|
|
||||||
|
|||||||
39
services/mcp-server/Dockerfile
Normal file
39
services/mcp-server/Dockerfile
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Build context: repo root (docker compose sets context: .)
|
||||||
|
FROM node:22-alpine AS builder
|
||||||
|
RUN npm install -g pnpm@10
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy workspace config + lockfile for dependency resolution
|
||||||
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml tsconfig.base.json ./
|
||||||
|
|
||||||
|
# Copy all relevant package.json files (pnpm needs these for workspace resolution)
|
||||||
|
COPY packages/errors/package.json packages/errors/
|
||||||
|
COPY packages/config/package.json packages/config/
|
||||||
|
COPY packages/auth/package.json packages/auth/
|
||||||
|
COPY packages/fastify-core/package.json packages/fastify-core/
|
||||||
|
COPY packages/logger/package.json packages/logger/
|
||||||
|
COPY packages/monitoring/package.json packages/monitoring/
|
||||||
|
COPY packages/testing/package.json packages/testing/
|
||||||
|
COPY services/mcp-server/package.json services/mcp-server/
|
||||||
|
|
||||||
|
# Install all workspace deps
|
||||||
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
# Copy source
|
||||||
|
COPY packages/ packages/
|
||||||
|
COPY services/mcp-server/tsconfig.json services/mcp-server/
|
||||||
|
COPY services/mcp-server/src/ services/mcp-server/src/
|
||||||
|
|
||||||
|
# Build packages first, then service
|
||||||
|
RUN pnpm -r --filter @bytelyst/mcp-server... build
|
||||||
|
|
||||||
|
# Deploy to isolated directory (production deps only)
|
||||||
|
RUN pnpm --filter @bytelyst/mcp-server deploy --legacy /app/deploy
|
||||||
|
|
||||||
|
# ── Production ─────────────────────────────────────────────
|
||||||
|
FROM node:22-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/deploy ./
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
EXPOSE 4007
|
||||||
|
CMD ["node", "dist/server.js"]
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
const envSchema = z.object({
|
const envSchema = z.object({
|
||||||
PORT: z.coerce.number().default(4006),
|
PORT: z.coerce.number().default(4007),
|
||||||
HOST: z.string().default('0.0.0.0'),
|
HOST: z.string().default('0.0.0.0'),
|
||||||
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
||||||
CORS_ORIGIN: z.string().optional(),
|
CORS_ORIGIN: z.string().optional(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user