Skip to content

Commit f1fefb8

Browse files
manojVivekcodex
andauthored
Improve MCP discovery for responsive website testing (#1551)
Describe browser viewport testing and screenshot workflows in tool and server metadata. Align package documentation and help text with the supported capabilities and capture limits. Co-authored-by: Codex <noreply@openai.com>
1 parent 27ff57e commit f1fefb8

7 files changed

Lines changed: 112 additions & 54 deletions

File tree

‎desktop-app/src/common/mcp.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,28 @@ export const MCP_PORT_ENV_VAR = 'RESPONSIVELY_MCP_PORT';
66

77
export const MCP_SERVER_NAME = 'responsively';
88

9+
// Shared by the HTTP server and stdio bridge so either connection advertises
10+
// the same capabilities during MCP initialization.
11+
export const MCP_SERVER_INFO = {
12+
name: MCP_SERVER_NAME,
13+
title: 'Responsively App — Responsive Browser Testing',
14+
description:
15+
'Browser automation for testing website responsiveness across mobile, tablet, and ' +
16+
'desktop viewports. Open a URL in multiple device previews, compare labeled screenshots, ' +
17+
'read page content, and test website interactions in Responsively App.',
18+
websiteUrl: 'https://responsively.app',
19+
};
20+
21+
export const MCP_SERVER_INSTRUCTIONS =
22+
'Use Responsively App for responsive website testing and visual comparisons across ' +
23+
'browser screen sizes. Start with get_app_state to inspect the current URL and viewports. ' +
24+
'Choose mobile, tablet, and desktop presets with list_devices and set_active_devices, ' +
25+
'open the website with navigate, then use screenshot to capture all active viewports in ' +
26+
'one call. Use read_page to find selectors for click and type_text when testing menus, ' +
27+
'links, and forms. Screenshots are labeled JPEGs of the visible viewport, not full-page ' +
28+
'captures, and are downscaled to at most 1000px wide. These are browser device previews, ' +
29+
'not physical-device tests.';
30+
931
export const MCP_BEACON_FILENAME = 'app-location.json';
1032

1133
/**

‎desktop-app/src/main/mcp/index.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {app} from 'electron';
44
import http from 'http';
55
import store from '../../store';
66
import log from '../logging';
7-
import {MCP_SERVER_NAME} from '../../common/mcp';
7+
import {MCP_SERVER_INFO, MCP_SERVER_INSTRUCTIONS} from '../../common/mcp';
88
import {writeMcpBeacon} from './beacon';
99
import {GetMainWindow, initMcpBridge} from './bridge';
1010
import {registerTools} from './tools';
@@ -30,7 +30,10 @@ const handleMcpRequest = async (
3030
) => {
3131
// Stateless mode: a fresh server + transport per request, so concurrent
3232
// agents need no session bookkeeping.
33-
const server = new McpServer({name: MCP_SERVER_NAME, version: app.getVersion()});
33+
const server = new McpServer(
34+
{...MCP_SERVER_INFO, version: app.getVersion()},
35+
{instructions: MCP_SERVER_INSTRUCTIONS}
36+
);
3437
registerTools(server, getMainWindow);
3538
const transport = new StreamableHTTPServerTransport({
3639
sessionIdGenerator: undefined,

‎desktop-app/src/main/mcp/toolDefs.ts‎

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,32 @@ import {z} from 'zod';
99
export const toolDefs = {
1010
get_app_state: {
1111
description:
12-
'Get the current state of Responsively App: the URL loaded in the device previews, ' +
13-
'the page title, preview layout, zoom factor, and the active devices with their dimensions.',
12+
'Inspect the browser viewports currently open in Responsively App before checking ' +
13+
'website responsiveness. Returns the loaded URL, page title, preview layout, zoom ' +
14+
'factor, and active devices with their viewport dimensions.',
1415
},
1516
navigate: {
1617
description:
17-
'Navigate all Responsively App device previews to a URL. Accepts http(s) and file:// ' +
18-
'URLs; bare domains get https:// prepended (localhost gets http://). Waits for the page ' +
19-
'to finish loading (up to 30s) before returning the final URL and page title.',
18+
'Open a website URL across all active browser viewports in Responsively App for ' +
19+
'responsive testing on mobile, tablet, and desktop. Accepts http(s) and file:// URLs; ' +
20+
'bare domains get https:// prepended (localhost gets http://). Waits for the page to ' +
21+
'finish loading (up to 30s) before returning the final URL and page title. Use ' +
22+
'screenshot afterward to compare layouts across screen sizes.',
2023
inputSchema: {url: z.string().min(1).describe('The URL to load in every device preview')},
2124
},
2225
list_devices: {
2326
description:
24-
'List every device available in Responsively App (phones, tablets, laptops, desktops ' +
25-
'and user-defined custom devices). Returns id, name, dimensions, type, and whether each ' +
26-
'device is currently active in the preview.',
27+
'List mobile phone, tablet, laptop, and desktop browser viewport presets for responsive ' +
28+
'website testing in Responsively App, including user-defined custom devices. Returns ' +
29+
'id, name, dimensions, type, and whether each device is active. Use these ids or exact ' +
30+
'names with set_active_devices to choose screen sizes for screenshot comparisons.',
2731
},
2832
set_active_devices: {
2933
description:
30-
'Replace the set of device previews shown in Responsively App. Accepts device ids or ' +
31-
'exact device names (use list_devices to discover them). Every preview loads the ' +
32-
'current URL.',
34+
'Configure mobile, tablet, laptop, and desktop browser viewports for responsive layout ' +
35+
'testing and screenshot comparisons in Responsively App. Replaces the active device ' +
36+
'previews using ids or exact names from list_devices; every preview loads the current ' +
37+
'URL. Then use navigate to load a website and screenshot to compare its layouts.',
3338
inputSchema: {
3439
devices: z
3540
.array(z.string())
@@ -39,9 +44,10 @@ export const toolDefs = {
3944
},
4045
read_page: {
4146
description:
42-
'Read the page rendered in a Responsively App device preview: the page text plus its ' +
43-
'interactive elements (links, buttons, form fields) with CSS selectors usable with the ' +
44-
'click and type_text tools. Defaults to the primary (first) device preview.',
47+
'Read website text and interactive elements in a Responsively App browser viewport ' +
48+
'to inspect content and test navigation or forms at different screen sizes. Returns ' +
49+
'page text plus links, buttons, and form fields with CSS selectors for click and ' +
50+
'type_text. Defaults to the primary (first) device preview.',
4551
inputSchema: {
4652
device: z
4753
.string()
@@ -51,10 +57,11 @@ export const toolDefs = {
5157
},
5258
click: {
5359
description:
54-
'Click an element in a Responsively App device preview using a real (trusted) mouse ' +
55-
'event at the element center; the element is scrolled into view first. With event ' +
56-
'mirroring enabled (the app default), the click replicates across all device previews. ' +
57-
'Use read_page to discover selectors. Returns the URL and title after the click.',
60+
'Click website links, buttons, and menus in a Responsively App browser viewport to ' +
61+
'test responsive page interactions. Uses a real (trusted) mouse event at the element ' +
62+
'center after scrolling it into view. With event mirroring enabled (the app default), ' +
63+
'the click replicates across all device previews. Use read_page to discover selectors. ' +
64+
'Returns the URL and title after the click.',
5865
inputSchema: {
5966
selector: z.string().min(1).describe('CSS selector of the element to click'),
6067
device: z
@@ -65,9 +72,10 @@ export const toolDefs = {
6572
},
6673
type_text: {
6774
description:
68-
'Type text into a form field in a Responsively App device preview using real ' +
69-
'keystrokes. Focuses the element first (or uses the currently focused element when no ' +
70-
'selector is given). Returns the field value plus URL and title after typing.',
75+
'Type into website form fields in a Responsively App browser viewport to test forms ' +
76+
'at different responsive screen sizes. Uses real keystrokes and focuses the element ' +
77+
'first (or uses the currently focused element when no selector is given). Use ' +
78+
'read_page to discover selectors. Returns the field value plus URL and title after typing.',
7179
inputSchema: {
7280
text: z.string().describe('The text to type'),
7381
selector: z
@@ -87,9 +95,13 @@ export const toolDefs = {
8795
},
8896
screenshot: {
8997
description:
90-
'Capture screenshots of Responsively App device previews rendering the current page. ' +
91-
'Returns one labeled JPEG per active device, or a single device if specified by id or ' +
92-
'name. Screenshots show the visible viewport and are downscaled to at most 1000px wide.',
98+
'Capture browser screenshots to evaluate website responsiveness across mobile, tablet, ' +
99+
'and desktop viewports in Responsively App. Use for visual responsive audits, comparing ' +
100+
'page layouts across screen sizes, and spotting clipping or awkward wrapping. Returns ' +
101+
'one labeled JPEG per active device in one call, or a single device specified by id or ' +
102+
'exact name. Captures only the visible viewport, not the full page, and downscales images ' +
103+
'to at most 1000px wide. Choose devices with list_devices and set_active_devices, then ' +
104+
'load the website with navigate before capturing.',
93105
inputSchema: {
94106
device: z
95107
.string()

‎desktop-app/src/mcp-cli/server.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
ListToolsRequestSchema,
66
McpError,
77
} from '@modelcontextprotocol/sdk/types.js';
8-
import {MCP_SERVER_NAME} from '../common/mcp';
8+
import {MCP_SERVER_INFO, MCP_SERVER_INSTRUCTIONS} from '../common/mcp';
99
import {createBackend} from './backend';
1010
import {readBeacon, resolveTargetPort} from './beacon';
1111
import {log} from './log';
@@ -17,8 +17,8 @@ export const startBridge = async () => {
1717
const backend = createBackend({port});
1818

1919
const server = new Server(
20-
{name: MCP_SERVER_NAME, version: manifest.version},
21-
{capabilities: {tools: {}}}
20+
{...MCP_SERVER_INFO, version: manifest.version},
21+
{capabilities: {tools: {}}, instructions: MCP_SERVER_INSTRUCTIONS}
2222
);
2323

2424
server.setRequestHandler(ListToolsRequestSchema, async () => {

‎responsively-mcp/README.md‎

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
# @responsively/mcp
22

3-
MCP (Model Context Protocol) server for [Responsively App](https://responsively.app) — lets AI coding agents like Claude Code and Cursor drive the app: load URLs, manage device previews, read and interact with pages, and capture per-device screenshots to visually verify responsive layouts.
3+
Browser MCP (Model Context Protocol) server for testing website responsiveness across mobile, tablet, and desktop viewports in [Responsively App](https://responsively.app). AI coding agents such as Codex, Claude Code, and Cursor can open websites, compare responsive layouts using labeled viewport screenshots, and test page interactions.
44

55
**The app is launched on demand.** Connecting an agent session does not open the app; the first tool call starts it automatically (and it stays open afterwards). If it's already running, it's reused.
66

7+
## Use cases
8+
9+
- Check a website or local development server for responsive layout issues at phone, tablet, and desktop sizes.
10+
- Capture labeled screenshots across multiple viewports to inspect clipping, overlap, navigation, and text wrapping.
11+
- Read page text and discover selectors, then click menus or type into forms to check interactions at different sizes.
12+
13+
For a responsive review, use `list_devices` to find viewport sizes, select them with `set_active_devices`, open the URL with `navigate`, and compare `screenshot` results. Use `read_page`, `click`, and `type_text` to inspect interactive states.
14+
15+
Device previews run in the app's browser, rather than on physical devices. The MCP tools select existing device presets and custom devices configured in the app. Screenshots capture the visible viewport as JPEG, downscaled to at most 1000px wide.
16+
717
## Setup
818

919
Install [Responsively App](https://responsively.app/download) and launch it once. Then:
@@ -19,34 +29,34 @@ claude mcp add responsively -- npx -y @responsively/mcp
1929
```json
2030
{
2131
"mcpServers": {
22-
"responsively": {"command": "npx", "args": ["-y", "@responsively/mcp"]}
32+
"responsively": { "command": "npx", "args": ["-y", "@responsively/mcp"] }
2333
}
2434
}
2535
```
2636

2737
## Tools
2838

29-
| Tool | Description |
30-
| --- | --- |
31-
| `get_app_state` | Current URL, page title, layout, zoom and active devices |
32-
| `navigate` | Load a URL in all device previews (waits for the page to load) |
33-
| `list_devices` | Full device catalog, including custom devices |
34-
| `set_active_devices` | Change which devices are previewed, by id or name |
35-
| `screenshot` | Capture one or all device previews as JPEG images |
36-
| `read_page` | Read a preview's page text and interactive elements with CSS selectors |
37-
| `click` | Click an element (trusted mouse event; mirrors across previews) |
38-
| `type_text` | Type into a form field with real keystrokes, optionally press Enter |
39+
| Tool | Description |
40+
| -------------------- | ----------------------------------------------------------------------------------------------------------------- |
41+
| `get_app_state` | Inspect the current URL, page title and active viewport dimensions, layout and zoom |
42+
| `navigate` | Open a website or local URL in all browser viewports (waits for the page to load) |
43+
| `list_devices` | Find phone, tablet and desktop viewport presets, including configured custom devices |
44+
| `set_active_devices` | Select browser viewports for responsive testing by device id or name |
45+
| `screenshot` | Capture labeled JPEG screenshots of one or all visible browser viewports |
46+
| `read_page` | Read a viewport's page text and interactive elements with CSS selectors |
47+
| `click` | Test links, buttons and menus with a trusted mouse click; mirrors across previews when event mirroring is enabled |
48+
| `type_text` | Test form fields with real keystrokes, optionally press Enter |
3949

4050
## How it works
4151

4252
This package is a thin bootstrap: the actual MCP bridge ships **inside the installed app** (version-locked to it). The bootstrap finds the install — via a location file the app writes on startup — and runs that bridge in-process.
4353

4454
## Environment variables
4555

46-
| Variable | Purpose |
47-
| --- | --- |
48-
| `RESPONSIVELY_APP_PATH` | Path to a custom app install (auto-detected otherwise) |
49-
| `RESPONSIVELY_MCP_PORT` | Port of the app's MCP server (default `12720`) |
56+
| Variable | Purpose |
57+
| ------------------------- | ------------------------------------------------------- |
58+
| `RESPONSIVELY_APP_PATH` | Path to a custom app install (auto-detected otherwise) |
59+
| `RESPONSIVELY_MCP_PORT` | Port of the app's MCP server (default `12720`) |
5060
| `RESPONSIVELY_MCP_BRIDGE` | Direct path to a bridge `cli.js` (development override) |
5161

5262
Note for Linux: the app ships as an AppImage, so launch it once before first use — that's how the bootstrap learns where it lives.

‎responsively-mcp/index.js‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
'use strict';
2+
"use strict";
33

44
/**
55
* @responsively/mcp — frozen bootstrap.
@@ -10,10 +10,13 @@
1010
* keep this file dumb so stale npx caches never matter.
1111
*/
1212

13-
const {resolveBridgeEntry} = require('./lib/resolve');
14-
const {runNotInstalledServer} = require('./lib/not-installed');
13+
const { resolveBridgeEntry } = require("./lib/resolve");
14+
const { runNotInstalledServer } = require("./lib/not-installed");
1515

16-
const HELP = `responsively-mcp — MCP server for Responsively App (https://responsively.app)
16+
const HELP = `responsively-mcp — Browser MCP server for responsive website testing
17+
18+
Check websites across mobile, tablet, and desktop viewports with screenshots
19+
and page interactions in Responsively App (https://responsively.app).
1720
1821
Usage:
1922
npx -y @responsively/mcp Start the stdio MCP server (used by MCP clients)
@@ -34,17 +37,19 @@ Environment variables:
3437
`;
3538

3639
const argv = process.argv.slice(2);
37-
if (argv.includes('--help') || argv.includes('-h')) {
40+
if (argv.includes("--help") || argv.includes("-h")) {
3841
process.stdout.write(HELP);
3942
process.exit(0);
4043
}
4144

4245
const entry = resolveBridgeEntry(process.env, process.platform);
4346

44-
if (argv.includes('--version') || argv.includes('-v')) {
45-
const {version} = require('./package.json');
47+
if (argv.includes("--version") || argv.includes("-v")) {
48+
const { version } = require("./package.json");
4649
process.stdout.write(`@responsively/mcp ${version}\n`);
47-
process.stdout.write(`bridge: ${entry ?? 'not found (is Responsively App installed?)'}\n`);
50+
process.stdout.write(
51+
`bridge: ${entry ?? "not found (is Responsively App installed?)"}\n`,
52+
);
4853
process.exit(0);
4954
}
5055

‎responsively-mcp/package.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
{
22
"name": "@responsively/mcp",
33
"version": "1.0.0",
4-
"description": "MCP server for Responsively App — launches the installed app on demand and lets AI agents drive it",
4+
"description": "Browser MCP server for testing website responsiveness across mobile, tablet, and desktop viewports with screenshots and page interactions in Responsively App",
55
"keywords": [
66
"mcp",
77
"model-context-protocol",
88
"responsively",
9+
"browser",
10+
"browser-automation",
911
"responsive-design",
12+
"responsive-testing",
13+
"website-testing",
14+
"viewport",
15+
"screenshots",
1016
"devtools",
1117
"ai-agents"
1218
],

0 commit comments

Comments
 (0)