[AIA] Migrate Claude code to use SSE by default and make it configurable in Registry

(cherry picked from commit 693760577b49848554c20fdac98c88a79875ba2e)

GitOrigin-RevId: 65c969bf59c56fa19a82398d8f8e5e172df82e6a
This commit is contained in:
Artem.Bukhonov
2025-07-22 19:58:53 +02:00
committed by intellij-monorepo-bot
parent aef15e7390
commit 051b3f3766
3 changed files with 7 additions and 3 deletions

View File

@@ -155,7 +155,7 @@ class McpServerSettingsConfigurable : SearchableConfigurable {
indent {
row {
button(McpServerBundle.message("copy.mcp.server.sse.configuration"), {
val json = createSseServerJsonEntry(McpServerService.getInstance().port)
val json = createSseServerJsonEntry(McpServerService.getInstance().port, null)
CopyPasteManager.getInstance().setContents(TextTransferable(McpClient.json.encodeToString(json) as CharSequence))
showCopiedBallon(it)
})

View File

@@ -87,10 +87,13 @@ fun createStdioServerJsonEntry(cmd: GeneralCommandLine): JsonObject {
* }
* ```
*/
fun createSseServerJsonEntry(port: Int): JsonObject {
fun createSseServerJsonEntry(port: Int, projectBasePath: String?): JsonObject {
return buildJsonObject {
put("type", "sse")
put("url", "http://localhost:$port/sse")
put("headers", buildJsonObject {
put(IJ_MCP_SERVER_PROJECT_PATH, projectBasePath)
})
}
}

View File

@@ -56,8 +56,9 @@ class McpJsonGenerationTest {
@Test
fun test_createSseServerJsonEntry() {
val port = 8080
val projectPath = "/test/project/path"
val jsonConfig = createSseServerJsonEntry(port)
val jsonConfig = createSseServerJsonEntry(port, projectBasePath = projectPath)
// Verify the JSON structure
Assertions.assertEquals("sse", jsonConfig["type"]?.jsonPrimitive?.content)