home / mcp / playwright mcp server

Playwright MCP Server

Provides an MCP SSE server that streams real-time model responses over SSE using a stdio-based transport.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cameronking4-spawn-mcp": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}

You run an MCP SSE Server POC that lets you configure and stream Model Context Protocol sessions over Server-Sent Events. It provides real-time model responses through SSE, without requiring extra infrastructure, and can be deployed as a managed service or run locally for development and testing.

How to use

Create a new MCP server configuration to define how your client will connect and stream model outputs. After you save a configuration, you will receive an SSE URL that your client can connect to in order to start receiving streaming responses. Use the SSE endpoint for real-time, unidirectional MCP interactions from your model provider.

How to install

Prerequisites you need on your machine before installing and running the server:

  • Node.js 18 or later
  • PostgreSQL database

How to install

Concrete steps to get the server running locally and ready for MCP client testing.

How to install

# 1. Clone the project
git clone https://github.com/yourusername/mcp-sse-poc.git
cd mcp-sse-poc

# 2. Install dependencies
npm install

# 3. Set up local database connection
# Create a .env file with your DATABASE_URL
# Example:
DATABASE_URL=postgresql://username:password@localhost:5432/mcp_sse_db

# 4. Generate and apply migrations
npm run generate
npm run migrate

# 5. Start the development server
npm run dev

# 6. Open the app in your browser
# Navigate to http://localhost:3000

Additional deployment and configuration

You can deploy this server as a managed service. Use the provided deployment flow to connect a Git repository, set up a PostgreSQL database, and define environment variables. The following steps outline a common deployment path.

Deployment on Render

Follow these steps to deploy on a hosting platform that supports Node services and PostgreSQL databases.

Deployment on Render

1) Push Your Code to GitHub/GitLab

2) Create a Web Service on Render
   - Name: mcp-sse-poc
   - Environment: Node
   - Build Command: npm install
   - Start Command: npm start

3) Add a PostgreSQL Database
   - Create database (e.g., mcp_sse_db) on a free plan
   - Copy the DATABASE_URL connection string

4) Configure Environment Variables
   - Key: DATABASE_URL
   - Value: <your-connection-string>

Usage example configuration

Here is an MCP configuration example you can use to create a local stdio MCP server via npx. This creates a Playwright MCP client configuration that runs with the latest Playwright MCP package.

Usage example configuration

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest"]
    }
  }
}

Model Context Protocol MCP overview

The Model Context Protocol (MCP) is a lightweight, STDIO-based spec for interacting with language models via a standard input/output interface. It supports real-time streaming of model responses and is designed to be simple and extensible.

Core concepts

- STDIO Transport: Input is a JSON blob describing context messages; output is an incremental stream of tokens to stdout. Errors and events are non-blocking notifications on stderr.

Server-Sent Events (SSE) mapping

Each JSON chunk produced by the MCP session is delivered as a Server-Sent Event, providing a natural fit for unidirectional streaming models.

Available tools

configureMcpServer

Create and manage MCP server configurations via a simple UI to define how your MCP sessions are established and streamed.

generateSseEndpoint

Generate stable SSE endpoints for each MCP configuration to enable real-time streaming to clients.

streamModelResponses

Stream real-time model responses through SSE as tokens are produced by the MCP session.

deployRender

One-click deployment workflow to host the MCP SSE server on a platform like Render.