Skip to main content
Glama
publish-mcp

publish-mcp

by 12dkaskar
README.md
# social-publish

Production-oriented social content publishing engine for Hermes Agent (MCP) with human-in-the-loop approval.

## Stack

Node.js 22 · TypeScript strict · MCP SDK · Fastify · PostgreSQL · Prisma · Vitest · Pino · Docker Compose

Phase 1: **LinkedIn text** via `POST /v2/ugcPosts` (validated) and `GET /v2/userinfo`.

## Quick start (local)

```bash
cd C:\Users\parth\social-publish
cp .env.example .env
# Edit .env — set MCP_SERVICE_TOKEN, ADMIN_API_TOKEN, APPROVAL_API_KEY (min 16 chars)

docker compose -f docker/compose.yml up -d postgres

npm install
npm run db:generate
npm run db:migrate   # or: npx prisma migrate deploy (production)

npm run build
npm test

npm run dev:api
```

Create a LinkedIn destination account (uses MCP token):

```bash
curl -X POST http://127.0.0.1:8090/v1/admin/platform-accounts ^
  -H "Authorization: Bearer %ADMIN_API_TOKEN%" ^
  -H "Content-Type: application/json" ^
  -d "{\"platform\":\"linkedin\",\"account_key\":\"YENWoZekVM\",\"display_name\":\"Deepti Kaskar\"}"
```

Approval UI: http://127.0.0.1:8090/approval/

## Safety defaults

- `LIVE_PUBLISH_ENABLED=false` — dry-run only (no LinkedIn POST).
- `allow_mcp_trigger` defaults **false** on publication authorization.
- No live LinkedIn calls in tests.
- Ambiguous LinkedIn timeouts → `ambiguous` job, **no** auto-retry.

## MCP server

```bash
npm run build -w @social-publish/publish-mcp
# stdio entry: apps/publish-mcp/dist/index.js
```

See [docs/hermes-mcp-integration.md](./docs/hermes-mcp-integration.md).

## Media (local filesystem)

Place files under `data/media/` and reference `storage_key` relative to that root (e.g. `sessions/demo/photo.jpg`).

## Docker (API + Postgres)

```bash
docker compose -f docker/compose.yml up --build
```

Run migrations inside the API container before first use (`npm run db:migrate`).

## Workspace layout

| Path | Role |
|------|------|
| `apps/publish-api` | Fastify, approval UI, credentials |
| `apps/publish-mcp` | Hermes stdio MCP tools |
| `packages/contracts` | Zod MCP/HTTP schemas |
| `packages/core` | Domain services |
| `packages/db` | Prisma |
| `packages/platform-adapters` | LinkedIn adapter |