Skip to Content
MCPMCP — Model Context Protocol

MCP — Model Context Protocol

MCP (Model Context Protocol) is an open protocol that lets AI models use external tools through a standardized interface. Instead of an AI model being limited to generating text, MCP lets it call functions — read files, click buttons in a browser, run queries — via a consistent request/response contract.

In the Leadmetrics context, MCP is used in two ways:

  1. Development tooling — Claude Code’s Playwright MCP server is used to automate browser interactions during development, QA, and E2E testing.
  2. Platform integration (planned) — Leadmetrics can expose its own MCP server so external AI systems (like a client’s Claude-based assistant) can query campaign status, trigger content generation, or read insights by calling structured tools.

Playwright MCP (Development Use)

The Claude Code desktop app ships with a built-in MCP Playwright server. It lets Claude control a browser directly — navigate, click, fill forms, take screenshots, and read the DOM — without needing a Selenium wrapper or separate test runner.

How to use it

The Playwright MCP tools are available when using Claude Code with the MCP Playwright integration enabled. Tools include:

ToolWhat it does
browser_navigateNavigate to a URL
browser_snapshotCapture the current page’s accessible element tree
browser_take_screenshotTake a screenshot
browser_clickClick an element by ref
browser_fill_formFill a form with field values
browser_typeType text into a focused element
browser_evaluateRun arbitrary JavaScript in the page context
browser_wait_forWait for a selector, URL, or time
browser_network_requestsInspect outgoing network requests

Windows-specific guidance

On Windows, always use http://127.0.0.1:PORT rather than http://localhost:PORT. The browser sends Origin: http://127.0.0.1:3000 which differs from localhost — the Leadmetrics API CORS config accepts both.

Best practices

  • Take a fresh browser_snapshot after every navigation — element refs go stale across page loads.
  • Use browser_evaluate with document.querySelectorAll + text matching for robust element targeting rather than relying on snapshot refs.
  • For React-controlled inputs, use the nativeInputValueSetter pattern via browser_evaluate — direct .value = assignment bypasses React’s synthetic events.
  • Keep open tabs to ≤ 2 to reduce crash risk.
  • Avoid window.scrollTo via browser_evaluate — it can crash the browser session. Navigate directly to the target URL instead.

See Known Issues for a full list of Windows-specific bugs and workarounds.


Leadmetrics MCP Server (Planned)

A future apps/servers/mcp service will expose Leadmetrics capabilities as MCP tools, allowing external AI assistants to interact with the platform programmatically.

Proposed tools:

ToolDescription
get_tenant_overviewReturns campaign summary, deliverable counts, pending approvals
list_activitiesLists activities with status filter
get_activityReturns full detail for one activity
approve_contentApproves a content activity (requires auth)
generate_blogTriggers the blog writer agent for a given content brief
get_insightsReturns latest channel insights for a tenant
search_knowledge_baseSearches the tenant’s RAG knowledge base

Authentication will use the same JWT system as the existing API. Each MCP client authenticates with a tenant-scoped API key.


  • Known MCP Issues — Windows Playwright MCP bugs and workarounds
  • Agent Chat — The in-app AI chat that uses a similar tool-calling pattern
  • Adapters — How Leadmetrics agents call external LLM runtimes

© 2026 Leadmetrics — Internal use only