PO
OfficialMedia

PostIdentity MCP Server: AI Post and Identity Management

Generate AI posts, manage identities, track referrals and browse marketplace templates with the PostIdentity MCP server.

Quick Install
npx -y @PostIdentity/mcp-server

Overview

PostIdentity MCP Server is a lightweight Model Context Protocol (MCP) server designed to power AI-driven post generation, identity management, referral tracking, and a marketplace of post templates. It provides a single API surface that can be used by language models, front-end apps, and backend services to synthesize content, associate posts with identities, and measure referral-driven activity.

The server is useful when you want to decentralize post creation and identity lifecycle management from your application code. By exposing standardized endpoints for identities, posts, referrals, and templates, PostIdentity acts as a reusable building block for social apps, marketing automation, and AI assistants that need to create contextualized posts tied to known identities.

Features

  • Generate AI-authored posts with structured metadata (author identity, media, visibility)
  • Create and manage identities (profiles, public keys, metadata)
  • Track referral events and attribute conversions to identities/referrers
  • Browse and use marketplace templates for consistent post formats
  • Simple REST API compatible with MCP tooling and LLM tool callers
  • Docker-friendly and configurable via environment variables
  • Extensible storage backend (SQLite/Postgres or other DBs via DATABASE_URL)

Installation / Configuration

Prerequisites: Node.js (>=14) or Docker.

Clone the repo and run locally:

git clone https://github.com/PostIdentity/mcp-server.git
cd mcp-server
# install dependencies
npm install
# set environment variables and run
export PORT=3000
export DATABASE_URL="sqlite:./data.db"
export MCP_SECRET="super-secret-key"
npm start

Run with Docker:

# build image
docker build -t postidentity-mcp .
# run container (example with local sqlite volume)
docker run -it --rm -p 3000:3000 \
  -e PORT=3000 \
  -e DATABASE_URL="sqlite:./data.db" \
  -e MCP_SECRET="super-secret-key" \
  -v $(pwd)/data:/app/data \
  postidentity-mcp

Recommended environment variables

VariablePurposeExample
PORTHTTP port to listen on3000
DATABASE_URLConnection string for DB (sqlite/postgres)sqlite:./data.db or postgres://user:pass@host:5432/db
MCP_SECRETShared secret for MCP authenticationa-long-secret
CORS_ORIGINSAllowed origins for CORS (comma-separated)http://localhost:8080
LOG_LEVELLogging verbosityinfo, debug, warn

Database migrations

  • If the project includes migrations, run the provided migration command (e.g., npm run migrate) before starting in production.

Available Resources

The server exposes REST endpoints for primary resources. Below is a concise reference.

EndpointMethodDescription
/identitiesPOSTCreate a new identity (profile, metadata)
/identities/:idGET/PUT/DELETERetrieve/update/delete an identity
/postsPOSTGenerate a new AI post (input prompt, identity id)
/posts/:idGETRetrieve post and metadata
/templatesGETList marketplace templates
/templates/:id/usePOSTCreate post from a template
/referralsPOSTRecord a referral event
/referrals/:idGETRetrieve referral details
/mcp/toolsGETList MCP tools exposed to model runtimes

Authentication

  • Use the MCP_SECRET or an API key header (e.g., Authorization: Bearer ) depending on your deployment configuration.
  • For integrations with LLM tool call mechanisms, the MCP secret protects tool invocation.
  • Example Usage

    Create an identity (curl):

    curl -X POST http://localhost:3000/identities \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer ${MCP_SECRET}" \
      -d '{
        "displayName": "Alice Author",
        "handle": "alice",
        "metadata": { "bio": "AI content creator" }
      }'
    

    Generate a post using an identity (curl):

    curl -X POST http://localhost:3000/posts \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer ${MCP_SECRET}" \
      -d '{
        "identityId": "identity-uuid",
        "prompt": "Announce a new blog about secure AI publishing",
        "visibility": "public",
        "templateId": "short-announcement"
      }'
    

    Node.js example (fetch):

    import fetch from "node-fetch";
    
    const res = await fetch("http://localhost:3000/posts", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${process.env.MCP_SECRET}`,
      },
      body: JSON.stringify({
        identityId: "identity-uuid",
        prompt: "Share a quick tip about model context",
        visibility: "public"
      })
    });
    const post = await res.json();
    console.log(post);
    

    Track a referral

    curl -X POST http://localhost:3000/referrals \
      -H "Content-Type: application/json" \
      -d '{
        "referrerId": "identity-uuid",
        "referredEmail": "[email protected]",
        "campaign": "spring-promo"
      }'
    

    Use Cases

    • AI-powered social publishing: let models generate posts that are automatically attributed to application-managed identities, keeping content and provenance linked.
    • Template marketplace: maintain a library of reusable post templates (prompts + metadata) that content creators or LLMs can select and instantiate.
    • Referral and attribution tracking: record referral events from posts or campaigns to measure conversion and reward referrers.
    • Assistant tooling and MCP integrations: expose post-generation functions as MCP tools so LLMs can call the server during an interactive session to create content or query identities.
    • Multi-tenant content platforms: centralize identity and post flows so different services can use the same identity registry and template marketplace.

    Notes for Developers

    • Start by running locally with SQLite for fast iteration, then switch to a managed Postgres via DATABASE_URL in production.
    • Secure MCP endpoints with a strong secret and consider additional rate limits and auth for public deployments.
    • The MCP server is intended to be a composable backend component: integrate it into your web app or LLM workflow via the REST API or an SDK layer.
    Tags:media