@hasna/mcps 0.0.8 → 0.0.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/bin/index.js +42 -2
- package/bin/mcp.js +39 -0
- package/dist/lib/pg-migrations.d.ts +6 -0
- package/package.json +5 -4
package/bin/index.js
CHANGED
|
@@ -18059,7 +18059,7 @@ var init_sources = __esm(() => {
|
|
|
18059
18059
|
var require_package = __commonJS((exports, module) => {
|
|
18060
18060
|
module.exports = {
|
|
18061
18061
|
name: "@hasna/mcps",
|
|
18062
|
-
version: "0.0.
|
|
18062
|
+
version: "0.0.10",
|
|
18063
18063
|
description: "Meta-MCP registry & CLI \u2014 discover, manage, and proxy MCP servers",
|
|
18064
18064
|
type: "module",
|
|
18065
18065
|
main: "dist/index.js",
|
|
@@ -18090,7 +18090,8 @@ var require_package = __commonJS((exports, module) => {
|
|
|
18090
18090
|
serve: "bun run src/cli/index.tsx serve",
|
|
18091
18091
|
test: "bun test",
|
|
18092
18092
|
typecheck: "tsc --noEmit",
|
|
18093
|
-
prepublishOnly: "bun run build"
|
|
18093
|
+
prepublishOnly: "bun run build",
|
|
18094
|
+
postinstall: "mkdir -p $HOME/.hasna/mcps/cache 2>/dev/null || true"
|
|
18094
18095
|
},
|
|
18095
18096
|
dependencies: {
|
|
18096
18097
|
"@hasna/cloud": "^0.1.0",
|
|
@@ -35876,6 +35877,7 @@ var server = new McpServer({
|
|
|
35876
35877
|
name: "mcps",
|
|
35877
35878
|
version: VERSION
|
|
35878
35879
|
});
|
|
35880
|
+
var _mcpsAgents = new Map;
|
|
35879
35881
|
server.tool("list_servers", "List all registered MCP servers", {}, async () => {
|
|
35880
35882
|
const servers = listServers();
|
|
35881
35883
|
return {
|
|
@@ -36175,6 +36177,44 @@ server.tool("send_feedback", "Send feedback about this service", {
|
|
|
36175
36177
|
adapter.run("INSERT INTO feedback (message, email, category, version) VALUES (?, ?, ?, ?)", params.message, params.email || null, params.category || "general", VERSION);
|
|
36176
36178
|
return { content: [{ type: "text", text: "Feedback saved. Thank you!" }] };
|
|
36177
36179
|
});
|
|
36180
|
+
server.tool("register_agent", "Register an agent session. Returns agent_id. Auto-triggers a heartbeat.", {
|
|
36181
|
+
name: exports_external2.string(),
|
|
36182
|
+
session_id: exports_external2.string().optional()
|
|
36183
|
+
}, async (params) => {
|
|
36184
|
+
const existing = [..._mcpsAgents.values()].find((a) => a.name === params.name);
|
|
36185
|
+
if (existing) {
|
|
36186
|
+
existing.last_seen_at = new Date().toISOString();
|
|
36187
|
+
if (params.session_id)
|
|
36188
|
+
existing.session_id = params.session_id;
|
|
36189
|
+
return { content: [{ type: "text", text: JSON.stringify(existing) }] };
|
|
36190
|
+
}
|
|
36191
|
+
const id = Math.random().toString(36).slice(2, 10);
|
|
36192
|
+
const ag = { id, name: params.name, session_id: params.session_id, last_seen_at: new Date().toISOString() };
|
|
36193
|
+
_mcpsAgents.set(id, ag);
|
|
36194
|
+
return { content: [{ type: "text", text: JSON.stringify(ag) }] };
|
|
36195
|
+
});
|
|
36196
|
+
server.tool("heartbeat", "Update last_seen_at to signal agent is active.", {
|
|
36197
|
+
agent_id: exports_external2.string()
|
|
36198
|
+
}, async (params) => {
|
|
36199
|
+
const ag = _mcpsAgents.get(params.agent_id);
|
|
36200
|
+
if (!ag)
|
|
36201
|
+
return { content: [{ type: "text", text: `Agent not found: ${params.agent_id}` }], isError: true };
|
|
36202
|
+
ag.last_seen_at = new Date().toISOString();
|
|
36203
|
+
return { content: [{ type: "text", text: JSON.stringify({ agent_id: ag.id, last_seen_at: ag.last_seen_at }) }] };
|
|
36204
|
+
});
|
|
36205
|
+
server.tool("set_focus", "Set active project context for this agent session.", {
|
|
36206
|
+
agent_id: exports_external2.string(),
|
|
36207
|
+
project_id: exports_external2.string().optional()
|
|
36208
|
+
}, async (params) => {
|
|
36209
|
+
const ag = _mcpsAgents.get(params.agent_id);
|
|
36210
|
+
if (!ag)
|
|
36211
|
+
return { content: [{ type: "text", text: `Agent not found: ${params.agent_id}` }], isError: true };
|
|
36212
|
+
ag.project_id = params.project_id;
|
|
36213
|
+
return { content: [{ type: "text", text: JSON.stringify({ agent_id: ag.id, project_id: ag.project_id ?? null }) }] };
|
|
36214
|
+
});
|
|
36215
|
+
server.tool("list_agents", "List all registered agents.", {}, async () => {
|
|
36216
|
+
return { content: [{ type: "text", text: JSON.stringify([..._mcpsAgents.values()]) }] };
|
|
36217
|
+
});
|
|
36178
36218
|
async function startMcpServer() {
|
|
36179
36219
|
const transport = new StdioServerTransport;
|
|
36180
36220
|
await server.connect(transport);
|
package/bin/mcp.js
CHANGED
|
@@ -32259,6 +32259,7 @@ var server = new McpServer({
|
|
|
32259
32259
|
name: "mcps",
|
|
32260
32260
|
version: VERSION
|
|
32261
32261
|
});
|
|
32262
|
+
var _mcpsAgents = new Map;
|
|
32262
32263
|
server.tool("list_servers", "List all registered MCP servers", {}, async () => {
|
|
32263
32264
|
const servers = listServers();
|
|
32264
32265
|
return {
|
|
@@ -32558,6 +32559,44 @@ server.tool("send_feedback", "Send feedback about this service", {
|
|
|
32558
32559
|
adapter.run("INSERT INTO feedback (message, email, category, version) VALUES (?, ?, ?, ?)", params.message, params.email || null, params.category || "general", VERSION);
|
|
32559
32560
|
return { content: [{ type: "text", text: "Feedback saved. Thank you!" }] };
|
|
32560
32561
|
});
|
|
32562
|
+
server.tool("register_agent", "Register an agent session. Returns agent_id. Auto-triggers a heartbeat.", {
|
|
32563
|
+
name: exports_external.string(),
|
|
32564
|
+
session_id: exports_external.string().optional()
|
|
32565
|
+
}, async (params) => {
|
|
32566
|
+
const existing = [..._mcpsAgents.values()].find((a) => a.name === params.name);
|
|
32567
|
+
if (existing) {
|
|
32568
|
+
existing.last_seen_at = new Date().toISOString();
|
|
32569
|
+
if (params.session_id)
|
|
32570
|
+
existing.session_id = params.session_id;
|
|
32571
|
+
return { content: [{ type: "text", text: JSON.stringify(existing) }] };
|
|
32572
|
+
}
|
|
32573
|
+
const id = Math.random().toString(36).slice(2, 10);
|
|
32574
|
+
const ag = { id, name: params.name, session_id: params.session_id, last_seen_at: new Date().toISOString() };
|
|
32575
|
+
_mcpsAgents.set(id, ag);
|
|
32576
|
+
return { content: [{ type: "text", text: JSON.stringify(ag) }] };
|
|
32577
|
+
});
|
|
32578
|
+
server.tool("heartbeat", "Update last_seen_at to signal agent is active.", {
|
|
32579
|
+
agent_id: exports_external.string()
|
|
32580
|
+
}, async (params) => {
|
|
32581
|
+
const ag = _mcpsAgents.get(params.agent_id);
|
|
32582
|
+
if (!ag)
|
|
32583
|
+
return { content: [{ type: "text", text: `Agent not found: ${params.agent_id}` }], isError: true };
|
|
32584
|
+
ag.last_seen_at = new Date().toISOString();
|
|
32585
|
+
return { content: [{ type: "text", text: JSON.stringify({ agent_id: ag.id, last_seen_at: ag.last_seen_at }) }] };
|
|
32586
|
+
});
|
|
32587
|
+
server.tool("set_focus", "Set active project context for this agent session.", {
|
|
32588
|
+
agent_id: exports_external.string(),
|
|
32589
|
+
project_id: exports_external.string().optional()
|
|
32590
|
+
}, async (params) => {
|
|
32591
|
+
const ag = _mcpsAgents.get(params.agent_id);
|
|
32592
|
+
if (!ag)
|
|
32593
|
+
return { content: [{ type: "text", text: `Agent not found: ${params.agent_id}` }], isError: true };
|
|
32594
|
+
ag.project_id = params.project_id;
|
|
32595
|
+
return { content: [{ type: "text", text: JSON.stringify({ agent_id: ag.id, project_id: ag.project_id ?? null }) }] };
|
|
32596
|
+
});
|
|
32597
|
+
server.tool("list_agents", "List all registered agents.", {}, async () => {
|
|
32598
|
+
return { content: [{ type: "text", text: JSON.stringify([..._mcpsAgents.values()]) }] };
|
|
32599
|
+
});
|
|
32561
32600
|
async function startMcpServer() {
|
|
32562
32601
|
const transport = new StdioServerTransport;
|
|
32563
32602
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/mcps",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Meta-MCP registry & CLI
|
|
3
|
+
"version": "0.0.10",
|
|
4
|
+
"description": "Meta-MCP registry & CLI \u2014 discover, manage, and proxy MCP servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"serve": "bun run src/cli/index.tsx serve",
|
|
32
32
|
"test": "bun test",
|
|
33
33
|
"typecheck": "tsc --noEmit",
|
|
34
|
-
"prepublishOnly": "bun run build"
|
|
34
|
+
"prepublishOnly": "bun run build",
|
|
35
|
+
"postinstall": "mkdir -p $HOME/.hasna/mcps/cache 2>/dev/null || true"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@hasna/cloud": "^0.1.0",
|
|
@@ -58,4 +59,4 @@
|
|
|
58
59
|
"registry": "https://registry.npmjs.org",
|
|
59
60
|
"access": "public"
|
|
60
61
|
}
|
|
61
|
-
}
|
|
62
|
+
}
|