@mcpc-tech/unplugin-dev-inspector-mcp 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -9
- package/dist/index.js +10 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -87108,11 +87108,11 @@ async function handleSseConnection(req, res, serverContext, connectionManager) {
|
|
|
87108
87108
|
const url$1 = new URL(req.url ?? "", `http://${host}:${port}`);
|
|
87109
87109
|
const transport = new __modelcontextprotocol_sdk_server_sse_js.SSEServerTransport("/__mcp__/messages", res);
|
|
87110
87110
|
const sessionId = transport.sessionId;
|
|
87111
|
-
const clientId = url$1.searchParams.get("clientId");
|
|
87112
|
-
const puppetId = url$1.searchParams.get("puppetId");
|
|
87111
|
+
const clientId = url$1.searchParams.get("clientId") || "agent";
|
|
87112
|
+
const puppetId = url$1.searchParams.get("puppetId") || "inspector";
|
|
87113
87113
|
connectionManager.registerTransport(sessionId, transport);
|
|
87114
87114
|
if (clientId === "inspector") connectionManager.handleInspectorConnection(sessionId);
|
|
87115
|
-
|
|
87115
|
+
else connectionManager.handleWatcherConnection(sessionId, clientId, puppetId, transport);
|
|
87116
87116
|
await mcpServer.connect(transport);
|
|
87117
87117
|
} catch (error$1) {
|
|
87118
87118
|
console.error("Error establishing SSE connection:", error$1);
|
|
@@ -88190,8 +88190,9 @@ function getConfigPath(id, root$2) {
|
|
|
88190
88190
|
if (editor.path.startsWith("/")) return (0, path.join)(editor.path, editor.file);
|
|
88191
88191
|
return (0, path.join)(findUpDir(editor.path, root$2) || (0, path.join)(root$2, editor.path), editor.file);
|
|
88192
88192
|
}
|
|
88193
|
-
async function writeConfig(configPath, serverName,
|
|
88193
|
+
async function writeConfig(configPath, serverName, baseUrl, clientId, urlKey, format$1, additionalServers) {
|
|
88194
88194
|
await (0, fs_promises.mkdir)(configPath.substring(0, configPath.lastIndexOf("/")), { recursive: true });
|
|
88195
|
+
const sseUrl = `${baseUrl}?clientId=${clientId}&puppetId=inspector`;
|
|
88195
88196
|
const config = (0, fs.existsSync)(configPath) ? JSON.parse(await (0, fs_promises.readFile)(configPath, "utf-8").catch(() => "{}")) : {};
|
|
88196
88197
|
const key$1 = format$1 === "servers" ? "servers" : "mcpServers";
|
|
88197
88198
|
config[key$1] ||= {};
|
|
@@ -88225,7 +88226,7 @@ async function updateMcpConfigs(root$2, sseUrl, options, logger) {
|
|
|
88225
88226
|
const editor = EDITORS[id];
|
|
88226
88227
|
const configPath = getConfigPath(id, root$2);
|
|
88227
88228
|
try {
|
|
88228
|
-
if (await writeConfig(configPath, updateConfigServerName, sseUrl, editor.urlKey, editor.format, updateConfigAdditionalServers)) {
|
|
88229
|
+
if (await writeConfig(configPath, updateConfigServerName, sseUrl, id, editor.urlKey, editor.format, updateConfigAdditionalServers)) {
|
|
88229
88230
|
updates.push({
|
|
88230
88231
|
name: editor.name,
|
|
88231
88232
|
path: configPath
|
|
@@ -88239,7 +88240,7 @@ async function updateMcpConfigs(root$2, sseUrl, options, logger) {
|
|
|
88239
88240
|
for (const custom of customEditors) {
|
|
88240
88241
|
const configPath = (0, path.join)(resolvePath(custom.configPath, root$2), custom.configFileName);
|
|
88241
88242
|
try {
|
|
88242
|
-
if (await writeConfig(configPath, updateConfigServerName, sseUrl, custom.serverUrlKey || "url", custom.configFormat || "mcpServers", updateConfigAdditionalServers)) {
|
|
88243
|
+
if (await writeConfig(configPath, updateConfigServerName, sseUrl, custom.id, custom.serverUrlKey || "url", custom.configFormat || "mcpServers", updateConfigAdditionalServers)) {
|
|
88243
88244
|
updates.push({
|
|
88244
88245
|
name: custom.name,
|
|
88245
88246
|
path: configPath
|
|
@@ -88372,8 +88373,8 @@ if (import.meta.env.DEV) {
|
|
|
88372
88373
|
host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
|
|
88373
88374
|
port: options.port ?? server.config.server.port ?? 5173
|
|
88374
88375
|
};
|
|
88375
|
-
const
|
|
88376
|
-
console.log(`[dev-inspector] 📡 MCP: ${
|
|
88376
|
+
const baseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse`;
|
|
88377
|
+
console.log(`[dev-inspector] 📡 MCP: ${baseUrl}\n`);
|
|
88377
88378
|
await setupMcpMiddleware(server.middlewares, serverContext);
|
|
88378
88379
|
setupAcpMiddleware(server.middlewares, serverContext, {
|
|
88379
88380
|
acpMode: options.acpMode,
|
|
@@ -88381,7 +88382,7 @@ if (import.meta.env.DEV) {
|
|
|
88381
88382
|
acpDelay: options.acpDelay
|
|
88382
88383
|
});
|
|
88383
88384
|
const root$2 = server.config.root;
|
|
88384
|
-
await updateMcpConfigs(root$2,
|
|
88385
|
+
await updateMcpConfigs(root$2, baseUrl, {
|
|
88385
88386
|
updateConfig: options.updateConfig,
|
|
88386
88387
|
updateConfigServerName: options.updateConfigServerName,
|
|
88387
88388
|
updateConfigAdditionalServers: options.updateConfigAdditionalServers,
|
package/dist/index.js
CHANGED
|
@@ -87100,11 +87100,11 @@ async function handleSseConnection(req, res, serverContext, connectionManager) {
|
|
|
87100
87100
|
const url = new URL(req.url ?? "", `http://${host}:${port}`);
|
|
87101
87101
|
const transport = new SSEServerTransport("/__mcp__/messages", res);
|
|
87102
87102
|
const sessionId = transport.sessionId;
|
|
87103
|
-
const clientId = url.searchParams.get("clientId");
|
|
87104
|
-
const puppetId = url.searchParams.get("puppetId");
|
|
87103
|
+
const clientId = url.searchParams.get("clientId") || "agent";
|
|
87104
|
+
const puppetId = url.searchParams.get("puppetId") || "inspector";
|
|
87105
87105
|
connectionManager.registerTransport(sessionId, transport);
|
|
87106
87106
|
if (clientId === "inspector") connectionManager.handleInspectorConnection(sessionId);
|
|
87107
|
-
|
|
87107
|
+
else connectionManager.handleWatcherConnection(sessionId, clientId, puppetId, transport);
|
|
87108
87108
|
await mcpServer.connect(transport);
|
|
87109
87109
|
} catch (error$1) {
|
|
87110
87110
|
console.error("Error establishing SSE connection:", error$1);
|
|
@@ -88182,8 +88182,9 @@ function getConfigPath(id, root$2) {
|
|
|
88182
88182
|
if (editor.path.startsWith("/")) return join(editor.path, editor.file);
|
|
88183
88183
|
return join(findUpDir(editor.path, root$2) || join(root$2, editor.path), editor.file);
|
|
88184
88184
|
}
|
|
88185
|
-
async function writeConfig(configPath, serverName,
|
|
88185
|
+
async function writeConfig(configPath, serverName, baseUrl, clientId, urlKey, format$1, additionalServers) {
|
|
88186
88186
|
await mkdir(configPath.substring(0, configPath.lastIndexOf("/")), { recursive: true });
|
|
88187
|
+
const sseUrl = `${baseUrl}?clientId=${clientId}&puppetId=inspector`;
|
|
88187
88188
|
const config = existsSync(configPath) ? JSON.parse(await readFile(configPath, "utf-8").catch(() => "{}")) : {};
|
|
88188
88189
|
const key$1 = format$1 === "servers" ? "servers" : "mcpServers";
|
|
88189
88190
|
config[key$1] ||= {};
|
|
@@ -88217,7 +88218,7 @@ async function updateMcpConfigs(root$2, sseUrl, options, logger) {
|
|
|
88217
88218
|
const editor = EDITORS[id];
|
|
88218
88219
|
const configPath = getConfigPath(id, root$2);
|
|
88219
88220
|
try {
|
|
88220
|
-
if (await writeConfig(configPath, updateConfigServerName, sseUrl, editor.urlKey, editor.format, updateConfigAdditionalServers)) {
|
|
88221
|
+
if (await writeConfig(configPath, updateConfigServerName, sseUrl, id, editor.urlKey, editor.format, updateConfigAdditionalServers)) {
|
|
88221
88222
|
updates.push({
|
|
88222
88223
|
name: editor.name,
|
|
88223
88224
|
path: configPath
|
|
@@ -88231,7 +88232,7 @@ async function updateMcpConfigs(root$2, sseUrl, options, logger) {
|
|
|
88231
88232
|
for (const custom of customEditors) {
|
|
88232
88233
|
const configPath = join(resolvePath(custom.configPath, root$2), custom.configFileName);
|
|
88233
88234
|
try {
|
|
88234
|
-
if (await writeConfig(configPath, updateConfigServerName, sseUrl, custom.serverUrlKey || "url", custom.configFormat || "mcpServers", updateConfigAdditionalServers)) {
|
|
88235
|
+
if (await writeConfig(configPath, updateConfigServerName, sseUrl, custom.id, custom.serverUrlKey || "url", custom.configFormat || "mcpServers", updateConfigAdditionalServers)) {
|
|
88235
88236
|
updates.push({
|
|
88236
88237
|
name: custom.name,
|
|
88237
88238
|
path: configPath
|
|
@@ -88364,8 +88365,8 @@ if (import.meta.env.DEV) {
|
|
|
88364
88365
|
host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
|
|
88365
88366
|
port: options.port ?? server.config.server.port ?? 5173
|
|
88366
88367
|
};
|
|
88367
|
-
const
|
|
88368
|
-
console.log(`[dev-inspector] 📡 MCP: ${
|
|
88368
|
+
const baseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse`;
|
|
88369
|
+
console.log(`[dev-inspector] 📡 MCP: ${baseUrl}\n`);
|
|
88369
88370
|
await setupMcpMiddleware(server.middlewares, serverContext);
|
|
88370
88371
|
setupAcpMiddleware(server.middlewares, serverContext, {
|
|
88371
88372
|
acpMode: options.acpMode,
|
|
@@ -88373,7 +88374,7 @@ if (import.meta.env.DEV) {
|
|
|
88373
88374
|
acpDelay: options.acpDelay
|
|
88374
88375
|
});
|
|
88375
88376
|
const root$2 = server.config.root;
|
|
88376
|
-
await updateMcpConfigs(root$2,
|
|
88377
|
+
await updateMcpConfigs(root$2, baseUrl, {
|
|
88377
88378
|
updateConfig: options.updateConfig,
|
|
88378
88379
|
updateConfigServerName: options.updateConfigServerName,
|
|
88379
88380
|
updateConfigAdditionalServers: options.updateConfigAdditionalServers,
|
package/package.json
CHANGED