Skip to main content
Glama
README.md
# LF Content MCP

A minimal, security-focused Model Context Protocol server
for AI-assisted editorial content ingestion.

## Features

- Draft-only article creation.
- Human-controlled editorial review and publication.
- Official MCP SDK and Zod validation.
- Stdio and Streamable HTTP transports.
- Bounded retries for transient gateway failures.
- No direct database access.
- No automatic publication.

## Architecture

    MCP client
        |
    LF Content MCP
        |
    Local HTTP gateway adapter
        |
    Editorial CMS gateway
        |
    Content database

The MCP server is independent of the CMS implementation.
The gateway is responsible for authorization, persistence,
audit logging and durable idempotency.

## Installation

Requires Node.js 22 or later.

    npm ci
    npm run build
    npm test

## Configuration

Copy the example configuration:

    cp .env.example .env
    chmod 600 .env

Configure the following environment variables:

| Variable | Purpose |
| --- | --- |
| LF_CONTENT_API_URL | Loopback URL of the editorial gateway |
| LF_CONTENT_API_TOKEN | Gateway bearer credential |
| MCP_HTTP_TOKEN | Independent HTTP transport credential |
| MCP_HTTP_PORT | HTTP listener port, defaults to 33181 |

Gateway URLs must use HTTP on a loopback address.
Remote gateways require a separately secured local relay.

HTTP transport requires a 64-character lowercase
hexadecimal token.

Generate an independent HTTP token using:

    openssl rand -hex 32

Never commit actual credentials or infrastructure configuration.

## Running with stdio

    node --env-file=.env dist/index.js

## Running with Streamable HTTP

    node --env-file=.env dist/httpIndex.js

The HTTP transport listens on loopback only.

Default MCP endpoint:

    http://127.0.0.1:33181/mcp

The transport validates authorization, Host and Origin.

## MCP tool

### content_draft_create

Creates an unpublished editorial article draft.

Required inputs:

- title
- lead
- body_markdown

Optional inputs:

- seo_title
- seo_description
- tags

Successful response:

    {
      "id": "draft-record-id",
      "status": "draft",
      "published": false
    }

The tool cannot publish, delete, list or modify existing
content. Callers cannot select the publication status
or override the author identity.

## Gateway contract

The adapter submits JSON using HTTP POST and bearer
authorization to the configured local gateway endpoint.

The gateway must enforce draft-only persistence and
return the draft result contract.

Repeated identical requests must be safe. Durable
idempotency is a gateway responsibility.

## Reliability

Transient transport failures and HTTP 502, 503 and 504
responses are retried with bounded backoff.

Retries preserve the original payload.
Application errors and redirects are not retried.

A persistent outage may still cause a tool failure.

## Security

This server is intended for public editorial material.
Customer records, credentials and confidential information
are outside its permitted editorial scope.

Do not expose the HTTP listener directly to the internet.
Use an authenticated and appropriately secured transport.

The CMS gateway must independently enforce authorization,
validation and publication restrictions.

## Testing

    npm test

The test suite uses local mock gateways and does not
require access to a production CMS or database.

## Project scope

This project implements editorial content ingestion.
It is not an autonomous editorial agent, research agent
or content distribution system.

Human editorial approval remains mandatory.

## License

Apache License 2.0.

Copyright 2026 Lhotse Finance.

See LICENSE and NOTICE for details.
See CONTRIBUTING.md for contribution requirements.