hoppscotch-mcp
Enables automation of Hoppscotch team collections, including OpenAPI sync, code-based endpoint analysis, and safe mutation with dry-run and backup.
README
Hoppscotch MCP Server
MCP server for Hoppscotch Team Collection automation.
It supports:
- Hoppscotch personal and team REST collection operations through Hoppscotch internal GraphQL.
- Safe OpenAPI sync into a dedicated generated collection or folder.
- Source-code endpoint analysis and code-based sync into Hoppscotch.
- A Generated-folder workflow that avoids modifying manual Hoppscotch folders.
Safety Model
- Sync tools default to
dryRun: true. - Write mode creates a backup under
./backups/before mutating Hoppscotch. - Sync matching uses stable
METHOD + normalized pathkeys. - Existing request scripts, auth, manual headers, and manual metadata are preserved where possible.
- Sync never deletes Hoppscotch requests automatically.
- Destructive delete tools are intentionally not exposed by this MCP server. Sync workflows never delete requests automatically. Removed endpoints are handled through deprecated markers or a Deprecated folder strategy.
- Use a dedicated Generated collection such as
NMS Backend API/Generatedas the sync target. - Do not return full large exports through MCP; export tools write files and return compact metadata.
Known NMS target values:
HOPPSCOTCH_GRAPHQL_URL=https://hoppscotch.YOUR_DOMAIN/backend/graphql
Team ID=cmpcn4aya000g12lcnyif0w3w
Team name=NMS ERP
Root collection ID=cmpcn7ozh000h12lc2rtzzx2c
Root collection title=NMS Backend API
Generated collection ID=cmqi7d761003v12pbc2kdtdyj
Generated path=NMS Backend API/Generated
Installation
npm install
npm run build
npm test
Run locally:
npm start
Development mode:
npm run dev
Environment Configuration
Copy .env.example to .env and set values.
Required MCP setting:
MCP_AUTH_TOKEN=change-me
Hoppscotch settings:
HOPPSCOTCH_GRAPHQL_URL=https://hoppscotch.YOUR_DOMAIN/backend/graphql
HOPPSCOTCH_ORIGIN=https://hoppscotch.YOUR_DOMAIN
HOPPSCOTCH_COOKIE=connect.sid=...; access_token=...; refresh_token=...
HOPPSCOTCH_AUTH_UI_HOST=127.0.0.1
HOPPSCOTCH_AUTH_UI_PORT=3737
HOPPSCOTCH_AUTH_STORAGE_FILE=.hoppscotch-auth.local.json
Split cookie values are also supported and take precedence over HOPPSCOTCH_COOKIE:
HOPPSCOTCH_CONNECT_SID=...
HOPPSCOTCH_ACCESS_TOKEN=...
HOPPSCOTCH_REFRESH_TOKEN=...
Auth precedence:
- Runtime cookies updated from the Authentication Web UI.
- Local ignored auth storage file, default
.hoppscotch-auth.local.json. HOPPSCOTCH_COOKIE.- Split env values:
HOPPSCOTCH_CONNECT_SID,HOPPSCOTCH_ACCESS_TOKEN,HOPPSCOTCH_REFRESH_TOKEN.
Authentication Web UI
hoppscotch_update_auth no longer accepts raw cookie or token values in MCP tool calls. This avoids leaking credentials into MCP logs, chat history, or tool call history.
Use the local Web UI flow:
- In your MCP client, run
hoppscotch_update_authwith{ "action": "open_ui" }. - Open the returned URL, for example
http://127.0.0.1:3737/auth?token=.... - In browser DevTools on Hoppscotch, open Network, select a
/backend/graphqlrequest, and copy theCookieheader. - Paste the full Cookie header into the local UI, or paste
connect.sid,access_token, andrefresh_tokenseparately. - Click
Parse & Testto parse the cookies and run the HoppscotchmeGraphQL query without exposing cookies. - Click
Save cookiesto store normalized cookies locally.
The setup URL contains a random one-time token that expires after 10 minutes. Saving or clearing cookies invalidates the token.
Security notes:
- The auth UI binds to
127.0.0.1by default. - Binding to a public host requires
HOPPSCOTCH_AUTH_UI_ALLOW_PUBLIC_BIND=true. - Cookies are stored only in runtime memory and the ignored local storage file.
.hoppscotch-auth.local.jsonis gitignored.- MCP responses only include masked auth status, never raw cookie values.
Useful actions:
{ "action": "open_ui" }
{ "action": "status" }
{ "action": "clear" }
How To Copy Hoppscotch Cookies
Cookie header paste is the default supported authentication method.
- Open Hoppscotch in your browser and log in.
- Open DevTools → Network.
- Click any
/backend/graphqlrequest. - In Request Headers, copy the full
Cookieheader. - Open the local Auth Web UI returned by
hoppscotch_update_auth. - Paste the Cookie header into the
Paste full Cookie headertextarea. - Click
Parse & Test. - If the test succeeds, click
Save.
Supported pasted formats:
connect.sid=...; access_token=...; refresh_token=...
Cookie: connect.sid=...; access_token=...; refresh_token=...
The parser only keeps these Hoppscotch cookies:
connect.sidaccess_tokenrefresh_token
Stored cookies are normalized in this order:
connect.sid=<value>; access_token=<value>; refresh_token=<value>
Cookie values are not URL-decoded before storage. Encoded values such as %3A, %2F, and %2B are preserved exactly for outbound Cookie headers. The UI only shows masked values and local JWT metadata such as issuer, subject, issued-at, expiration, and expired status.
Hoppscotch-Like Login Feasibility
OAuth-style login through the local MCP Auth Web UI was investigated and is not implemented.
The safe default remains manual Cookie header paste because:
- Hoppscotch login and Google OAuth complete on the real Hoppscotch domain.
- Browser cookie domain rules prevent a
127.0.0.1page from receiving cookies scoped tohoppscotch.YOUR_DOMAIN. Secure,SameSite, domain scoping, and server-sideconnect.sidsession behavior are designed to prevent local pages from collecting those cookies.- The MCP server must not read browser profile cookie databases, steal cookies, or bypass browser security.
A future safe design could open the official Hoppscotch login in the browser, let the user complete Google OAuth on the real Hoppscotch domain, then return to the local Auth UI and instruct the user to copy the Cookie header manually. Browser extensions or local helpers should only be considered with explicit approval.
OpenAPI settings:
OPENAPI_URL=http://host.docker.internal:3000/api/swagger-json
OPENAPI_BASE_URL=<<baseUrl>>
OPENAPI_AUTH_TYPE=none
OPENAPI_BASIC_AUTH_USER=
OPENAPI_BASIC_AUTH_PASSWORD=
OPENAPI_BEARER_TOKEN=
OPENAPI_CUSTOM_AUTH_HEADER_NAME=
OPENAPI_CUSTOM_AUTH_HEADER_VALUE=
Supported OPENAPI_AUTH_TYPE values:
nonebasicbearercustom
Docker Notes
localhost inside Docker points to the MCP container, not your host machine.
If the backend runs on the host, use:
OPENAPI_URL=http://host.docker.internal:3000/api/swagger-json
On Linux, add this to Docker Compose:
extra_hosts:
- "host.docker.internal:host-gateway"
If the backend is another service in the same Docker Compose network, use the service name:
OPENAPI_URL=http://backend:3000/api/swagger-json
Start with Docker:
docker compose up --build -d
Health check:
curl http://localhost:3000/health
Claude Desktop / Claude Code MCP Setup
Example MCP config:
{
"mcpServers": {
"hoppscotch": {
"command": "node",
"args": ["/absolute/path/to/dist/index.js"],
"env": {
"MCP_AUTH_TOKEN": "change-me",
"HOPPSCOTCH_GRAPHQL_URL": "https://hoppscotch.YOUR_DOMAIN/backend/graphql",
"HOPPSCOTCH_COOKIE": "connect.sid=...; access_token=...; refresh_token=...",
"OPENAPI_URL": "http://host.docker.internal:3000/api/swagger-json",
"OPENAPI_BASE_URL": "<<baseUrl>>"
}
}
}
}
Runtime Hoppscotch Auth Update
Credentials are stored in memory only. Restarting the process resets them to env values.
curl http://localhost:3000/admin/hoppscotch-auth \
-X POST \
-H "Authorization: Bearer $MCP_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"connectSid": "...",
"accessToken": "...",
"refreshToken": "..."
}'
The same update is available as hoppscotch_update_auth.
MCP Tools
Team collection tools:
hoppscotch_list_teamshoppscotch_list_team_collectionshoppscotch_get_team_collectionhoppscotch_export_team_collection_jsonhoppscotch_export_team_collectionhoppscotch_inspect_team_collection_treehoppscotch_find_or_create_generated_folderhoppscotch_export_team_collections_jsonhoppscotch_list_team_requestshoppscotch_get_team_requesthoppscotch_search_team_requestshoppscotch_create_team_requesthoppscotch_update_team_requesthoppscotch_move_team_request
OpenAPI sync tool:
hoppscotch_sync_openapi_to_team_collection
Code-based endpoint tools:
hoppscotch_analyze_backend_codehoppscotch_export_code_endpoint_candidateshoppscotch_plan_code_sync_to_team_collectionhoppscotch_sync_code_to_team_collectionhoppscotch_create_or_update_request
Personal tools:
hoppscotch_mehoppscotch_list_user_collectionshoppscotch_get_user_collectionhoppscotch_export_user_collection_jsonhoppscotch_list_user_requestshoppscotch_get_user_requesthoppscotch_create_user_requesthoppscotch_update_user_requesthoppscotch_move_user_request
Usage Examples
List teams:
{}
Use with hoppscotch_list_teams.
Inspect collection tree:
{
"collectionID": "cmpcn7ozh000h12lc2rtzzx2c",
"teamID": "cmpcn4aya000g12lcnyif0w3w"
}
Use with hoppscotch_inspect_team_collection_tree.
Export or backup a collection:
{
"collectionID": "cmqi7d761003v12pbc2kdtdyj",
"teamID": "cmpcn4aya000g12lcnyif0w3w"
}
Use with hoppscotch_export_team_collection.
OpenAPI dry-run sync:
{
"teamID": "cmpcn4aya000g12lcnyif0w3w",
"rootCollectionID": "cmpcn7ozh000h12lc2rtzzx2c",
"targetCollectionID": "cmqi7d761003v12pbc2kdtdyj",
"dryRun": true
}
OpenAPI write sync:
{
"teamID": "cmpcn4aya000g12lcnyif0w3w",
"rootCollectionID": "cmpcn7ozh000h12lc2rtzzx2c",
"targetCollectionID": "cmqi7d761003v12pbc2kdtdyj",
"dryRun": false,
"deprecatedStrategy": "mark"
}
Code analysis:
{
"projectPath": "/absolute/path/to/backend",
"framework": "auto",
"maxFiles": 500
}
Use with hoppscotch_analyze_backend_code. Full JSON is saved under ./analysis/ and the MCP response returns only a compact summary.
Code sync dry-run:
{
"analysisFile": "./analysis/backend-1710000000000.analysis.json",
"teamID": "cmpcn4aya000g12lcnyif0w3w",
"rootCollectionID": "cmpcn7ozh000h12lc2rtzzx2c",
"targetCollectionID": "cmqi7d761003v12pbc2kdtdyj",
"baseUrl": "<<baseUrl>>",
"dryRun": true
}
Code sync write mode:
{
"analysisFile": "./analysis/backend-1710000000000.analysis.json",
"teamID": "cmpcn4aya000g12lcnyif0w3w",
"rootCollectionID": "cmpcn7ozh000h12lc2rtzzx2c",
"targetCollectionID": "cmqi7d761003v12pbc2kdtdyj",
"baseUrl": "<<baseUrl>>",
"dryRun": false,
"includeLowConfidence": false,
"deprecatedStrategy": "ignore"
}
Single request create/update dry-run:
{
"teamID": "cmpcn4aya000g12lcnyif0w3w",
"targetCollectionID": "cmqi7d761003v12pbc2kdtdyj",
"method": "GET",
"path": "/api/users/{id}",
"title": "Get user",
"folderName": "Users",
"baseUrl": "<<baseUrl>>",
"pathParams": [{ "key": "id" }],
"queryParams": [{ "key": "include" }],
"dryRun": true
}
Code Analysis Coverage
NestJS support uses the TypeScript compiler API and detects:
@Controller()@Get(),@Post(),@Put(),@Patch(),@Delete()@Param(),@Query(),@Body(),@Headers()@UseGuards(),@ApiTags(),@ApiOperation(),@ApiBearerAuth()- DTO class names used in
@Body()parameters - source file and line number
Express and Laravel support is heuristic and lower confidence:
- Express:
router.get/post/put/patch/deleteandapp.get/post/put/patch/delete - Laravel:
Route::get/post/put/patch/delete
Mounted routers, Laravel apiResource/resource, FormRequest analysis, and complex dynamic route construction are TODOs.
Security Warnings
- Do not commit cookies or tokens.
- Store secrets in
.envor MCP client environment variables. - Rotate cookies if exposed.
- Prefer a dedicated team workspace.
- Use the Generated collection as the sync target.
- Always run dry-run before write mode.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。