feat(studio): integrate project MCP setup and lifecycle
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
Test / Build skipped: 15, passed: 926
Intrepid/Prometeu/Studio/pipeline/head This commit looks good

This commit is contained in:
2026-09-29 19:24:28 +01:00
parent 97cf5e1919
commit d0737df0ac
48 changed files with 2048 additions and 225 deletions
@@ -18,6 +18,7 @@ import java.util.concurrent.*;
import static org.junit.jupiter.api.Assertions.*;
class AutomationLspQueriesTest {
String httpAuthorization;
@TempDir Path temporary;
final ObjectMapper mapper = new ObjectMapper();
final ExecutorService workers = Executors.newCachedThreadPool();
@@ -134,6 +135,8 @@ class AutomationLspQueriesTest {
try (var server = new p.studio.app.mcp.LocalMcpServer(mapper, tools);
var client = java.net.http.HttpClient.newHttpClient()) {
server.start();
var credential = server.credentials().prepare(root.toRealPath());
credential.activate(); httpAuthorization = "Bearer " + credential.secret();
var initialize = mapper.createObjectNode().put("jsonrpc", "2.0").put("id", 1).put("method", "initialize");
var setup = initialize.putObject("params").put("protocolVersion", "2025-06-18");
setup.putObject("capabilities"); setup.putObject("clientInfo").put("name", "language-test").put("version", "1");
@@ -155,7 +158,7 @@ class AutomationLspQueriesTest {
private java.net.http.HttpResponse<String> post(java.net.http.HttpClient client, p.studio.app.mcp.LocalMcpServer server,
String connection, JsonNode body) throws Exception {
var request = java.net.http.HttpRequest.newBuilder(server.connection().endpoint()).timeout(java.time.Duration.ofSeconds(15))
.header("Authorization", server.connection().authorizationHeader()).header("Content-Type", "application/json")
.header("Authorization", httpAuthorization).header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream").header("MCP-Protocol-Version", "2025-06-18");
if (connection != null) request.header("Mcp-Session-Id", connection);
return client.send(request.POST(java.net.http.HttpRequest.BodyPublishers.ofString(body.toString())).build(), java.net.http.HttpResponse.BodyHandlers.ofString());