MCP Server

Connect external AI tools to your EmuView project via the Model Context Protocol.

#MCP Server

EmuView includes a built-in Model Context Protocol (MCP) server that exposes your project data to external AI tools like Claude Desktop, Cursor, and Windsurf.

#Overview

The MCP server provides read-only access to your project's collections, records, schemas, flows, and system settings. External AI tools can use this context to answer questions about your backend, generate code, and assist with debugging.

#Authentication

The MCP server uses API key authentication. You need an API key with the sk- prefix.

  1. Generate an API key in Auth → API Keys
  2. Use the key as a Bearer token in all MCP requests
Authorization: Bearer sk-your-api-key-here

#Rate Limiting

MCP endpoints are rate-limited per API key. The default limit is 100 requests/minute, configurable via the ai.mcp_rate_limit system setting.

When rate-limited, the server returns 429 Too Many Requests with a Retry-After header.

#Endpoints

#Server Info

GET /api/v1/mcp

Returns server name, version, and capabilities.

#Resources

GET /api/v1/mcp/resources
GET /api/v1/mcp/resources/:uri

Available resources:

URI Description
emuview://project/context Full project context (collections, roles, flows, auth)
emuview://collections All collections with field definitions
emuview://system/settings Non-sensitive system settings
emuview://docs/agent-rules Agent rules markdown for AI tools

#Tools

GET /api/v1/mcp/tools
POST /api/v1/mcp/tools/:name/invoke

Available tools:

Tool Description
search_records Search records in a collection with filters
list_collection_records List records with cursor pagination
aggregate_records Count records, optionally grouped by a field
introspect_schema Get field definitions for a specific collection
list_flows List all automation flows
get_flow_definition Get the full definition of a specific flow
search_docs Search the EmuView documentation
get_doc_page Fetch a full documentation page as markdown
query_message_log Search the message delivery log and its outcomes

#Reading query_message_log results

This tool answers questions like "did this person get their password reset?". One detail matters when interpreting it: sent means the provider accepted the message, not that it arrived. Only delivered confirms receipt, and on a provider without delivery webhooks configured a message stays at sent indefinitely even when it did arrive.

Message bodies are deliberately not returned — answering whether something sent does not require its contents, and those can carry reset tokens and other one-time secrets.

#Connecting External Tools

#Claude Desktop

Add to your claude_desktop_config.json:

{
	"mcpServers": {
		"sveltesync": {
			"command": "npx",
			"args": ["mcp-remote", "https://your-sveltesync-url/api/v1/mcp"],
			"env": {
				"AUTHORIZATION": "Bearer sk-your-api-key"
			}
		}
	}
}

#Cursor

Add to your .cursor/mcp.json:

{
	"mcpServers": {
		"sveltesync": {
			"url": "https://your-sveltesync-url/api/v1/mcp",
			"headers": {
				"Authorization": "Bearer sk-your-api-key"
			}
		}
	}
}

#Usage Tracking

All MCP tool invocations are logged to the mcp_usage table with:

  • Tool name
  • Estimated input/output tokens
  • Duration
  • API key used

This data is visible in the Guide Usage dashboard.