Skip to main content

Projectors

Apply Idiomark personalities to external systems - MCP servers, HTTP APIs, and more.

Overview​

Projectors are adapters that project Idiomark personalities onto external systems (the opposite of adapters which extract personalities from text).

┌─────────────────────┐ ┌──────────────────────┐
│ Idiomark Personality │────────▶│ External System │
│ (voice, values) │ Apply │ (MCP, HTTP APIs) │
└─────────────────────┘ └──────────────────────┘

Available Projectors​

ProjectorDescriptionPackage
MCP ServerModel Context Protocol server with personality-driven tools@idiomark/projectors/mcp
HTTP ServerREST API that responds with personality@idiomark/projectors/http

Architecture​

All projectors extend BaseProjectionAdapter which provides:

FeatureDescription
Rate LimitingConfigurable request throttling
CachingCache personality applications
Retry LogicAutomatic retry with exponential backoff
MetricsRequest counting, latency tracking
EventsEvent emission for observability

Personality Modes​

All projectors support three personality application modes:

ModeDescription
strictMaximum personality application
balancedBalanced personality (default)
subtleSubtle personality hints

MCP Server​

Creates an MCP server that exposes your personality as tools and resources.

Exposed Tools​

ToolDescription
generate_responseGenerate responses with your personality
get_personalityQuery personality metadata (voice, values, domains, knowledge)
get_system_promptGet the system prompt encoding
get_healthHealth check with metrics

Exposed Resources​

ResourceDescription
idiomark:///personalityFull Idiomark file
idiomark:///voiceVoice profile (tone, formality, humor, etc.)
idiomark:///valuesCore values and principles
idiomark:///domainsAreas of expertise and interest

Usage​

import { MCPServer } from "@idiomark/projectors/mcp";
import myPersonality from "./my-personality.idiomark";

const server = new MCPServer({
transport: "stdio", // or 'http'
port: 3000, // required for http transport
personality: myPersonality,
});

await server.start();

Configuration​

interface MCPServerConfig {
transport: "stdio" | "http";
port?: number;
personality: IdiomarkFile;
provider?: "anthropic" | "openai" | "auto";
model?: string;
}

HTTP Server​

Simple REST API that applies your personality to incoming requests.

Endpoints​

EndpointMethodDescription
/generatePOSTGenerate response with personality
/streamPOSTStream response (SSE)
/personalityGETView personality JSON
/system-promptGETView system prompt
/healthGETHealth check with metrics

Usage​

import { HTTPServerAdapter } from "@idiomark/projectors/http";
import myPersonality from "./my-personality.idiomark";

const server = new HTTPServerAdapter({
port: 3000,
personality: myPersonality,
provider: "anthropic", // or 'openai'
model: "claude-3-opus-20240229",
});

await server.start();

Example Request​

curl -X POST http://localhost:3000/generate \
-H "Content-Type: application/json" \
-d '{"message": "Hello!", "mode": "balanced"}'

Generated Adapter Structure​

MCP Adapter​

my-server/
├── src/
│ ├── index.ts # Entry point
│ ├── tools.ts # MCP tools definition
│ ├── resources.ts # MCP resources
│ └── handlers.ts # Request handlers
├── package.json
├── tsconfig.json
├── tsup.config.ts
└── README.md

HTTP Adapter​

personality-api/
├── src/
│ ├── index.ts # Server setup
│ ├── routes.ts # API routes
│ └── middleware.ts # Middleware
├── package.json
├── tsconfig.json
├── tsup.config.ts
└── README.md

Environment Variables​

VariableDescriptionDefault
IDIOMARK_API_KEYAPI key for inference-
Idiomark_MODELDefault modelgpt-4