Skip to content

Comments

Auto-open mcp.json after Self-Hosted MCP Server project creation#4902

Open
Copilot wants to merge 6 commits intomainfrom
copilot/open-mcp-json-automatically
Open

Auto-open mcp.json after Self-Hosted MCP Server project creation#4902
Copilot wants to merge 6 commits intomainfrom
copilot/open-mcp-json-automatically

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Summary

This PR implements automatic opening of the mcp.json file after creating a Self-Hosted MCP Server Project, addressing the user's suggestion in the issue.

Changes Made

1. Refactored to use runPostMcpProjectCreateSteps pattern

Following the same pattern as runPostFunctionCreateSteps in FunctionCreateStepBase.ts:

  • Added runPostMcpProjectCreateSteps() function in MCPProjectCreateStep.ts to handle opening mcp.json
  • Added runPostMcpProjectCreateStepsFromCache() export for extension activation
  • Integrated cache mechanism to handle window reloads (similar to function creation)

2. Updated MCPProjectCreateStep.ts

  • Caches project information before window reload using mcpProjectCacheKey
  • Calls runPostMcpProjectCreateSteps() to open mcp.json file
  • Uses same 5-second timeout pattern as function creation

3. Updated extension.ts

  • Added import for runPostMcpProjectCreateStepsFromCache
  • Calls cache recovery function on extension activation

4. Updated NewProjectLanguageStep.ts

  • Removed MCPOpenFileStep from wizard execute steps
  • Logic now embedded in MCPProjectCreateStep

Behavior

After this change, when creating a Self-Hosted MCP Server Project:

  • ✅ The mcp.json file will automatically open after project creation
  • ✅ Handles window reload scenarios using the cache mechanism
  • ✅ Follows the same pattern as MCP tool trigger function creation

Testing

  • ✅ Code compiles successfully with npm run build
  • ✅ Follows established patterns from FunctionCreateStepBase.ts
  • ✅ CodeQL security scan passes with 0 alerts
  • ✅ Code review passed with minor cleanup

Security Summary

No security vulnerabilities introduced or discovered.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Suggestion] It would be better to open mcp.json file automatically after creating a Self-Hosted MCP Server Project</issue_title>
<issue_description>OS: Win 11
Build Version: 20251218.1

Repro Steps:

  1. Create a Self-Hosted MCP Server Project.
  2. Check whether the mcp.json file is opened automatically after project creation.

Actual:
The mcp.json file is not opened automatically after project creation.

Suggestion:
It would be better to open mcp.json file automatically after creating a Self-Hosted MCP Server Project.

More Info:
The mcp.json file is opened automatically after creating an MCP tool trigger project.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 28, 2026 19:23
…MCP Server project creation

Co-authored-by: motm32 <59709511+motm32@users.noreply.github.com>
Co-authored-by: motm32 <59709511+motm32@users.noreply.github.com>
Copilot AI changed the title [WIP] Open mcp.json file automatically after creating Self-Hosted MCP Server Project Auto-open mcp.json after Self-Hosted MCP Server project creation Jan 28, 2026
Copilot AI requested a review from motm32 January 28, 2026 19:29
@motm32 motm32 marked this pull request as ready for review January 28, 2026 19:53
@motm32 motm32 requested a review from a team as a code owner January 28, 2026 19:53
Co-authored-by: bwateratmsft <36966225+bwateratmsft@users.noreply.github.com>
@motm32
Copy link
Contributor

motm32 commented Feb 11, 2026

@copilot Could you refactor this to use the function runPostFunctionCreateSteps located in FunctionCreateStepBase file.

…stFunctionCreateSteps

Co-authored-by: motm32 <59709511+motm32@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 11, 2026

@copilot Could you refactor this to use the function runPostFunctionCreateSteps located in FunctionCreateStepBase file.

Refactored in commit 2a085b2. I've adopted the same pattern used in FunctionCreateStepBase:

  • Created runPostMcpProjectCreateSteps() function to handle file opening
  • Added runPostMcpProjectCreateStepsFromCache() export for extension activation
  • Removed the separate MCPOpenFileStep wizard step
  • Logic is now embedded in MCPProjectCreateStep with cache support for window reloads

Co-authored-by: motm32 <59709511+motm32@users.noreply.github.com>
Copy link
Contributor

@bwateratmsft bwateratmsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest just creating a wizard execute step to open the file. Then the logic of what/whether/etc. is self-contained in a step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Suggestion] It would be better to open mcp.json file automatically after creating a Self-Hosted MCP Server Project

3 participants