surge-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@surge-mcp-server Enable MITM in Surge"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Surge MCP Server
A Model Context Protocol (MCP) server for controlling Surge proxy via its HTTP API.
Features
This MCP server provides comprehensive control over Surge proxy through the following tool categories:
Features Toggle
Get and toggle MITM, Capture, Rewrite, and Scripting features
Outbound Mode
Get and set outbound mode (direct, proxy, rule)
Proxy Policies
List all available policies
Get policy group details
Test policies with specific URLs
Set selected policy for policy groups
Request Management
List recent and active requests
Kill specific active requests
Profile Management
Get current profile information
Reload profile
DNS
Flush DNS cache
Modules
List all available modules
Enable/disable specific modules
Scripting
List all scripts
Evaluate scripts with mock environment
Device Management (Mac Only, Surge 4.0.6+)
List all active and saved devices
Modify device properties (name, IP address, Surge handling)
Related MCP server: nginx-proxy-manager-mcp
Prerequisites
Surge installed and running
HTTP API enabled in Surge configuration
Node.js 18+ installed
Surge Configuration
Add the following to your Surge configuration file:
[General]
http-api = YOUR_API_KEY@127.0.0.1:6171Replace YOUR_API_KEY with a secure API key of your choice.
For TLS support (optional):
http-api-tls = true
http-api-web-dashboard = trueInstallation
Clone this repository:
git clone https://github.com/DLYZZT/surge-mcp-server.git
cd surge_mcpInstall dependencies:
npm installBuild the project:
npm run buildConfiguration
Set the following environment variables:
export SURGE_HOST=127.0.0.1 # Default: 127.0.0.1
export SURGE_PORT=6171 # Default: 6171
export SURGE_API_KEY=YOUR_API_KEY # Required: Your Surge API keyUsage with Claude Desktop
Add the following to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Option 1: Using npx (Recommended)
{
"mcpServers": {
"surge": {
"command": "npx",
"args": ["-y", "surge-mcp-server"],
"env": {
"SURGE_HOST": "127.0.0.1",
"SURGE_PORT": "6171",
"SURGE_API_KEY": "YOUR_API_KEY"
}
}
}
}Option 2: Using local installation
{
"mcpServers": {
"surge": {
"command": "node",
"args": ["/path/to/surge_mcp/dist/index.js"],
"env": {
"SURGE_HOST": "127.0.0.1",
"SURGE_PORT": "6171",
"SURGE_API_KEY": "YOUR_API_KEY"
}
}
}
}Replace /path/to/surge_mcp with the actual path to this project and YOUR_API_KEY with your Surge API key.
Available Tools
Feature Management
surge_get_feature_status- Check status of featuressurge_toggle_feature- Enable/disable features
Outbound Mode
surge_get_outbound_mode- Get current modesurge_set_outbound_mode- Set mode (direct/proxy/rule)
Policy Management
surge_list_policies- List all policiessurge_get_policy_group- Get policy group detailssurge_test_policy- Test policies with URLsurge_set_policy_group- Set policy for group
Request Management
surge_list_requests- List recent/active requestssurge_kill_request- Kill active request
Profile Management
surge_get_profile- Get current profilesurge_reload_profile- Reload profile
DNS
surge_flush_dns- Flush DNS cache
Module Management
surge_list_modules- List all modulessurge_toggle_module- Enable/disable module
Script Management
surge_list_scripts- List all scriptssurge_evaluate_script- Evaluate script with mock environment
Device Management (Mac Only, Surge 4.0.6+)
surge_list_devices- List all active and saved devicessurge_modify_device- Modify device properties
Example Usage in Claude
Once configured, you can ask Claude to control Surge:
"What's the current outbound mode in Surge?"
"Enable MITM in Surge"
"List all proxy policies"
"Set the proxy group 'Proxy' to use 'US Server'"
"Show me recent requests"
"Flush DNS cache"
"Reload Surge profile"
"List all devices in Surge" (Mac only)
"Rename the device with MAC address XX:XX:XX:XX:XX:XX to 'My iPhone'" (Mac only)
Development
Run in development mode with auto-rebuild:
npm run devTroubleshooting
Connection Issues
Ensure Surge is running
Verify HTTP API is enabled in Surge configuration
Check that the API key matches
Confirm the port number is correct
Authentication Errors
Double-check your API key is set correctly
Ensure the API key in Surge config matches the environment variable
Security Notes
Keep your API key secure and never commit it to version control
The API key grants full control over Surge
Consider using
http-api-tls = truefor encrypted communicationRestrict the API to localhost (
127.0.0.1) unless remote access is needed
Reference
Based on the official Surge HTTP API documentation: https://manual.nssurge.com/others/http-api.html
Available Tools
19 toolssurge_evaluate_scriptC
Evaluate a script with mock environment
Inputs: type (required), script_name (required), timeout.
surge_flush_dnsC
Flush DNS cache
Inputs: no named parameters.
surge_get_feature_statusA
Get the status of a Surge feature (MITM, Capture, Rewrite, or Scripting)
Inputs: feature (required).
surge_get_outbound_modeB
Get the current outbound mode
Inputs: no named parameters.
surge_get_policy_groupB
Get details about a specific policy group
Inputs: group_name (required).
surge_get_profileA
Get current profile information
Inputs: no named parameters.
surge_kill_requestB
Kill an active request by ID
Inputs: request_id (required).
surge_list_devicesA
List all active and saved devices (Mac only, requires Surge 4.0.6+)
Inputs: no named parameters.
surge_list_modulesB
List all available modules
Inputs: no named parameters.
surge_list_policiesA
List all available proxy policies
Inputs: no named parameters.
surge_list_requestsC
List recent or active requests
Inputs: type.
surge_list_scriptsC
List all scripts
Inputs: no named parameters.
surge_modify_deviceA
Modify device properties including name, IP address, and whether it should be handled by Surge (Mac only, requires Surge 4.0.6+)
Inputs: physical_address (required), name, address, should_handled_by_surge.
surge_reload_profileC
Reload the current profile
Inputs: no named parameters.
surge_set_outbound_modeB
Set the outbound mode (direct, proxy, or rule)
Inputs: mode (required).
surge_set_policy_groupC
Set the selected policy for a policy group
Inputs: policy (required), group_name (required).
surge_test_policyC
Test policies with a specific URL
Inputs: url (required).
surge_toggle_featureC
Enable or disable a Surge feature (MITM, Capture, Rewrite, or Scripting)
Inputs: enabled (required), feature (required).
surge_toggle_moduleC
Enable or disable a module
Inputs: enabled (required), module_name (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Every tool has a clearly distinct purpose, with paired get/set or list/toggle operations for different features, policies, requests, modules, scripts, and devices. No overlapping functionality.
All tools follow a consistent 'surge_verb_noun' pattern using snake_case. Verbs like get, set, list, toggle, kill, reload, flush, evaluate, and modify are used predictably.
19 tools cover the essential operations of the Surge proxy client without being excessive. Each tool addresses a specific aspect of the domain, making the scope well-balanced.
The set covers core CRUD-like operations for features, modes, policies, requests, profiles, DNS, modules, scripts, and devices. Minor gaps like profile import/export or policy group creation exist but are not critical for common usage.
Maintenance
Related MCP Connectors
Manage Superlist tasks and lists in plain language from any MCP-compatible AI agent.
Manage scheduled requests, uptime monitors and heartbeats from your AI assistant.
Supervised API-write gateway for AI agents with policy, human approval and execution receipts.
Search 16,000+ API operations and 95 built tools by need, then call any of them by name
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceEnables interaction with an OpenRemote instance through its service API, allowing management of assets, users, and other resources via natural language.AGPL 3.0- AlicenseBqualityCmaintenanceEnables AI agents to manage Nginx Proxy Manager (reverse proxies, streams, redirects, and Let's Encrypt certificates) through natural language commands.3020 npmMIT
- AlicenseBqualityDmaintenanceEnables interaction with Super Productivity's local REST API to manage tasks, projects, and time tracking through natural language.15264 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to control a local Clash Verge Rev / mihomo core on Windows over its named-pipe controller, discovering the live pipe automatically so it works in both sidecar and service mode. Supports inspecting status, switching proxy nodes, latency testing, changing modes, viewing connections and rules, and updating providers.MIT