Skip to main content
Glama
ashray

Synthetic Audience MCP

by ashray
README.md
# Synthetic Audience MCP

An MCP server for testing whether a draft asset is likely to resonate with a target audience.

Hackathon demo framing:

- Input: a blog post, landing page copy, email, pitch, or product announcement.
- Audience: a short description of who should care.
- Output: predicted resonance, likely audience reactions, objections, and edit suggestions.
- Backend today: OpenAI, Anthropic, or Fireworks.
- Backend after RFT: swap `SYNTH_AUDIENCE_MODEL` to the trained Fireworks model.

## Why The Hypothesis Is Reasonable

The current RFT artifact trains on verifier-style synthetic audience tasks:

| Evidence | What It Supports | What It Does Not Yet Prove |
| --- | --- | --- |
| AlignX rows predict which response a profiled user prefers | Audience preference judgement | General writing quality |
| BehaviorChain rows predict a persona's next behavior | Persona-conditioned reaction prediction | Full market simulation |
| Fireworks RFT reward is binary and measurable | A before/after model comparison can be shown | That every asset critique is automatically better |

So the precise claim for the demo should be:

> Fine-tuning on audience/persona verifier tasks can improve structured synthetic-audience judgement signals, which we expose as an MCP tool for draft feedback and iteration.

Avoid overclaiming that it is universally better than GPT/Claude at writing advice. The report should show where it is more specific, preference-aware, and measurable.

## Run Locally

Install the small runtime dependency set if the workspace venv does not already have it:

```bash
cd synthetic-audience-mcp
../.venv/bin/python -m pip install -r requirements.txt
```

```bash
cd synthetic-audience-mcp
../.venv/bin/python server.py
```

For LLM-backed feedback, set one provider:

```bash
export OPENAI_API_KEY=...
export SYNTH_AUDIENCE_MODEL=gpt-4o-mini
```

or:

```bash
export ANTHROPIC_API_KEY=...
export SYNTH_AUDIENCE_MODEL=claude-3-5-haiku-latest
```

or Fireworks:

```bash
export FIREWORKS_API_KEY=...
export SYNTH_AUDIENCE_PROVIDER=fireworks
export SYNTH_AUDIENCE_MODEL=accounts/ashraymalhotra1-m6wa/models/odysim-verifier-gemma4-rft-20260621
```

## Codex MCP Config

Use `codex_mcp_config.example.json` as the copy-paste starting point.

```json
{
  "mcpServers": {
    "synthetic-audience": {
      "command": "/absolute/path/to/your/.venv/bin/python",
      "args": [
        "/absolute/path/to/synthetic-audience-mcp/server.py"
      ],
      "env": {
        "SYNTH_AUDIENCE_PROVIDER": "auto"
      }
    }
  }
}
```

The same command/args/env shape can be used by any MCP client that supports stdio servers.

## Remote MCP On Modal

The keyed deployed remote MCP endpoint is:

```text
https://ashraymalhotra1--synthetic-audience-mcp-keyed-mcp-app.modal.run/mcp
```

The safe no-key connectivity endpoint is:

```text
https://ashraymalhotra1--synthetic-audience-mcp-mcp-app.modal.run/mcp
```

Codex config shape:

```toml
[mcp_servers.synthetic-audience-remote-keyed]
enabled = true
url = "https://ashraymalhotra1--synthetic-audience-mcp-keyed-mcp-app.modal.run/mcp"
```

This remote endpoint is already tested for MCP connectivity, tool discovery, and OpenAI-backed feedback.

Provider keys are not stored in this repository. For local runs, set them in your shell environment. For Modal runs, attach them through a Modal secret.

## Backend Modes

- `backend="auto"`: uses `SYNTH_AUDIENCE_PROVIDER` if set; otherwise OpenAI, Anthropic, then Fireworks.
- `backend="tuned"`: uses Fireworks and defaults to `accounts/ashraymalhotra1-m6wa/models/odysim-verifier-gemma4-rft-20260621`.
- `backend="openai"`, `backend="anthropic"`, or `backend="fireworks"`: force one provider.

Optional model overrides:

- `SYNTH_AUDIENCE_TUNED_MODEL`: model for `backend="tuned"`.
- `SYNTH_AUDIENCE_MODEL`: general override when you intentionally pin one provider/model pair.

## Tools

- `synthetic_audience_feedback`: predict resonance and give actionable feedback.

## Demo Assets

- `demo_script.md`: short hackathon talk track.
- `samples/blog_post_resonance_demo.md`: paste-ready sample asset and audience.