Skip to main content
These examples show how AI tools can help you integrate with Emerge more efficiently using the MCP connection.

Example 1: Generate integration code

You ask:
“Generate TypeScript and Python code to create a signed Emerge link and handle the callback”
AI response (with MCP connection): The AI searches the docs, finds the Create Links and Callbacks pages, and generates code that keeps uid server-side (never user input):

Example 2: Understand data availability

You ask:
“What data can I get from Emerge and how soon after consent?”
AI response: The AI finds the Query Overview and Webhooks pages:
  • Data is available after export completes. Poll GET /export/status/{uid} and wait until the required provider in sources[] is data_ready: true.
  • Until a provider is ready, sync queries may return empty results. Handle this gracefully and retry with backoff.

Example 3: Debug a webhook signature issue

You ask:
“My webhook signature verification is failing. What am I doing wrong?”
AI response: The AI checks Webhooks and points out the most common issues:
  1. Raw body required - sign the raw request body, not parsed JSON.
  2. Header name - use the x-signature header.
  3. Comparison - use constant-time comparison to avoid subtle mismatches.

Example 4: Plan a nightly sync

You ask:
“I want to sync Emerge data to my database nightly. What’s the best approach?”
AI response: The AI finds Pagination and Query Overview: Recommended approach:
  • Use delta queries with ingested_begin to fetch new data since the last run.
  • Page with cursor until has_more is false.
  • Store applied_ingested_end as your next ingested_begin.

Example 5: Choose sync vs async for mobile

You ask:
“Should I use sync or async queries for my mobile app?”
AI response: For mobile apps, sync queries are recommended because they return JSON immediately and are simpler to integrate. Your mobile app should call your backend, not the Query API directly.

Example 6: Query user data via MCP

These examples show using the Query API MCP server to directly query consented user data from AI tools. This is different from the documentation MCP - it provides real data access.
Setup required: These examples require the Query API MCP server with valid credentials (auth_token and uid).
Using Claude Code with Query API MCP configured:
What happens:
  1. Claude calls get_search_data tool with date range filter
  2. Receives search history data grouped by category
  3. Analyzes query frequency and patterns
  4. Returns insights with specific examples
Example response:
Using Cursor AI chat with Query API MCP configured:
What happens:
  1. AI calls get_youtube_data and get_browsing_data tools
  2. Identifies themes and recurring interests
  3. Cross-references patterns across data sources
  4. Generates topic suggestions with rationale
Example response:
Using Claude Desktop with Query API MCP:
What happens:
  1. AI calls multiple MCP tools in parallel (get_search_data, get_youtube_data, get_browsing_data)
  2. Aggregates and analyzes data across sources
  3. Identifies patterns and trends
  4. Formats results as structured summary
Example response:
Using Claude Code to generate sync script:
What happens:
  1. Claude accesses Query API MCP tool documentation
  2. Generates script using get_search_data with delta query parameters
  3. Implements pagination with cursor and has_more handling
  4. Uses ingested_begin for incremental updates
Claude will generate a complete script that:
  • Loads last sync timestamp from state file
  • Calls MCP tool with ingested_begin parameter
  • Pages through all results
  • Saves applied_ingested_end for next sync

Try it yourself

For documentation help (Docs MCP):

  • “How do I implement retry logic for Emerge API calls?”
  • “What happens if a user revokes consent?”
  • “Generate a React component that shows a Connect Data button”
  • “Show the correct way to handle uid without asking the user”
See MCP Docs Setup to connect your AI tool.

For querying user data (Query API MCP):

  • “Show me search patterns for the last week”
  • “What categories is this user most interested in?”
  • “Compare browsing and YouTube activity to find common interests”
  • “Generate a weekly activity report”
See Query API MCP Setup to connect with credentials.