@askthew/mcp-plugin 0.2.1 → 0.2.2
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/cli.js +9 -1
- package/dist/install.d.ts +4 -0
- package/dist/install.js +25 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
import { createAskTheWMcpServer } from "./index.js";
|
|
4
|
-
import { createHostConfigSnippet, formatInstallCommand, installHostConfig, } from "./install.js";
|
|
4
|
+
import { createHostConfigSnippet, formatInstallCommand, installHostConfig, sendInstallHeartbeat, } from "./install.js";
|
|
5
5
|
function usage() {
|
|
6
6
|
return [
|
|
7
7
|
"AskTheW Coding Agent Connector",
|
|
@@ -105,9 +105,17 @@ async function main() {
|
|
|
105
105
|
if (command === "install") {
|
|
106
106
|
const options = parseInstallArgs(argv);
|
|
107
107
|
const result = installHostConfig(options);
|
|
108
|
+
const heartbeatSent = result.wroteFile
|
|
109
|
+
? await sendInstallHeartbeat(options).catch(() => false)
|
|
110
|
+
: false;
|
|
108
111
|
console.log(result.wroteFile ? "AskTheW plugin install complete." : "AskTheW plugin dry run complete.");
|
|
109
112
|
console.log(`Settings path: ${result.settingsPath}`);
|
|
110
113
|
console.log(`Install command: ${formatInstallCommand(options)}`);
|
|
114
|
+
if (result.wroteFile) {
|
|
115
|
+
console.log(heartbeatSent
|
|
116
|
+
? "Ask The W setup check sent. Refresh the app to confirm the plugin was seen."
|
|
117
|
+
: "Ask The W setup check could not be sent yet. Restart or reload your coding app, then refresh Ask The W.");
|
|
118
|
+
}
|
|
111
119
|
console.log(`Next step: ${result.nextStep}`);
|
|
112
120
|
if (!result.wroteFile) {
|
|
113
121
|
console.log("");
|
package/dist/install.d.ts
CHANGED
|
@@ -62,4 +62,8 @@ export declare function installHostConfig(input: InstallHostConfigInput): {
|
|
|
62
62
|
wroteFile: boolean;
|
|
63
63
|
nextStep: string;
|
|
64
64
|
};
|
|
65
|
+
export declare function sendInstallHeartbeat(input: HostConfigInput & {
|
|
66
|
+
cwd?: string;
|
|
67
|
+
fetchImpl?: typeof fetch;
|
|
68
|
+
}): Promise<boolean>;
|
|
65
69
|
export {};
|
package/dist/install.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { resolvePluginScope } from "./scope.js";
|
|
4
5
|
function isRecord(value) {
|
|
5
6
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
7
|
}
|
|
@@ -68,7 +69,7 @@ export function formatInstallCommand(input) {
|
|
|
68
69
|
}
|
|
69
70
|
export function verificationNextStep(hostType) {
|
|
70
71
|
const hostLabel = hostType === "claude_code" ? "Claude Code" : "Codex";
|
|
71
|
-
return `Restart ${hostLabel} if it is already open, then send a
|
|
72
|
+
return `Refresh Ask The W to confirm the plugin was seen. Restart ${hostLabel} if it is already open, then send a first setup check. list_mcp_resources/list_mcp_resource_templates may be empty for this tool-driven connector and are not failure signals.`;
|
|
72
73
|
}
|
|
73
74
|
export function installHostConfig(input) {
|
|
74
75
|
const settingsPath = resolveSettingsPath({
|
|
@@ -109,3 +110,26 @@ export function installHostConfig(input) {
|
|
|
109
110
|
nextStep: verificationNextStep(input.hostType),
|
|
110
111
|
};
|
|
111
112
|
}
|
|
113
|
+
export async function sendInstallHeartbeat(input) {
|
|
114
|
+
const fetcher = input.fetchImpl ?? fetch;
|
|
115
|
+
const scope = resolvePluginScope(input.cwd ?? process.cwd());
|
|
116
|
+
const apiUrl = input.apiUrl.replace(/\/$/, "");
|
|
117
|
+
const response = await fetcher(`${apiUrl}/api/connectors/mcp/heartbeat`, {
|
|
118
|
+
method: "POST",
|
|
119
|
+
headers: {
|
|
120
|
+
"Content-Type": "application/json",
|
|
121
|
+
},
|
|
122
|
+
body: JSON.stringify({
|
|
123
|
+
installToken: input.token,
|
|
124
|
+
clientId: input.clientId || input.hostType,
|
|
125
|
+
clientLabel: input.clientLabel,
|
|
126
|
+
hostType: input.hostType,
|
|
127
|
+
serverName: input.serverName,
|
|
128
|
+
repoName: scope.repoName,
|
|
129
|
+
...(scope.repoRoot ? { repoRoot: scope.repoRoot } : {}),
|
|
130
|
+
...(scope.appPath ? { appPath: scope.appPath } : {}),
|
|
131
|
+
...(scope.serviceName ? { serviceName: scope.serviceName } : {}),
|
|
132
|
+
}),
|
|
133
|
+
});
|
|
134
|
+
return response.ok;
|
|
135
|
+
}
|