signet-agent 0.1.7 → 0.1.10
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/detect-framework.js +2 -2
- package/dist/index.js +3 -3
- package/dist/setup-mcp.js +36 -20
- package/package.json +1 -1
package/dist/detect-framework.js
CHANGED
|
@@ -10,8 +10,8 @@ export function detectMcpHosts() {
|
|
|
10
10
|
const hosts = [
|
|
11
11
|
{
|
|
12
12
|
name: "Claude Code",
|
|
13
|
-
configPath: join(home, ".claude
|
|
14
|
-
exists: existsSync(join(home, ".claude
|
|
13
|
+
configPath: join(home, ".claude.json"),
|
|
14
|
+
exists: existsSync(join(home, ".claude.json")),
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
name: "Cursor (global)",
|
package/dist/index.js
CHANGED
|
@@ -88,13 +88,13 @@ async function getExistingProfile() {
|
|
|
88
88
|
}
|
|
89
89
|
async function registerProfile(body, authToken) {
|
|
90
90
|
try {
|
|
91
|
+
// Use daemon api-token in Authorization header (for daemon auth).
|
|
92
|
+
// Pass Supabase JWT in body so daemon can forward it to the marketplace API.
|
|
91
93
|
const headers = { "Content-Type": "application/json", ...getDaemonAuthHeaders() };
|
|
92
|
-
if (authToken)
|
|
93
|
-
headers["Authorization"] = `Bearer ${authToken}`;
|
|
94
94
|
const res = await fetch(`${DAEMON_URL.replace(/\/$/, "")}/directory/agents`, {
|
|
95
95
|
method: "POST",
|
|
96
96
|
headers,
|
|
97
|
-
body: JSON.stringify(body),
|
|
97
|
+
body: JSON.stringify({ ...body, ...(authToken ? { authToken } : {}) }),
|
|
98
98
|
signal: AbortSignal.timeout(15000),
|
|
99
99
|
});
|
|
100
100
|
const data = (await res.json());
|
package/dist/setup-mcp.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `signet setup-mcp` — auto-configure MCP hosts to use Signet tools.
|
|
3
3
|
*/
|
|
4
4
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
5
|
-
import { join, resolve, dirname } from "path";
|
|
5
|
+
import { join, resolve, dirname } from "path"; // resolve used in findMcpServerLocalPath
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
7
|
import { createRequire } from "module";
|
|
8
8
|
import { homedir } from "os";
|
|
@@ -24,7 +24,7 @@ function getDaemonAuthHeaders() {
|
|
|
24
24
|
catch { /* ignore */ }
|
|
25
25
|
return {};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function findMcpServerLocalPath() {
|
|
28
28
|
const candidates = [
|
|
29
29
|
join(__dirname, "..", "..", "adapters", "mcp", "dist", "index.js"),
|
|
30
30
|
join(process.cwd(), "adapters", "mcp", "dist", "index.js"),
|
|
@@ -42,7 +42,7 @@ function findMcpServerPath() {
|
|
|
42
42
|
return require.resolve("@signet/mcp-server");
|
|
43
43
|
}
|
|
44
44
|
catch { /* not installed */ }
|
|
45
|
-
return
|
|
45
|
+
return null;
|
|
46
46
|
}
|
|
47
47
|
function getApiTokenForEnv() {
|
|
48
48
|
if (process.env.SIGNET_API_TOKEN)
|
|
@@ -56,7 +56,18 @@ function getApiTokenForEnv() {
|
|
|
56
56
|
catch { /* ignore */ }
|
|
57
57
|
return "";
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function buildSignetMcpEntry() {
|
|
60
|
+
const apiToken = getApiTokenForEnv();
|
|
61
|
+
const localPath = findMcpServerLocalPath();
|
|
62
|
+
const env = { SIGNET_DAEMON_URL: DAEMON_URL };
|
|
63
|
+
if (apiToken)
|
|
64
|
+
env.SIGNET_API_TOKEN = apiToken;
|
|
65
|
+
if (localPath) {
|
|
66
|
+
return { type: "stdio", command: "node", args: [localPath], env };
|
|
67
|
+
}
|
|
68
|
+
return { type: "stdio", command: "npx", args: ["-y", "@onsignet/mcp-server"], env };
|
|
69
|
+
}
|
|
70
|
+
function addToMcpConfig(configPath) {
|
|
60
71
|
let config = {};
|
|
61
72
|
if (existsSync(configPath)) {
|
|
62
73
|
try {
|
|
@@ -68,15 +79,17 @@ function addToMcpConfig(configPath, serverPath) {
|
|
|
68
79
|
}
|
|
69
80
|
}
|
|
70
81
|
const servers = (config.mcpServers ?? {});
|
|
71
|
-
|
|
82
|
+
const newEntry = buildSignetMcpEntry();
|
|
83
|
+
// Update if not present OR if the existing entry uses an absolute node path that no longer exists
|
|
84
|
+
const existing = servers.signet;
|
|
85
|
+
const needsUpdate = !existing ||
|
|
86
|
+
(existing.command === "node" &&
|
|
87
|
+
Array.isArray(existing.args) &&
|
|
88
|
+
typeof existing.args[0] === "string" &&
|
|
89
|
+
!existsSync(existing.args[0]));
|
|
90
|
+
if (!needsUpdate)
|
|
72
91
|
return false;
|
|
73
|
-
|
|
74
|
-
const apiToken = getApiTokenForEnv();
|
|
75
|
-
servers.signet = {
|
|
76
|
-
command: "node",
|
|
77
|
-
args: [serverPath],
|
|
78
|
-
env: apiToken ? { SIGNET_API_TOKEN: apiToken } : {},
|
|
79
|
-
};
|
|
92
|
+
servers.signet = newEntry;
|
|
80
93
|
config.mcpServers = servers;
|
|
81
94
|
const dir = configPath.replace(/[/\\][^/\\]+$/, "");
|
|
82
95
|
if (!existsSync(dir))
|
|
@@ -105,10 +118,12 @@ export async function cmdSetupMcp() {
|
|
|
105
118
|
console.error(`Cannot reach daemon at ${DAEMON_URL}.\nStart it first: npx signet-agent start`);
|
|
106
119
|
process.exit(1);
|
|
107
120
|
}
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
const localPath = findMcpServerLocalPath();
|
|
122
|
+
if (localPath) {
|
|
123
|
+
console.log(` MCP server: ${localPath}`);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.log(` MCP server: npx @onsignet/mcp-server (fetched on demand)`);
|
|
112
127
|
}
|
|
113
128
|
const hosts = detectMcpHosts();
|
|
114
129
|
const detected = hosts.filter((h) => {
|
|
@@ -119,12 +134,13 @@ export async function cmdSetupMcp() {
|
|
|
119
134
|
console.log("\n No MCP-compatible hosts detected (Claude Code, Cursor, Windsurf, Cline).");
|
|
120
135
|
console.log(" Install one, then run `npx signet-agent setup-mcp` again.");
|
|
121
136
|
console.log("\n Manual configuration:");
|
|
122
|
-
console.log(` Add this to your MCP config file:`);
|
|
137
|
+
console.log(` Add this to your MCP config file (~/.claude/mcp_config.json or ~/.cursor/mcp.json):`);
|
|
123
138
|
console.log(` {`);
|
|
124
139
|
console.log(` "mcpServers": {`);
|
|
125
140
|
console.log(` "signet": {`);
|
|
126
|
-
console.log(` "command": "
|
|
127
|
-
console.log(` "args": ["
|
|
141
|
+
console.log(` "command": "npx",`);
|
|
142
|
+
console.log(` "args": ["-y", "@onsignet/mcp-server"],`);
|
|
143
|
+
console.log(` "env": { "SIGNET_DAEMON_URL": "http://127.0.0.1:8766" }`);
|
|
128
144
|
console.log(` }`);
|
|
129
145
|
console.log(` }`);
|
|
130
146
|
console.log(` }`);
|
|
@@ -133,7 +149,7 @@ export async function cmdSetupMcp() {
|
|
|
133
149
|
console.log(`\n Detected ${detected.length} MCP host(s):\n`);
|
|
134
150
|
let configured = 0;
|
|
135
151
|
for (const host of detected) {
|
|
136
|
-
const added = addToMcpConfig(host.configPath
|
|
152
|
+
const added = addToMcpConfig(host.configPath);
|
|
137
153
|
if (added) {
|
|
138
154
|
console.log(` + ${host.name} — configured (${host.configPath})`);
|
|
139
155
|
configured++;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "signet-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "CLI for the Signet agent network. Register your AI agent on onsignet.com, connect to the relay, and get a live public profile — in one command.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|