Skip to main content
Glama
monsteruk-crm

Example Next.js MCP Server

Rejectionism CampaignOS

The operational headquarters for REJECTIONISM, the satirical art movement built around rejection.

SECURITY: /admin and the MCP endpoints require authentication with a single shared credential (see ADR 0003). Configure CAMPAIGNOS_PASSWORD (32–256 chars) for admin login and MCP Bearer access; missing or invalid configuration fails closed.


Documentation


Related MCP server: Example Next.js MCP Server

Architecture Overview

CampaignOS exposes two primary interfaces powered by the same shared server-only domain service layer (lib/campaign/) and PostgreSQL database:

  1. Admin Web Interface (/admin):

    • Operations Command Dashboard (Now, Next, Blocked, Missing Assets, Websites, Decisions, Activity feed).

    • Filterable Visual Asset Library (/admin/assets) with raster previews, format placeholders, and storage badges.

    • Asset Revisions & Representations management (/admin/assets/[id]) with primary representation switcher and external URL appends.

    • Single-use capability Upload Links management (/admin/upload-links) with one-time raw link display and regeneration.

    • Admin Bulk Ingestion (/admin/assets/upload) with grouping mode selection and direct multi-row Blob uploads.

    • Global Search (/admin/search) across all 8 registers and polymorphic tag associations.

    • Management screens for Work Items, Canon, Decisions, Websites, Content Pieces, Contacts, and CampaignMemory (/admin/memory).

  2. Remote MCP Server (/api/mcp and legacy /mcp):

    • Stateless Model Context Protocol endpoint exposing 55 tools across all registers, diagnostics, uploads, relationships, tags, search, and the durable cross-tool CampaignMemory (remember / update / supersede / archive / get / list / recall / get-context).

  3. Public Upload Portal (/upload/[token]):

    • Capability-authorized, unauthenticated contributor submission page with real-time Blob uploads, server-side format/dimension verification, and atomic finalization.


Environment Configuration

Configure the following five environment variables:

# PostgreSQL connection string for Prisma pg adapter
MCP_PRISMA_DATABASE_URL=postgresql://user:password@localhost:5432/campaignos

# Disposable PostgreSQL database URL for integration tests (must differ from operational URL)
TEST_MCP_PRISMA_DATABASE_URL=postgresql://user:password@localhost:5432/campaignos_test

# Shared credential: admin login password and MCP Bearer token (32-256 characters)
CAMPAIGNOS_PASSWORD=generate-a-long-random-credential

# Server-only private Vercel Blob read/write token
BLOB_READ_WRITE_TOKEN=vercel_blob_rw_xxxxxxxxxxxx

# Application origin used for auth and capability URL construction (HTTPS in production)
CAMPAIGNOS_BASE_URL=http://localhost:3000

Local Development Quick Start

# 1. Install dependencies
pnpm install

# 2. Generate Prisma client
pnpm db:generate

# 3. Apply migrations to your database
pnpm db:deploy

# 4. Backfill legacy asset representations (idempotent)
pnpm db:backfill-assets

# 5. Seed canonical Rejectionism data
pnpm db:seed

# 6. Start development server
pnpm dev

Visit:

  • Admin Dashboard: http://localhost:3000/admin

  • Global Search: http://localhost:3000/admin/search

  • Asset Library: http://localhost:3000/admin/assets

  • Upload Links: http://localhost:3000/admin/upload-links

  • CampaignMemory: http://localhost:3000/admin/memory

  • Health Diagnostic: http://localhost:3000/api/health

  • MCP Endpoint: http://localhost:3000/api/mcp


Connecting AI Clients (OpenAI Codex, Claude Desktop, Cursor)

MCP requests require Authorization: Bearer <CAMPAIGNOS_PASSWORD>.

{
  "mcpServers": {
    "rejectionism-campaign-os": {
      "url": "http://localhost:3000/api/mcp",
      "headers": {
        "Authorization": "Bearer <CAMPAIGNOS_PASSWORD>"
      }
    }
  }
}

Running Test and Verification Suites:

# Run unit tests
pnpm test

# Run MCP protocol suite
pnpm test:mcp --origin=http://localhost:3000

# Run functional release verification gate
pnpm verify:functional --origin=http://localhost:3000

# Run smoke client
pnpm test:client -- http://localhost:3000

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A drop-in Model Context Protocol server implementation for Next.js projects that enables AI tools, prompts, and resources integration using the Vercel MCP Adapter.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A template for deploying Model Context Protocol servers as Next.js routes using the mcp-handler adapter, enabling easy integration of MCP tools, prompts, and resources into any Next.js application.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An example MCP server using mcp-handler to integrate MCP tools, prompts, and resources into any Next.js project.
    MIT