@hasna/mcps 0.0.28 → 0.0.29

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 CHANGED
@@ -35367,6 +35367,54 @@ import { execFileSync as execFileSync2 } from "child_process";
35367
35367
  import { existsSync as existsSync7, readFileSync as readFileSync4, writeFileSync as writeFileSync3, mkdirSync as mkdirSync7 } from "fs";
35368
35368
  import { join as join10 } from "path";
35369
35369
  import { homedir as homedir8 } from "os";
35370
+ function formatTomlString(value) {
35371
+ return JSON.stringify(value);
35372
+ }
35373
+ function formatTomlKey(key) {
35374
+ return /^[A-Za-z0-9_-]+$/.test(key) ? key : formatTomlString(key);
35375
+ }
35376
+ function formatTomlEnv(env) {
35377
+ return Object.entries(env).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${formatTomlKey(key)} = ${formatTomlString(value)}`).join(`
35378
+ `);
35379
+ }
35380
+ function escapeRegExp(value) {
35381
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
35382
+ }
35383
+ function codexServerHeader(id) {
35384
+ return `[mcp_servers.${id}]`;
35385
+ }
35386
+ function codexEnvHeader(id) {
35387
+ return `[mcp_servers.${id}.env]`;
35388
+ }
35389
+ function formatCodexEnvBlock(id, env) {
35390
+ return `
35391
+ ${codexEnvHeader(id)}
35392
+ ${formatTomlEnv(env)}
35393
+ `;
35394
+ }
35395
+ function formatCodexServerBlock(entry, env) {
35396
+ return `
35397
+ ${codexServerHeader(entry.id)}
35398
+ ` + `command = ${formatTomlString(entry.command)}
35399
+ ` + `args = [${entry.args.map((a) => formatTomlString(a)).join(", ")}]
35400
+ ` + (Object.keys(env).length > 0 ? formatCodexEnvBlock(entry.id, env) : "");
35401
+ }
35402
+ function upsertCodexEnvBlock(config2, id, env) {
35403
+ const envBlock = formatCodexEnvBlock(id, env);
35404
+ const envHeaderPattern = escapeRegExp(codexEnvHeader(id));
35405
+ const envBlockPattern = new RegExp(`(?:\\r?\\n)?[ \\t]*${envHeaderPattern}[ \\t]*\\r?\\n[\\s\\S]*?(?=\\r?\\n[ \\t]*\\[|\\s*$)`);
35406
+ if (envBlockPattern.test(config2)) {
35407
+ return config2.replace(envBlockPattern, () => envBlock);
35408
+ }
35409
+ const serverHeaderPattern = escapeRegExp(codexServerHeader(id));
35410
+ const serverBlockPattern = new RegExp(`([ \\t]*${serverHeaderPattern}[ \\t]*\\r?\\n[\\s\\S]*?)(?=\\r?\\n[ \\t]*\\[|\\s*$)`);
35411
+ let inserted = false;
35412
+ const updated = config2.replace(serverBlockPattern, (_match, serverBlock) => {
35413
+ inserted = true;
35414
+ return `${serverBlock}${envBlock}`;
35415
+ });
35416
+ return inserted ? updated : `${config2}${envBlock}`;
35417
+ }
35370
35418
  function installToClaude(entry) {
35371
35419
  try {
35372
35420
  const args = [
@@ -35394,16 +35442,15 @@ function installToCodex(entry) {
35394
35442
  if (!existsSync7(configDir)) {
35395
35443
  mkdirSync7(configDir, { recursive: true });
35396
35444
  }
35397
- const block = `
35398
- [mcp_servers.${entry.id}]
35399
- ` + `command = ${JSON.stringify(entry.command)}
35400
- ` + `args = [${entry.args.map((a) => JSON.stringify(a)).join(", ")}]
35401
- `;
35445
+ const env = assertAgentInstallEnv(entry);
35402
35446
  const existing = existsSync7(configPath) ? readFileSync4(configPath, "utf-8") : "";
35403
- if (existing.includes(`[mcp_servers.${entry.id}]`)) {
35447
+ if (existing.includes(codexServerHeader(entry.id))) {
35448
+ if (Object.keys(env).length > 0) {
35449
+ writeFileSync3(configPath, upsertCodexEnvBlock(existing, entry.id, env), "utf-8");
35450
+ }
35404
35451
  return { agent: "codex", success: true };
35405
35452
  }
35406
- writeFileSync3(configPath, existing + block, "utf-8");
35453
+ writeFileSync3(configPath, existing + formatCodexServerBlock(entry, env), "utf-8");
35407
35454
  return { agent: "codex", success: true };
35408
35455
  } catch (err) {
35409
35456
  return { agent: "codex", success: false, error: err.message };
@@ -36503,7 +36550,7 @@ var init_provider_profiles = __esm(() => {
36503
36550
  var require_package = __commonJS((exports, module) => {
36504
36551
  module.exports = {
36505
36552
  name: "@hasna/mcps",
36506
- version: "0.0.28",
36553
+ version: "0.0.29",
36507
36554
  description: "Meta-MCP registry & CLI \u2014 discover, manage, and proxy MCP servers",
36508
36555
  type: "module",
36509
36556
  repository: {
package/bin/mcp.js CHANGED
@@ -31534,6 +31534,54 @@ import { execFileSync } from "child_process";
31534
31534
  import { existsSync as existsSync10, readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync7 } from "fs";
31535
31535
  import { join as join11 } from "path";
31536
31536
  import { homedir as homedir8 } from "os";
31537
+ function formatTomlString(value) {
31538
+ return JSON.stringify(value);
31539
+ }
31540
+ function formatTomlKey(key) {
31541
+ return /^[A-Za-z0-9_-]+$/.test(key) ? key : formatTomlString(key);
31542
+ }
31543
+ function formatTomlEnv(env) {
31544
+ return Object.entries(env).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${formatTomlKey(key)} = ${formatTomlString(value)}`).join(`
31545
+ `);
31546
+ }
31547
+ function escapeRegExp(value) {
31548
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31549
+ }
31550
+ function codexServerHeader(id) {
31551
+ return `[mcp_servers.${id}]`;
31552
+ }
31553
+ function codexEnvHeader(id) {
31554
+ return `[mcp_servers.${id}.env]`;
31555
+ }
31556
+ function formatCodexEnvBlock(id, env) {
31557
+ return `
31558
+ ${codexEnvHeader(id)}
31559
+ ${formatTomlEnv(env)}
31560
+ `;
31561
+ }
31562
+ function formatCodexServerBlock(entry, env) {
31563
+ return `
31564
+ ${codexServerHeader(entry.id)}
31565
+ ` + `command = ${formatTomlString(entry.command)}
31566
+ ` + `args = [${entry.args.map((a) => formatTomlString(a)).join(", ")}]
31567
+ ` + (Object.keys(env).length > 0 ? formatCodexEnvBlock(entry.id, env) : "");
31568
+ }
31569
+ function upsertCodexEnvBlock(config2, id, env) {
31570
+ const envBlock = formatCodexEnvBlock(id, env);
31571
+ const envHeaderPattern = escapeRegExp(codexEnvHeader(id));
31572
+ const envBlockPattern = new RegExp(`(?:\\r?\\n)?[ \\t]*${envHeaderPattern}[ \\t]*\\r?\\n[\\s\\S]*?(?=\\r?\\n[ \\t]*\\[|\\s*$)`);
31573
+ if (envBlockPattern.test(config2)) {
31574
+ return config2.replace(envBlockPattern, () => envBlock);
31575
+ }
31576
+ const serverHeaderPattern = escapeRegExp(codexServerHeader(id));
31577
+ const serverBlockPattern = new RegExp(`([ \\t]*${serverHeaderPattern}[ \\t]*\\r?\\n[\\s\\S]*?)(?=\\r?\\n[ \\t]*\\[|\\s*$)`);
31578
+ let inserted = false;
31579
+ const updated = config2.replace(serverBlockPattern, (_match, serverBlock) => {
31580
+ inserted = true;
31581
+ return `${serverBlock}${envBlock}`;
31582
+ });
31583
+ return inserted ? updated : `${config2}${envBlock}`;
31584
+ }
31537
31585
  function installToClaude(entry) {
31538
31586
  try {
31539
31587
  const args = [
@@ -31561,16 +31609,15 @@ function installToCodex(entry) {
31561
31609
  if (!existsSync10(configDir)) {
31562
31610
  mkdirSync7(configDir, { recursive: true });
31563
31611
  }
31564
- const block = `
31565
- [mcp_servers.${entry.id}]
31566
- ` + `command = ${JSON.stringify(entry.command)}
31567
- ` + `args = [${entry.args.map((a) => JSON.stringify(a)).join(", ")}]
31568
- `;
31612
+ const env = assertAgentInstallEnv(entry);
31569
31613
  const existing = existsSync10(configPath) ? readFileSync5(configPath, "utf-8") : "";
31570
- if (existing.includes(`[mcp_servers.${entry.id}]`)) {
31614
+ if (existing.includes(codexServerHeader(entry.id))) {
31615
+ if (Object.keys(env).length > 0) {
31616
+ writeFileSync3(configPath, upsertCodexEnvBlock(existing, entry.id, env), "utf-8");
31617
+ }
31571
31618
  return { agent: "codex", success: true };
31572
31619
  }
31573
- writeFileSync3(configPath, existing + block, "utf-8");
31620
+ writeFileSync3(configPath, existing + formatCodexServerBlock(entry, env), "utf-8");
31574
31621
  return { agent: "codex", success: true };
31575
31622
  } catch (err) {
31576
31623
  return { agent: "codex", success: false, error: err.message };
package/dist/index.js CHANGED
@@ -26634,6 +26634,54 @@ import { execFileSync as execFileSync2 } from "child_process";
26634
26634
  import { existsSync as existsSync9, readFileSync as readFileSync4, writeFileSync as writeFileSync3, mkdirSync as mkdirSync7 } from "fs";
26635
26635
  import { join as join10 } from "path";
26636
26636
  import { homedir as homedir8 } from "os";
26637
+ function formatTomlString(value) {
26638
+ return JSON.stringify(value);
26639
+ }
26640
+ function formatTomlKey(key) {
26641
+ return /^[A-Za-z0-9_-]+$/.test(key) ? key : formatTomlString(key);
26642
+ }
26643
+ function formatTomlEnv(env) {
26644
+ return Object.entries(env).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${formatTomlKey(key)} = ${formatTomlString(value)}`).join(`
26645
+ `);
26646
+ }
26647
+ function escapeRegExp(value) {
26648
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
26649
+ }
26650
+ function codexServerHeader(id) {
26651
+ return `[mcp_servers.${id}]`;
26652
+ }
26653
+ function codexEnvHeader(id) {
26654
+ return `[mcp_servers.${id}.env]`;
26655
+ }
26656
+ function formatCodexEnvBlock(id, env) {
26657
+ return `
26658
+ ${codexEnvHeader(id)}
26659
+ ${formatTomlEnv(env)}
26660
+ `;
26661
+ }
26662
+ function formatCodexServerBlock(entry, env) {
26663
+ return `
26664
+ ${codexServerHeader(entry.id)}
26665
+ ` + `command = ${formatTomlString(entry.command)}
26666
+ ` + `args = [${entry.args.map((a) => formatTomlString(a)).join(", ")}]
26667
+ ` + (Object.keys(env).length > 0 ? formatCodexEnvBlock(entry.id, env) : "");
26668
+ }
26669
+ function upsertCodexEnvBlock(config2, id, env) {
26670
+ const envBlock = formatCodexEnvBlock(id, env);
26671
+ const envHeaderPattern = escapeRegExp(codexEnvHeader(id));
26672
+ const envBlockPattern = new RegExp(`(?:\\r?\\n)?[ \\t]*${envHeaderPattern}[ \\t]*\\r?\\n[\\s\\S]*?(?=\\r?\\n[ \\t]*\\[|\\s*$)`);
26673
+ if (envBlockPattern.test(config2)) {
26674
+ return config2.replace(envBlockPattern, () => envBlock);
26675
+ }
26676
+ const serverHeaderPattern = escapeRegExp(codexServerHeader(id));
26677
+ const serverBlockPattern = new RegExp(`([ \\t]*${serverHeaderPattern}[ \\t]*\\r?\\n[\\s\\S]*?)(?=\\r?\\n[ \\t]*\\[|\\s*$)`);
26678
+ let inserted = false;
26679
+ const updated = config2.replace(serverBlockPattern, (_match, serverBlock) => {
26680
+ inserted = true;
26681
+ return `${serverBlock}${envBlock}`;
26682
+ });
26683
+ return inserted ? updated : `${config2}${envBlock}`;
26684
+ }
26637
26685
  function installToClaude(entry) {
26638
26686
  try {
26639
26687
  const args = [
@@ -26661,16 +26709,15 @@ function installToCodex(entry) {
26661
26709
  if (!existsSync9(configDir)) {
26662
26710
  mkdirSync7(configDir, { recursive: true });
26663
26711
  }
26664
- const block = `
26665
- [mcp_servers.${entry.id}]
26666
- ` + `command = ${JSON.stringify(entry.command)}
26667
- ` + `args = [${entry.args.map((a) => JSON.stringify(a)).join(", ")}]
26668
- `;
26712
+ const env = assertAgentInstallEnv(entry);
26669
26713
  const existing = existsSync9(configPath) ? readFileSync4(configPath, "utf-8") : "";
26670
- if (existing.includes(`[mcp_servers.${entry.id}]`)) {
26714
+ if (existing.includes(codexServerHeader(entry.id))) {
26715
+ if (Object.keys(env).length > 0) {
26716
+ writeFileSync3(configPath, upsertCodexEnvBlock(existing, entry.id, env), "utf-8");
26717
+ }
26671
26718
  return { agent: "codex", success: true };
26672
26719
  }
26673
- writeFileSync3(configPath, existing + block, "utf-8");
26720
+ writeFileSync3(configPath, existing + formatCodexServerBlock(entry, env), "utf-8");
26674
26721
  return { agent: "codex", success: true };
26675
26722
  } catch (err) {
26676
26723
  return { agent: "codex", success: false, error: err.message };
package/dist/mcp/index.js CHANGED
@@ -31534,6 +31534,54 @@ import { execFileSync } from "child_process";
31534
31534
  import { existsSync as existsSync10, readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync7 } from "fs";
31535
31535
  import { join as join11 } from "path";
31536
31536
  import { homedir as homedir8 } from "os";
31537
+ function formatTomlString(value) {
31538
+ return JSON.stringify(value);
31539
+ }
31540
+ function formatTomlKey(key) {
31541
+ return /^[A-Za-z0-9_-]+$/.test(key) ? key : formatTomlString(key);
31542
+ }
31543
+ function formatTomlEnv(env) {
31544
+ return Object.entries(env).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${formatTomlKey(key)} = ${formatTomlString(value)}`).join(`
31545
+ `);
31546
+ }
31547
+ function escapeRegExp(value) {
31548
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31549
+ }
31550
+ function codexServerHeader(id) {
31551
+ return `[mcp_servers.${id}]`;
31552
+ }
31553
+ function codexEnvHeader(id) {
31554
+ return `[mcp_servers.${id}.env]`;
31555
+ }
31556
+ function formatCodexEnvBlock(id, env) {
31557
+ return `
31558
+ ${codexEnvHeader(id)}
31559
+ ${formatTomlEnv(env)}
31560
+ `;
31561
+ }
31562
+ function formatCodexServerBlock(entry, env) {
31563
+ return `
31564
+ ${codexServerHeader(entry.id)}
31565
+ ` + `command = ${formatTomlString(entry.command)}
31566
+ ` + `args = [${entry.args.map((a) => formatTomlString(a)).join(", ")}]
31567
+ ` + (Object.keys(env).length > 0 ? formatCodexEnvBlock(entry.id, env) : "");
31568
+ }
31569
+ function upsertCodexEnvBlock(config2, id, env) {
31570
+ const envBlock = formatCodexEnvBlock(id, env);
31571
+ const envHeaderPattern = escapeRegExp(codexEnvHeader(id));
31572
+ const envBlockPattern = new RegExp(`(?:\\r?\\n)?[ \\t]*${envHeaderPattern}[ \\t]*\\r?\\n[\\s\\S]*?(?=\\r?\\n[ \\t]*\\[|\\s*$)`);
31573
+ if (envBlockPattern.test(config2)) {
31574
+ return config2.replace(envBlockPattern, () => envBlock);
31575
+ }
31576
+ const serverHeaderPattern = escapeRegExp(codexServerHeader(id));
31577
+ const serverBlockPattern = new RegExp(`([ \\t]*${serverHeaderPattern}[ \\t]*\\r?\\n[\\s\\S]*?)(?=\\r?\\n[ \\t]*\\[|\\s*$)`);
31578
+ let inserted = false;
31579
+ const updated = config2.replace(serverBlockPattern, (_match, serverBlock) => {
31580
+ inserted = true;
31581
+ return `${serverBlock}${envBlock}`;
31582
+ });
31583
+ return inserted ? updated : `${config2}${envBlock}`;
31584
+ }
31537
31585
  function installToClaude(entry) {
31538
31586
  try {
31539
31587
  const args = [
@@ -31561,16 +31609,15 @@ function installToCodex(entry) {
31561
31609
  if (!existsSync10(configDir)) {
31562
31610
  mkdirSync7(configDir, { recursive: true });
31563
31611
  }
31564
- const block = `
31565
- [mcp_servers.${entry.id}]
31566
- ` + `command = ${JSON.stringify(entry.command)}
31567
- ` + `args = [${entry.args.map((a) => JSON.stringify(a)).join(", ")}]
31568
- `;
31612
+ const env = assertAgentInstallEnv(entry);
31569
31613
  const existing = existsSync10(configPath) ? readFileSync5(configPath, "utf-8") : "";
31570
- if (existing.includes(`[mcp_servers.${entry.id}]`)) {
31614
+ if (existing.includes(codexServerHeader(entry.id))) {
31615
+ if (Object.keys(env).length > 0) {
31616
+ writeFileSync3(configPath, upsertCodexEnvBlock(existing, entry.id, env), "utf-8");
31617
+ }
31571
31618
  return { agent: "codex", success: true };
31572
31619
  }
31573
- writeFileSync3(configPath, existing + block, "utf-8");
31620
+ writeFileSync3(configPath, existing + formatCodexServerBlock(entry, env), "utf-8");
31574
31621
  return { agent: "codex", success: true };
31575
31622
  } catch (err) {
31576
31623
  return { agent: "codex", success: false, error: err.message };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mcps",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "Meta-MCP registry & CLI — discover, manage, and proxy MCP servers",
5
5
  "type": "module",
6
6
  "repository": {