feat: store params in mcp payload model#9153
feat: store params in mcp payload model#9153CurryYangxx merged 5 commits intofeat/support-mcp-clientfrom
Conversation
CurryYangxx
commented
Sep 18, 2025
- add new MCP payload model
- update payload model when MCP params change
There was a problem hiding this comment.
Pull Request Overview
This PR introduces MCP (Model Context Protocol) payload persistence by creating a new model and updating the UI to store and manage MCP request parameters. The main goal is to persist MCP request parameters across sessions and maintain state between different primitive selections.
Key changes:
- Added new
McpPayloadmodel for storing MCP request parameters - Updated MCP request pane to use persistent payload state instead of local form data
- Enhanced form validation and payload management for MCP requests
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/insomnia/src/models/mcp-request-payload.ts |
New model definition for storing MCP payload data with CRUD operations |
packages/insomnia/src/models/index.ts |
Exports the new MCP payload model and adds it to the model registry |
packages/insomnia/src/common/database.ts |
Adds database configuration for the new MCP payload collection |
packages/insomnia/src/ui/components/mcp/mcp-request-pane.tsx |
Updates component to use persistent payload state and proper parameter management |
packages/insomnia/src/ui/components/rjsf/index.tsx |
Enhances form validation to return boolean and properly handle form data |
packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.$requestId.update-payload.tsx |
Adds MCP payload update support alongside existing SocketIO payload handling |
packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.$requestId.tsx |
Loads MCP payload data in the request loader |
packages/insomnia/src/ui/hooks/use-request.ts |
Updates payload patcher to support MCP payload types |
packages/insomnia/src/ui/components/.client/codemirror/code-editor.tsx |
Fixes callback reference handling using useLatest hook |
packages/insomnia/src/ui/components/base/select.tsx |
Adds missing id attribute to select options |
packages/insomnia/src/root.tsx |
Improves error message handling for route errors |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| useEffect(() => { | ||
| if (readyState) { | ||
| console.log('update mcp payload: ', { params: mcpParams, url: activeRequest.url }); |
There was a problem hiding this comment.
Remove console.log statement before production deployment as it adds unnecessary noise to the console.
| console.log('update mcp payload: ', { params: mcpParams, url: activeRequest.url }); |
908882e to
888fdb8
Compare
888fdb8 to
908882e
Compare
c7c7b51 to
ef4aa78
Compare
| import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'; | ||
| import { Button, Menu, MenuItem, MenuTrigger, Popover, Toolbar } from 'react-aria-components'; | ||
| import * as reactUse from 'react-use'; | ||
| import { useLatest } from 'react-use'; |
There was a problem hiding this comment.
Could we merge with the above import?
| const [formData, setFormData] = useState({}); | ||
| console.log('formData: ', formData); | ||
|
|
||
| const [mcpParams, setMcpParams] = useState<Record<string, any>>(requestPayload?.params || {}); |
There was a problem hiding this comment.
Do we need to update the mcp params when switching tabs?
| console.log('update mcp payload: ', { params: mcpParams, url: activeRequest.url }); | ||
| latestPayloadPatcherRef.current(requestId, { params: mcpParams, url: activeRequest.url }); | ||
| } | ||
| }, [activeRequest.url, mcpParams, latestPayloadPatcherRef, requestId, readyState]); |
There was a problem hiding this comment.
When we change the url, has the mcpParams been updated before this effect triggers? 🤔
| useImperativeHandle(ref, () => ({ | ||
| validate: () => { | ||
| formRef.current?.validateForm(); | ||
| return formRef.current?.validateForm() || false; |
There was a problem hiding this comment.
Should we return true when there's no validateForm?
* feat: store params in mcp payload model * fix: useLatest * fix: merge import statement * update * update
* feat: store params in mcp payload model * fix: useLatest * fix: merge import statement * update * update
* feat: store params in mcp payload model * fix: useLatest * fix: merge import statement * update * update
* feat: store params in mcp payload model * fix: useLatest * fix: merge import statement * update * update
* feat: store params in mcp payload model * fix: useLatest * fix: merge import statement * update * update
* feat: store params in mcp payload model * fix: useLatest * fix: merge import statement * update * update
* feat: mcp client creation-[INS-1328] (#9103) * feat: mcp client creation * fix:: type check * feat: fix icon * feat: mcp workspace card dropdown * feat: mcp client support - SDK integration & Basic request pane (#9109) * 1.initial check-in for mcp main * add initial mcp request pane * fix name * fix type issues * fix type issue * fix issue * feat: add custom mcp icon (#9112) * feat: mcp workspace icon * fix: mcp redirect route path * feat: Support server capability list (#9117) * support server capability list * fix type issue * feat: integrate rjsf (#9120) * feat: custom rjsf theme (#9125) * feat: Add basic response pane for MCP (#9131) * New List page * Add a common utility function * Add response pane ui * Support events and logs * feat: support stdio transport (#9135) * Chore: Move MCP request page into debug router path (#9140) * refactor mcp page router path * fix lint issue * feat: support stdio events, console, and UI (#9142) * feat: Enhance MCP response pane (#9144) * support notification panel * adjust code from rebase * preview issue * fix rebase issue of duplicate close * feat: support resource&prompt calling (#9148) * feat: support resource&prompt calling * fix: hide editor for resource template * change method detection logic * remove unuse code --------- Co-authored-by: Kent Wang <kent.wang@konghq.com> * fix: classNames * fix message issue * feat: add access grant modal for stdio transport (#9149) * feat: disable sync&export for mcp (#9155) * feat: store params in mcp payload model (#9153) * feat: store params in mcp payload model * fix: useLatest * fix: merge import statement * update * update * add hint for server list update (#9160) * fix: parse value (#9161) * fix: base select placeholder * feat: complete the existing auth for mcp client (#9159) * feat: Change observer pattern for mcp events and enable auto selection (#9165) * change polling method * auto activate latest event for mcp * support showing error details for mcp * Feat: add MCP tab - [INS-1354] (#9166) * feat: support mcp tab * feat: mcp tab * custom ui form mcp tab * fix: mcp tab name * support filter (#9169) * fix: resource template * feat: add roots support for mcp client (#9175) * add mcp roots pane * support filter and activate tabs automatically * basic implement of roots in main * fix: text color * feat: support mcp auth flow (#9178) * customize more template (#9177) * customize more template * fix * delete unuse props * make call tool button sticky to top * feat: hide duplicate (#9187) * fix: hide runner & hide send button & avoid multiple connect (#9186) * fix: mcp multiple tab issue (#9185) * fix multiple tab issue * clear resource subscription when mcp connection closed. * Do not allow subscription when not connected * fix: mcp issues (#9196) * add missing libs * 1.fix type issue * fix type issues * fix: UX improvement for mcp client (#9229) * fix call tool data issue * add api key auth * fix: params overview (#9233) * update size issue * update rebase issues * feat: add mcp segment events (#9240) * feat: revise the message in the MCP auth confirmation modal (#9241) * Escape tabs and new lines for CodeMirror display (#9245) * update sse main process issue * Fix: MCP workspace creation issue in Git sync (#9263) * add unique ids * fix issues (#9270) * fix: get valid mcp stdio PATH env (#9269) * fix issues from comment * fix: consistent the auth grant type naming style * 1.fix issues from comment * fix: support the encrypt auth flow for mcp auth (#9289) * code clean * fix: fix status indicator in the stdio response history (#9304) * fix: mcp disconnection (#9303) * fix from comments * update package-lock --------- Co-authored-by: Kent Wang <kent.wang@konghq.com> Co-authored-by: Bingbing <ZxBing0066@gmail.com>