Different from Docs MCP: This server queries user data. For documentation search, see Docs MCP Setup.
Architecture
The MCP server is a thin wrapper around Query API sync endpoints:| Feature | MCP Server | Direct HTTP |
|---|---|---|
| Protocol | MCP (JSON-RPC over HTTP) | REST API |
| Credentials | Session-based (provide once) | Per-request (Bearer token) |
| Tool Discovery | Built-in (tools/list) | OpenAPI spec |
| Ship with MCP | Native support | Manual implementation |
| Best For | AI agents, IDE plugins | Server-to-server, custom apps |
Prerequisites
The Control Room account with API credentials
At least one user with granted consent
MCP Server URL
Setup by Tool
- Claude Code
- Claude Desktop
- Cursor
- VS Code
Verify Connection
After configuration, test the health endpoint:Session Credentials
The MCP server uses session-based credentials — provide them once on connection, and all tool calls use them automatically.| Credential | What it is | Format | Example |
|---|---|---|---|
auth_token | Base64-encoded JWT from The Control Room | Starts with eyJ... (long string) | eyJhbGciOiJSUzI1NiIs... |
uid | Consented user identifier from consent callback | Typically starts with psub_ | psub_c3d4e5f6789012345678901234abcdef |
auth_token and uid as tool parameters.
Security Best Practices
Never commit credentials to git repositories
Use environment variables in configuration files
Rotate API tokens regularly via The Control Room
Use unique
uid per user (don’t share across users)Available Tools
The MCP server exposes 5 tools that map 1:1 to Query API sync endpoints:| MCP Tool | Query API Endpoint | Data Type |
|---|---|---|
get_search_data | /v1/sync/get_search | Search history |
get_youtube_data | /v1/sync/get_youtube | YouTube watch history |
get_browsing_data | /v1/sync/get_browsing | Web browsing |
get_ads_data | /v1/sync/get_ads | Ad interactions |
get_receipts_data | /v1/sync/get_receipts | Purchase receipts |
Response Format
All tools return the same structure:Pagination
Use cursor-based pagination for large datasets:Error Handling
When a tool call fails, it returns:- 401 Unauthorized: Invalid or missing credentials
- 400 Bad Request: Invalid parameters (e.g., malformed timestamp)
- 500 Internal Server Error: Query API or database error
Example Queries
- Parse your natural language query
- Select the appropriate MCP tool
- Apply filters and parameters
- Return formatted results
Troubleshooting
Tool calls fail with 401 Unauthorized
Tool calls fail with 401 Unauthorized
Empty data arrays returned
Empty data arrays returned
Cause: No data available for querySolutions:
- Data export may still be processing (watch for
data.ready/data.failedwebhooks or pollGET /export/status/{uid}until providerdata_ready: true) - User may not have data for the requested type
- Check time filters (
begin/end) aren’t excluding all data - Verify
categoryfilter isn’t too restrictive
Connection timeout
Connection timeout
Cause: Cannot reach MCP serverSolutions:
- Verify MCP server URL is exactly
https://mcp.emergedata.ai/mcp - Check firewall/network settings allow HTTPS outbound
- Test health endpoint:
curl https://mcp.emergedata.ai/mcp/health - Contact support if server appears down
Tools not appearing in AI tool
Tools not appearing in AI tool
Cause: MCP connection not establishedSolutions:
- Restart your AI tool after adding configuration
- Verify config file is in the correct location
- Check file permissions (must be readable)
- Review AI tool logs for MCP connection errors
Rate Limits
The MCP server inherits rate limits from the Query API:- Requests: 100 requests per minute per auth token
- Data: 10,000 events per request (recommended: 1000)
- Concurrent: 10 simultaneous connections per organization
Source Code
The MCP server is open-source:- Repository: github.com/emerge-protocol/emgcp
- Issues: Report bugs or request features
- License: MIT
Next Steps
Tool Reference
Detailed documentation for all 5 tools
Query Guide
Learn about sync vs async queries
Examples
See AI workflow examples
Webhooks
Track consent and data export lifecycle changes