papertrail/.env.example
caelum0x 9b91a4a968 feat: connect PaperTrail to Claude Science (MCP connectors, skills) + Google auth
Make PaperTrail plug into Anthropic's Claude Science workbench four ways:
- Remote URL connector: hosted Streamable-HTTP MCP at /api/mcp (45 public tools)
- Local command connector: standalone stdio MCP package under mcp/ (47 tools,
  incl. 2 API-key tools) — @modelcontextprotocol/sdk, calls the live API
- Skills: 8 Claude Science Agent Skills under skills/ (import from GitHub / upload)
- Network: docs to allow-list the API domain for the curl path
- Public /connect page showcasing all four methods (judges can see it, no login)

Also:
- Google OAuth sign-in ("Continue with Google") on login + register, wired to
  GOOGLE_CLIENT_ID/SECRET; users.password_hash now nullable + auth_provider/
  google_sub (migration 0061); password login guards Google-only accounts
- Landing design: center + enlarge the claim input; bigger textarea

tsc clean; app build compiles 362 pages; local MCP smoke-tested end-to-end.
2026-07-10 17:06:04 +03:00

80 lines
3.9 KiB
Plaintext

# Postgres (Neon) connection string, must include sslmode=require
DATABASE_URL=postgresql://user:password@host/dbname?sslmode=require
# Auth session JWT signing secret (HS256). REQUIRED in production. A dev fallback
# is used if unset, but never rely on it outside local dev. Generate with:
# openssl rand -base64 32
AUTH_SECRET=
# Google OAuth sign-in ("Continue with Google"). Optional — email+password works
# without it. Create an OAuth 2.0 client at https://console.cloud.google.com/apis/credentials
# and add BOTH redirect URIs: http://localhost:3000/api/auth/google/callback and
# https://<your-domain>/api/auth/google/callback
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# Anthropic API key (Claude) - used for extraction + verification reasoning
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MODEL=claude-sonnet-4-6
# Voyage AI embeddings key (Anthropic's recommended embeddings partner)
VOYAGE_API_KEY=pa-...
VOYAGE_MODEL=voyage-3
# NCBI E-utilities API key (optional but recommended - raises PubMed rate limit
# from 3/sec to 10/sec). Get one at https://www.ncbi.nlm.nih.gov/account/settings/
NCBI_API_KEY=
NCBI_EMAIL=you@example.com
# Rate limit for /api/verify, requests per window per IP
RATE_LIMIT_MAX=10
RATE_LIMIT_WINDOW_MS=600000
# DEMO_MODE=true makes retrieval cache-only (never live-fetches PubMed/ClinicalTrials
# on a miss). Set this for the live demo so results are deterministic and off the
# network critical path. Leave unset/false for normal use.
DEMO_MODE=false
# MOCK_MODE=true answers the locked demo claims from hand-verified fixtures with NO
# Postgres/Claude/Voyage calls (real grounding + effect-size still run). Lets the app
# run, render, and demo with zero secrets. Dev/demo-fallback only — leave false in prod.
MOCK_MODE=false
# Shared secret Vercel Cron sends as a Bearer token to /api/cron/tick (all-org job sweep).
# Set the same value in the Vercel project env. Without it, the cron endpoint fails closed.
CRON_SECRET=
# ---------------------------------------------------------------------------
# Digested OSS engines (polyglot python/ subprocess layer). ALL OPT-IN and OFF by
# default — the app runs fully without them (each feature falls back to its native
# TS+Claude path). Enable one only after installing its deps:
# python3 -m venv .venv && . .venv/bin/activate && pip install -r python/<engine>/requirements.txt
# PYTHON_BIN overrides the interpreter used for every engine (default: python3).
# ---------------------------------------------------------------------------
PYTHON_BIN=python3
DOCLING_ENABLED=false # structured PDF extraction (python/document_ai)
PAPERQA_ENABLED=false # agentic paper QA backend (FutureHouse PaperQA2)
STORM_ENABLED=false # long-form cited synthesis backend (Stanford STORM)
ASREVIEW_ENABLED=false # active-learning screening ranker (ASReview)
MINICHECK_ENABLED=false # entailment fact-check (/api/fact-check, verify path)
PYMARE_ENABLED=false # meta-analysis cross-check oracle (/api/meta-crosscheck)
OPENALEX_ENABLED=false # OpenAlex source ingestion (broadens beyond PubMed/CT.gov)
OPENALEX_EMAIL=you@example.com # polite-pool contact for the OpenAlex API (when enabled)
# ---------------------------------------------------------------------------
# Optional feature tuning + integrations (safe defaults if unset)
# ---------------------------------------------------------------------------
# Per-IP budget for the expensive multi-step /api/deep-research endpoint.
DEEP_RESEARCH_RATE_MAX=3
DEEP_RESEARCH_RATE_WINDOW_MS=600000
# Public site URL (canonical links, sitemap). e.g. https://papertrail.example.com
NEXT_PUBLIC_SITE_URL=
# Outbound timeouts (ms) for webhooks / integration test calls.
WEBHOOK_TIMEOUT_MS=10000
INTEGRATION_TIMEOUT_MS=10000
# Optional Claude Science workbench connector (leave blank to disable).
CLAUDE_SCIENCE_ENDPOINT=
CLAUDE_SCIENCE_API_KEY=
# Optional transactional email relay for notifications (leave blank to disable).
EMAIL_RELAY_URL=