Http Capture
MCP server for capturing HTTP traffic using headless Playwright browser automation
Ask AI about Http Capture
Powered by Claude Β· Grounded in docs
I know everything about Http Capture. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
SAR/TAR MCP Tooling System
A collection of Model Context Protocol (MCP) servers for SAR/TAR test automation in Cloud ERP integration testing. Run tests, capture HTTP traffic, validate TAR files, and analyze results through MCP tools.
Features
- SAR Test MCP: Run TAR tests using ScriptARest.exe, validate files, analyze results
- HTTP Capture MCP: Capture HTTP traffic using headless Playwright browser automation
- OpenAPI MCP: Parse OpenAPI specs and extract Cloud ERP service metadata
- 34 Powerful Tools: Complete test execution, validation, browser automation, API discovery, and data capture
- Result Analysis: Parse test output, identify errors, suggest fixes
- Security: Domain allowlist, header redaction, audit logging
- AI Enhancements: Custom agents for GitHub Copilot, project rules and commands for Cursor IDE
Prerequisites
- Node.js v20.0.0 or higher
- npm or pnpm package manager
- ScriptARest.exe (for SAR Test MCP - test execution)
- Access to Cloud ERP server (for test execution)
Available MCP Servers
| Server | npm Package | Bundle Size | Description |
|---|---|---|---|
| SAR Test MCP | @dilina0914/sar-test-mcp | ~87 KB | Run and validate SAR/TAR test files |
| HTTP Capture MCP | @dilina0914/http-capture-mcp | ~63 KB | Capture HTTP traffic with browser automation |
| OpenAPI MCP | @dilina0914/openapi-mcp | ~35 KB | Parse OpenAPI specs and extract metadata |
All packages are fully bundled with enterprise-grade practices:
- Tree-shaking for minimal bundle size
- Source maps for debugging
- ESM module format
- Node.js 20+ target
Integration Options
Choose the integration method that works best for your workflow:
Option 1: VS Code Integration
Integrate the MCP servers into VS Code to use tools directly in your editor.
Step 1: Install Playwright (Required for HTTP Capture MCP)
Check if Playwright is installed:
npx playwright --version
If not installed or you see an error, install it:
npm install -g playwright
npx playwright install chromium
Step 2: Create the MCP configuration folder
In your project root directory, create a .vscode folder:
mkdir .vscode
Step 3: Create the MCP configuration file
Inside the .vscode folder, create a file named mcp.json with the following content:
{
"servers": {
"sar-test": {
"command": "npx",
"args": [
"-y",
"@dilina0914/sar-test-mcp@6.0.0"
],
"env": {
"SAR_SCRIPT_A_REST_PATH": "C:\\Path\\To\\ScriptARest.exe",
"SAR_SERVER_URL": "https://your-erp-server.com",
"SAR_USERNAME": "your_username",
"SAR_PASSWORD": "your_password"
}
},
"http-capture": {
"command": "npx",
"args": [
"-y",
"@dilina0914/http-capture-mcp@6.0.0"
],
"env": {
"BROWSER_HEADLESS": "true",
"LOG_LEVEL": "info"
}
},
"openapi": {
"command": "npx",
"args": [
"-y",
"@dilina0914/openapi-mcp@6.0.0"
],
"env": {
"LOG_LEVEL": "info"
}
}
}
}
Step 4: Configure environment variables
SAR Test MCP Variables
| Variable | Description | Required |
|---|---|---|
SAR_SCRIPT_A_REST_PATH | Full path to ScriptARest.exe | Yes (for running tests) |
SAR_SERVER_URL | Cloud ERP server URL | Yes (for running tests) |
SAR_USERNAME | Authentication username | Yes (for running tests) |
SAR_PASSWORD | Authentication password | Yes (for running tests) |
SAR_TIMEOUT_MS | Timeout in milliseconds | No (default: 600000) |
HTTP Capture MCP Variables
| Variable | Description | Required | Default |
|---|---|---|---|
BROWSER_HEADLESS | Run browser in headless mode | No | true |
LOG_LEVEL | Logging level (debug, info, warn, error) | No | info |
MAX_CAPTURE_SIZE_MB | Max response body size to capture | No | 10 |
MAX_SESSIONS | Maximum concurrent browser sessions | No | 5 |
OpenAPI MCP Variables
| Variable | Description | Required | Default |
|---|---|---|---|
LOG_LEVEL | Logging level (debug, info, warn, error) | No | info |
AUDIT_LOG_ENABLED | Enable audit logging | No | true |
AUDIT_LOG_DIR | Directory for audit logs | No | ./logs/audit |
Step 5: Restart VS Code
Close and reopen VS Code to load the MCP server configuration.
Option 2: Cursor IDE Integration
Cursor IDE has built-in support for MCP servers, making integration straightforward.
Step 1: Install Playwright (Required for HTTP Capture MCP)
Check if Playwright is installed:
npx playwright --version
If not installed or you see an error, install it:
npm install -g playwright
npx playwright install chromium
Step 2: Open Cursor Settings
- Open Cursor IDE
- Go to Settings (File > Preferences > Settings or Ctrl/Cmd + ,)
- Search for "MCP" or navigate to the MCP configuration section
Step 3: Add MCP Server Configuration
In the MCP settings, add the servers with the following configuration:
{
"mcpServers": {
"sar-test": {
"command": "npx",
"args": [
"-y",
"@dilina0914/sar-test-mcp@6.0.0"
],
"env": {
"SAR_SCRIPT_A_REST_PATH": "C:\\Path\\To\\ScriptARest.exe",
"SAR_SERVER_URL": "https://your-erp-server.com",
"SAR_USERNAME": "your_username",
"SAR_PASSWORD": "your_password",
"SAR_TIMEOUT_MS": "600000"
}
},
"http-capture": {
"command": "npx",
"args": [
"-y",
"@dilina0914/http-capture-mcp@6.0.0"
],
"env": {
"BROWSER_HEADLESS": "true",
"LOG_LEVEL": "info",
"MAX_CAPTURE_SIZE_MB": "10"
}
},
"openapi": {
"command": "npx",
"args": [
"-y",
"@dilina0914/openapi-mcp@6.0.0"
],
"env": {
"LOG_LEVEL": "info"
}
}
}
}
Example: SAR Test MCP Only
{
"mcpServers": {
"sar-test": {
"command": "npx",
"args": ["-y", "@dilina0914/sar-test-mcp@6.0.0"],
"env": {
"SAR_SCRIPT_A_REST_PATH": "C:\\Users\\YourName\\Downloads\\ScriptARest\\ScriptARest.exe",
"SAR_SERVER_URL": "https://your-erp-server.example.com",
"SAR_USERNAME": "your_username",
"SAR_PASSWORD": "your_password"
}
}
}
}
Example: HTTP Capture MCP with Visible Browser (for debugging)
{
"mcpServers": {
"http-capture": {
"command": "npx",
"args": ["-y", "@dilina0914/http-capture-mcp@6.0.0"],
"env": {
"BROWSER_HEADLESS": "false",
"LOG_LEVEL": "debug"
}
}
}
}
Example: OpenAPI MCP Only
{
"mcpServers": {
"openapi": {
"command": "npx",
"args": ["-y", "@dilina0914/openapi-mcp@6.0.0"],
"env": {
"LOG_LEVEL": "info"
}
}
}
}
Step 4: Save and Restart
Save the configuration and restart Cursor IDE to activate the MCP servers.
Option 3: Claude Desktop Integration
Step 1: Install Playwright (Required for HTTP Capture MCP)
Check if Playwright is installed:
npx playwright --version
If not installed or you see an error, install it:
npm install -g playwright
npx playwright install chromium
Step 2: Add to your Claude Desktop configuration file
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"sar-test": {
"command": "npx",
"args": ["-y", "@dilina0914/sar-test-mcp@6.0.0"],
"env": {
"SAR_SCRIPT_A_REST_PATH": "C:\\Path\\To\\ScriptARest.exe",
"SAR_SERVER_URL": "https://your-erp-server.com",
"SAR_USERNAME": "your_username",
"SAR_PASSWORD": "your_password"
}
},
"http-capture": {
"command": "npx",
"args": ["-y", "@dilina0914/http-capture-mcp@6.0.0"],
"env": {
"BROWSER_HEADLESS": "true",
"LOG_LEVEL": "info"
}
},
"openapi": {
"command": "npx",
"args": ["-y", "@dilina0914/openapi-mcp@6.0.0"],
"env": {
"LOG_LEVEL": "info"
}
}
}
}
Option 4: Local Development
Run the servers directly for development or testing.
Step 1: Clone and Install
git clone https://github.com/dilinaweerasinghe/integration-testing-mcp.git
cd integration-testing-mcp
pnpm install
Step 2: Build the packages
pnpm build
Step 3: Configure Environment Variables
Windows (PowerShell):
# SAR Test MCP
$env:SAR_SCRIPT_A_REST_PATH = "C:\Path\To\ScriptARest.exe"
$env:SAR_SERVER_URL = "https://your-erp-server.com"
$env:SAR_USERNAME = "your_username"
$env:SAR_PASSWORD = "your_password"
# HTTP Capture MCP
$env:BROWSER_HEADLESS = "true"
$env:LOG_LEVEL = "info"
Windows (Command Prompt):
:: SAR Test MCP
set SAR_SCRIPT_A_REST_PATH=C:\Path\To\ScriptARest.exe
set SAR_SERVER_URL=https://your-erp-server.com
set SAR_USERNAME=your_username
set SAR_PASSWORD=your_password
:: HTTP Capture MCP
set BROWSER_HEADLESS=true
set LOG_LEVEL=info
Linux/macOS:
# SAR Test MCP
export SAR_SCRIPT_A_REST_PATH="/path/to/ScriptARest"
export SAR_SERVER_URL="https://your-erp-server.com"
export SAR_USERNAME="your_username"
export SAR_PASSWORD="your_password"
# HTTP Capture MCP
export BROWSER_HEADLESS="true"
export LOG_LEVEL="info"
Step 4: Install Playwright browsers (for HTTP Capture MCP)
npx playwright install chromium
Step 5: Run the MCP servers
# Run SAR Test MCP
node packages/mcps/tar-validator-mcp/dist/index.js
# Run HTTP Capture MCP
node packages/mcps/http-capture-mcp/dist/index.js
# Run OpenAPI MCP
node packages/mcps/openapi-mcp/dist/index.js
Or use the package scripts:
pnpm mcp:sar-test
pnpm mcp:http-capture
pnpm mcp:openapi
AI Assistant Enhancements
Enhance your AI-assisted development experience by adding custom agents, rules, and commands. These additions help AI assistants understand SAR/TAR testing context and generate more accurate test files.
GitHub Copilot Custom Agent (Visual Studio)
Add the SAR/TAR Test Automation Agent to GitHub Copilot in Visual Studio for intelligent test file generation.
Step 1: Locate or create the .github folder
In your project root directory, create a .github folder if it doesn't exist:
mkdir .github
Step 2: Copy the agent file
Copy custome_agents_rules/sar_test.agent.md to your .github folder:
cp custome_agents_rules/sar_test.agent.md .github/
Or manually create .github/sar_test.agent.md with the agent configuration from this repository.
Step 3: Enable in Visual Studio
- Open Visual Studio
- Go to Tools > Options > GitHub Copilot
- Ensure "Enable custom agents" is checked
- Restart Visual Studio
What the Agent Provides:
- Intelligent SAR/TAR test file generation
- Proper metadata structure (type, owner, mode)
- Correct variable naming (camelCase)
- Substitution pattern guidance ({$}, {%}, {#})
- Test Util and Test Case templates
- AAA (Arrange-Act-Assert) structure enforcement
Cursor IDE Project Rules
Add project-specific rules to help Cursor understand SAR/TAR testing conventions.
Step 1: Create the .cursor/rules folder
In your project root directory:
mkdir -p .cursor/rules
Step 2: Copy the rules file
Copy custome_agents_rules/sar-rules.md to your .cursor/rules folder:
cp custome_agents_rules/sar-rules.md .cursor/rules/
Step 3: Verify the configuration
The rules file should have this frontmatter:
---
name: sar-rules
description: This is a new rule
---
What the Rules Provide:
- TAR command syntax guidance (Get, Post, Patch, Delete, etc.)
- Variable naming conventions
- Metadata structure requirements
- Error handling patterns
- Best practices for test case development
Cursor IDE Project Commands
Add custom commands to quickly execute SAR/TAR tests via the MCP.
Step 1: Create the .cursor/commands folder
In your project root directory:
mkdir -p .cursor/commands
Step 2: Copy the command file
Copy commands/run-sar-test.md to your .cursor/commands folder:
cp commands/run-sar-test.md .cursor/commands/
Step 3: Use the command
In Cursor chat, type /run-sar-test to invoke the command.
What the Command Enforces:
- TAR/SAR tests must be executed via the configured MCP tool
- No manual or simulated test outputs
- Test results must include: suite name, status, failures, and metrics
- Explicit failure reporting if MCP execution fails
Complete AI Enhancement Setup
For the best experience, set up all three enhancements:
Folder Structure:
your-project/
βββ .github/
β βββ sar_test.agent.md # GitHub Copilot agent
βββ .cursor/
β βββ rules/
β β βββ sar-rules.md # Cursor project rules
β βββ commands/
β βββ run-sar-test.md # Cursor project commands
βββ ...
Quick Setup Script (PowerShell):
# Create directories
New-Item -ItemType Directory -Force -Path ".github"
New-Item -ItemType Directory -Force -Path ".cursor/rules"
New-Item -ItemType Directory -Force -Path ".cursor/commands"
# Copy files (adjust source paths as needed)
Copy-Item "custome_agents_rules/sar_test.agent.md" ".github/"
Copy-Item "custome_agents_rules/sar-rules.md" ".cursor/rules/"
Copy-Item "commands/run-sar-test.md" ".cursor/commands/"
Quick Setup Script (Bash):
# Create directories
mkdir -p .github .cursor/rules .cursor/commands
# Copy files (adjust source paths as needed)
cp custome_agents_rules/sar_test.agent.md .github/
cp custome_agents_rules/sar-rules.md .cursor/rules/
cp commands/run-sar-test.md .cursor/commands/
Quick Troubleshooting
ScriptARest Not Found
Error: ScriptARest.exe not found at: <path>
Solution:
- Verify the path in
SAR_SCRIPT_A_REST_PATHis correct - Use absolute paths, not relative paths
- On Windows, use double backslashes (
\\) or forward slashes (/)
Authentication Failed
Error: 401 Unauthorized or Connection failed: Invalid credentials
Solution:
- Verify
SAR_USERNAMEandSAR_PASSWORDare correct - Check if the user has access to the Cloud ERP server
- Verify the server URL is correct and accessible
Browser Not Found
Error: browserType.launch: Executable doesn't exist
Solution:
- Install Playwright browsers:
npx playwright install chromium - Ensure you have sufficient disk space
- On Linux, install required dependencies:
npx playwright install-deps
Environment Variable Issues
Error: Test runner not configured or variables not recognized
Solution:
- Restart your IDE after setting environment variables
- For VS Code/Cursor: Ensure variables are in the
mcp.jsonfile - Verify the JSON syntax in your configuration file (check for missing commas, quotes)
Session Not Found
Error: Session not found: <sessionId>
Solution:
- Ensure you're using the correct session ID from
openUrl - Check if the session was closed or timed out
- Use
listSessionsto see active sessions
Spec Not Found
Error: Spec not found: <specId>. Use loadSpec first.
Solution:
- Load the spec first using the
loadSpectool - Verify the specId returned from
loadSpec - Specs are stored in memory and lost when server restarts
Invalid OpenAPI Spec
Error: Failed to parse OpenAPI spec
Solution:
- Verify the file is valid JSON or YAML
- Ensure it's a valid OpenAPI 3.0 specification
- Check file path or URL accessibility
What's Included
SAR Test MCP Tools (10 total)
Test Execution
| Tool | Description |
|---|---|
configureRunner | Configure ScriptARest path and credentials |
runTest | Execute a TAR test file and get results |
analyzeResults | Analyze raw ScriptARest output |
getRunnerStatus | Check runner configuration status |
Validation
| Tool | Description |
|---|---|
validateFile | Full validation of a .mkd file |
validateContent | Validate TAR content from string input |
validateSuite | Validate all .mkd files in a directory |
checkAaaStructure | Check Arrange-Act-Assert structure |
checkCommands | Validate TAR command syntax |
getValidationRules | Get current validation rules |
HTTP Capture MCP Tools (17 total)
Session Management
| Tool | Description |
|---|---|
openUrl | Opens URL and starts capturing HTTP traffic |
closeBrowser | Closes browser session and clears data |
listSessions | Lists all active capture sessions |
clearCapturedRequests | Clears captured requests for session |
Page Interaction
| Tool | Description |
|---|---|
click | Clicks an element by selector or text |
fill | Fills an input field with text |
type | Types text with keyboard events |
selectOption | Selects option in dropdown |
check / uncheck | Toggle checkboxes/radio buttons |
pressKey | Press a keyboard key |
waitForSelector | Wait for element to appear |
waitForModal | Wait for modal/dialog to appear |
Form Handling
| Tool | Description |
|---|---|
fillForm | Fill multiple form fields at once |
getFormFields | Get all form fields in a container |
submitForm | Submit a form |
Data Capture
| Tool | Description |
|---|---|
getCapturedRequests | Get all captured HTTP requests |
getPageInfo | Get page URL, title, and visible elements |
screenshot | Take a screenshot |
evaluate | Execute JavaScript in page context |
OpenAPI MCP Tools (7 total)
Spec Management
| Tool | Description |
|---|---|
loadSpec | Load an OpenAPI spec from file path or URL |
unloadSpec | Unload a previously loaded spec from memory |
Endpoint Discovery
| Tool | Description |
|---|---|
listEndpoints | List all API endpoints with filtering options |
getOperationDetails | Get full operation details by ID or path/method |
searchOperations | Search operations by query, tag, or entity name |
Schema Extraction
| Tool | Description |
|---|---|
listSchemas | List all schemas/entities defined in the spec |
getEntitySchema | Extract detailed entity schema with data types |
Security Features
- Credential Protection: Passwords are never exposed in responses or logs
- Domain Allowlist: Configurable allowed domains for HTTP capture
- Header Redaction: Automatic removal of sensitive headers (Authorization, Cookie, etc.)
- Body Redaction: Pattern-based redaction of passwords and tokens
- Session Isolation: Fresh browser context per session
- Audit Logging: Complete audit trail of all operations
- Input Validation: File paths and parameters are validated
Project Structure
SAR-MCP/
βββ commands/ # Cursor IDE commands
β βββ run-sar-test.md # SAR test execution command
βββ config/ # Configuration files
β βββ mcp-servers.json # MCP server registration
β βββ security.json # Security settings
β βββ tar-validation-rules.json # Validation rules
βββ custome_agents_rules/ # AI assistant configurations
β βββ sar_test.agent.md # GitHub Copilot custom agent
β βββ sar-rules.md # Cursor IDE project rules
βββ docs/ # Documentation
β βββ PUBLISHING.md # npm publishing guide
βββ packages/
β βββ mcps/ # MCP servers
β β βββ http-capture-mcp/ # HTTP Capture MCP
β β βββ openapi-mcp/ # OpenAPI MCP
β β βββ tar-validator-mcp/ # SAR Test MCP
β βββ shared/ # Shared libraries
β βββ mcp-core/ # MCP base classes
β βββ security/ # Security utilities
β βββ logging/ # Logging utilities
βββ package.json
βββ pnpm-workspace.yaml
βββ tsconfig.json
Development
Building
# Build all packages
pnpm build
# Build specific package
pnpm --filter @dilina0914/sar-test-mcp build
pnpm --filter @dilina0914/http-capture-mcp build
pnpm --filter @dilina0914/openapi-mcp build
Testing
# Run all tests
pnpm test
# Run specific package tests
pnpm --filter @dilina0914/sar-test-mcp test
Linting
pnpm lint
pnpm format
License
Links
- GitHub Repository: https://github.com/dilinaweerasinghe/integration-testing-mcp
- SAR Test MCP npm: https://www.npmjs.com/package/@dilina0914/sar-test-mcp
- HTTP Capture MCP npm: https://www.npmjs.com/package/@dilina0914/http-capture-mcp
- OpenAPI MCP npm: https://www.npmjs.com/package/@dilina0914/openapi-mcp
- Issues: https://github.com/dilinaweerasinghe/integration-testing-mcp/issues
