@hasna/mcps 0.0.26 → 0.0.28

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
@@ -12743,6 +12743,40 @@ function normalizeCandidate(value) {
12743
12743
  const trimmed = value?.trim();
12744
12744
  return trimmed ? trimmed : undefined;
12745
12745
  }
12746
+ function normalizeServerTransport(value, fallback = "stdio") {
12747
+ if (value === undefined)
12748
+ return fallback;
12749
+ if (typeof value !== "string") {
12750
+ throw new Error("Invalid transport type");
12751
+ }
12752
+ const transport = value.trim();
12753
+ if (!transport) {
12754
+ throw new Error("Invalid transport type");
12755
+ }
12756
+ if (!VALID_TRANSPORTS.has(transport)) {
12757
+ throw new Error("Invalid transport type");
12758
+ }
12759
+ return transport;
12760
+ }
12761
+ function normalizeServerUrl(value) {
12762
+ if (value === null || value === undefined)
12763
+ return null;
12764
+ if (typeof value !== "string") {
12765
+ throw new Error("URL must be a valid HTTP(S) URL");
12766
+ }
12767
+ const trimmed = value.trim();
12768
+ if (!trimmed)
12769
+ return null;
12770
+ try {
12771
+ const parsed = new URL(trimmed);
12772
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
12773
+ throw new Error("unsupported protocol");
12774
+ }
12775
+ } catch {
12776
+ throw new Error("URL must be a valid HTTP(S) URL");
12777
+ }
12778
+ return trimmed;
12779
+ }
12746
12780
  function pickNameFromArgs(args) {
12747
12781
  if (!args || args.length === 0)
12748
12782
  return;
@@ -12784,9 +12818,11 @@ function addServer(opts) {
12784
12818
  if (!id) {
12785
12819
  throw new Error("Unable to generate a valid server ID");
12786
12820
  }
12821
+ const transport = normalizeServerTransport(opts.transport);
12822
+ const url = normalizeServerUrl(opts.url);
12787
12823
  const row = db2.prepare(`INSERT INTO servers (id, name, description, command, args, env, credential_refs, transport, url, source)
12788
12824
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
12789
- RETURNING *`).get(id, name, opts.description || null, command, JSON.stringify(opts.args || []), JSON.stringify(normalizeLiteralEnv(opts.env)), JSON.stringify(normalizeCredentialRefs(opts.credentialRefs)), opts.transport || "stdio", opts.url || null, opts.source || "local");
12825
+ RETURNING *`).get(id, name, opts.description || null, command, JSON.stringify(opts.args || []), JSON.stringify(normalizeLiteralEnv(opts.env)), JSON.stringify(normalizeCredentialRefs(opts.credentialRefs)), transport, url, opts.source || "local");
12790
12826
  return parseRow(row);
12791
12827
  }
12792
12828
  function removeServer(id) {
@@ -12807,9 +12843,21 @@ function updateServer(id, updates) {
12807
12843
  const db2 = getDb();
12808
12844
  const sets = [];
12809
12845
  const values = [];
12846
+ let nextTransport;
12847
+ let nextUrl;
12848
+ if (updates.transport !== undefined) {
12849
+ nextTransport = normalizeServerTransport(updates.transport);
12850
+ }
12851
+ if (updates.url !== undefined) {
12852
+ nextUrl = normalizeServerUrl(updates.url);
12853
+ }
12810
12854
  if (updates.name !== undefined) {
12855
+ const name = normalizeCandidate(updates.name);
12856
+ if (!name) {
12857
+ throw new Error("Name is required");
12858
+ }
12811
12859
  sets.push("name = ?");
12812
- values.push(updates.name);
12860
+ values.push(name);
12813
12861
  }
12814
12862
  if (updates.description !== undefined) {
12815
12863
  sets.push("description = ?");
@@ -12837,11 +12885,11 @@ function updateServer(id, updates) {
12837
12885
  }
12838
12886
  if (updates.transport !== undefined) {
12839
12887
  sets.push("transport = ?");
12840
- values.push(updates.transport);
12888
+ values.push(nextTransport);
12841
12889
  }
12842
12890
  if (updates.url !== undefined) {
12843
12891
  sets.push("url = ?");
12844
- values.push(updates.url);
12892
+ values.push(nextUrl ?? null);
12845
12893
  }
12846
12894
  if (updates.enabled !== undefined) {
12847
12895
  sets.push("enabled = ?");
@@ -12949,9 +12997,15 @@ function getCachedTools(serverId) {
12949
12997
  input_schema: safeJsonParse(r.input_schema, {})
12950
12998
  }));
12951
12999
  }
13000
+ var VALID_TRANSPORTS;
12952
13001
  var init_registry = __esm(() => {
12953
13002
  init_db();
12954
13003
  init_credentials();
13004
+ VALID_TRANSPORTS = new Set([
13005
+ "stdio",
13006
+ "sse",
13007
+ "streamable-http"
13008
+ ]);
12955
13009
  });
12956
13010
 
12957
13011
  // node_modules/zod/v3/helpers/util.js
@@ -34645,14 +34699,11 @@ function buildEnv(extra) {
34645
34699
  return merged;
34646
34700
  }
34647
34701
  function requireUrl(entry) {
34648
- if (!entry.url) {
34702
+ const url2 = normalizeServerUrl(entry.url);
34703
+ if (!url2) {
34649
34704
  throw new Error(`Server "${entry.id}" is missing a URL for ${entry.transport} transport`);
34650
34705
  }
34651
- try {
34652
- return new URL(entry.url);
34653
- } catch {
34654
- throw new Error(`Server "${entry.id}" has an invalid URL: ${entry.url}`);
34655
- }
34706
+ return new URL(url2);
34656
34707
  }
34657
34708
  async function connectToServer(entry, options = {}) {
34658
34709
  if (connections.has(entry.id)) {
@@ -34684,8 +34735,10 @@ async function connectToServer(entry, options = {}) {
34684
34735
  });
34685
34736
  } else if (entry.transport === "sse") {
34686
34737
  transport = new SSEClientTransport(requireUrl(entry));
34687
- } else {
34738
+ } else if (entry.transport === "streamable-http") {
34688
34739
  transport = new StreamableHTTPClientTransport(requireUrl(entry));
34740
+ } else {
34741
+ throw new Error(`Unsupported transport type for server "${entry.id}": ${entry.transport}`);
34689
34742
  }
34690
34743
  await client.connect(transport);
34691
34744
  const result = await client.listTools();
@@ -36450,7 +36503,7 @@ var init_provider_profiles = __esm(() => {
36450
36503
  var require_package = __commonJS((exports, module) => {
36451
36504
  module.exports = {
36452
36505
  name: "@hasna/mcps",
36453
- version: "0.0.26",
36506
+ version: "0.0.28",
36454
36507
  description: "Meta-MCP registry & CLI \u2014 discover, manage, and proxy MCP servers",
36455
36508
  type: "module",
36456
36509
  repository: {
@@ -42512,8 +42565,16 @@ Dashboard not found at: ${dashboardDir}`);
42512
42565
  return json({ error: "Invalid JSON body" }, 400, port);
42513
42566
  }
42514
42567
  const fields = {};
42515
- if (body.name !== undefined)
42516
- fields.name = body.name;
42568
+ if (body.name !== undefined) {
42569
+ if (typeof body.name !== "string") {
42570
+ return json({ error: "Invalid 'name' format" }, 400, port);
42571
+ }
42572
+ const name = body.name.trim();
42573
+ if (!name) {
42574
+ return json({ error: "Name is required" }, 400, port);
42575
+ }
42576
+ fields.name = name;
42577
+ }
42517
42578
  if (body.description !== undefined)
42518
42579
  fields.description = body.description;
42519
42580
  if (body.command !== undefined) {
@@ -45418,6 +45479,16 @@ program2.command("import").argument("<file>", "Path to the export JSON file").de
45418
45479
  }
45419
45480
  const literalEnv = normalizeLiteralEnv(s.env ?? {});
45420
45481
  const credentialRefs = normalizeCredentialRefs(s.credentialRefs ?? s.credential_refs ?? {});
45482
+ let transport;
45483
+ let url2;
45484
+ try {
45485
+ transport = normalizeServerTransport(s.transport);
45486
+ url2 = normalizeServerUrl(s.url);
45487
+ } catch (err) {
45488
+ console.error(chalk2.red(`Invalid server in import "${s.id ?? "(unknown)"}": ${err.message}`));
45489
+ closeDb();
45490
+ process.exit(1);
45491
+ }
45421
45492
  db2.run(`INSERT ${orReplace} INTO servers (id, name, description, command, args, env, credential_refs, transport, url, source, enabled, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)`, [
45422
45493
  s.id,
45423
45494
  s.name,
@@ -45426,8 +45497,8 @@ program2.command("import").argument("<file>", "Path to the export JSON file").de
45426
45497
  JSON.stringify(s.args ?? []),
45427
45498
  JSON.stringify(literalEnv),
45428
45499
  JSON.stringify(credentialRefs),
45429
- s.transport,
45430
- s.url,
45500
+ transport,
45501
+ url2,
45431
45502
  s.source,
45432
45503
  s.enabled ? 1 : 0,
45433
45504
  s.created_at,
package/bin/mcp.js CHANGED
@@ -30759,6 +30759,40 @@ function normalizeCandidate(value) {
30759
30759
  const trimmed = value?.trim();
30760
30760
  return trimmed ? trimmed : undefined;
30761
30761
  }
30762
+ function normalizeServerTransport(value, fallback = "stdio") {
30763
+ if (value === undefined)
30764
+ return fallback;
30765
+ if (typeof value !== "string") {
30766
+ throw new Error("Invalid transport type");
30767
+ }
30768
+ const transport = value.trim();
30769
+ if (!transport) {
30770
+ throw new Error("Invalid transport type");
30771
+ }
30772
+ if (!VALID_TRANSPORTS.has(transport)) {
30773
+ throw new Error("Invalid transport type");
30774
+ }
30775
+ return transport;
30776
+ }
30777
+ function normalizeServerUrl(value) {
30778
+ if (value === null || value === undefined)
30779
+ return null;
30780
+ if (typeof value !== "string") {
30781
+ throw new Error("URL must be a valid HTTP(S) URL");
30782
+ }
30783
+ const trimmed = value.trim();
30784
+ if (!trimmed)
30785
+ return null;
30786
+ try {
30787
+ const parsed = new URL(trimmed);
30788
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
30789
+ throw new Error("unsupported protocol");
30790
+ }
30791
+ } catch {
30792
+ throw new Error("URL must be a valid HTTP(S) URL");
30793
+ }
30794
+ return trimmed;
30795
+ }
30762
30796
  function pickNameFromArgs(args) {
30763
30797
  if (!args || args.length === 0)
30764
30798
  return;
@@ -30800,9 +30834,11 @@ function addServer(opts) {
30800
30834
  if (!id) {
30801
30835
  throw new Error("Unable to generate a valid server ID");
30802
30836
  }
30837
+ const transport = normalizeServerTransport(opts.transport);
30838
+ const url2 = normalizeServerUrl(opts.url);
30803
30839
  const row = db2.prepare(`INSERT INTO servers (id, name, description, command, args, env, credential_refs, transport, url, source)
30804
30840
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
30805
- RETURNING *`).get(id, name, opts.description || null, command, JSON.stringify(opts.args || []), JSON.stringify(normalizeLiteralEnv(opts.env)), JSON.stringify(normalizeCredentialRefs(opts.credentialRefs)), opts.transport || "stdio", opts.url || null, opts.source || "local");
30841
+ RETURNING *`).get(id, name, opts.description || null, command, JSON.stringify(opts.args || []), JSON.stringify(normalizeLiteralEnv(opts.env)), JSON.stringify(normalizeCredentialRefs(opts.credentialRefs)), transport, url2, opts.source || "local");
30806
30842
  return parseRow(row);
30807
30843
  }
30808
30844
  function removeServer(id) {
@@ -30823,9 +30859,21 @@ function updateServer(id, updates) {
30823
30859
  const db2 = getDb();
30824
30860
  const sets = [];
30825
30861
  const values = [];
30862
+ let nextTransport;
30863
+ let nextUrl;
30864
+ if (updates.transport !== undefined) {
30865
+ nextTransport = normalizeServerTransport(updates.transport);
30866
+ }
30867
+ if (updates.url !== undefined) {
30868
+ nextUrl = normalizeServerUrl(updates.url);
30869
+ }
30826
30870
  if (updates.name !== undefined) {
30871
+ const name = normalizeCandidate(updates.name);
30872
+ if (!name) {
30873
+ throw new Error("Name is required");
30874
+ }
30827
30875
  sets.push("name = ?");
30828
- values.push(updates.name);
30876
+ values.push(name);
30829
30877
  }
30830
30878
  if (updates.description !== undefined) {
30831
30879
  sets.push("description = ?");
@@ -30853,11 +30901,11 @@ function updateServer(id, updates) {
30853
30901
  }
30854
30902
  if (updates.transport !== undefined) {
30855
30903
  sets.push("transport = ?");
30856
- values.push(updates.transport);
30904
+ values.push(nextTransport);
30857
30905
  }
30858
30906
  if (updates.url !== undefined) {
30859
30907
  sets.push("url = ?");
30860
- values.push(updates.url);
30908
+ values.push(nextUrl ?? null);
30861
30909
  }
30862
30910
  if (updates.enabled !== undefined) {
30863
30911
  sets.push("enabled = ?");
@@ -30910,9 +30958,15 @@ function getCachedTools(serverId) {
30910
30958
  input_schema: safeJsonParse(r.input_schema, {})
30911
30959
  }));
30912
30960
  }
30961
+ var VALID_TRANSPORTS;
30913
30962
  var init_registry = __esm(() => {
30914
30963
  init_db();
30915
30964
  init_credentials();
30965
+ VALID_TRANSPORTS = new Set([
30966
+ "stdio",
30967
+ "sse",
30968
+ "streamable-http"
30969
+ ]);
30916
30970
  });
30917
30971
 
30918
30972
  // src/lib/local-command-consent.ts
@@ -34448,14 +34502,11 @@ function buildEnv(extra) {
34448
34502
  return merged;
34449
34503
  }
34450
34504
  function requireUrl(entry) {
34451
- if (!entry.url) {
34505
+ const url2 = normalizeServerUrl(entry.url);
34506
+ if (!url2) {
34452
34507
  throw new Error(`Server "${entry.id}" is missing a URL for ${entry.transport} transport`);
34453
34508
  }
34454
- try {
34455
- return new URL(entry.url);
34456
- } catch {
34457
- throw new Error(`Server "${entry.id}" has an invalid URL: ${entry.url}`);
34458
- }
34509
+ return new URL(url2);
34459
34510
  }
34460
34511
  async function connectToServer(entry, options = {}) {
34461
34512
  if (connections.has(entry.id)) {
@@ -34487,8 +34538,10 @@ async function connectToServer(entry, options = {}) {
34487
34538
  });
34488
34539
  } else if (entry.transport === "sse") {
34489
34540
  transport = new SSEClientTransport(requireUrl(entry));
34490
- } else {
34541
+ } else if (entry.transport === "streamable-http") {
34491
34542
  transport = new StreamableHTTPClientTransport(requireUrl(entry));
34543
+ } else {
34544
+ throw new Error(`Unsupported transport type for server "${entry.id}": ${entry.transport}`);
34492
34545
  }
34493
34546
  await client.connect(transport);
34494
34547
  const result = await client.listTools();
package/dist/index.js CHANGED
@@ -17441,6 +17441,11 @@ function credentialRefPlaceholders(refs) {
17441
17441
  }
17442
17442
 
17443
17443
  // src/lib/registry.ts
17444
+ var VALID_TRANSPORTS = new Set([
17445
+ "stdio",
17446
+ "sse",
17447
+ "streamable-http"
17448
+ ]);
17444
17449
  function parseRow(row) {
17445
17450
  return {
17446
17451
  id: row.id,
@@ -17476,6 +17481,40 @@ function normalizeCandidate(value) {
17476
17481
  const trimmed = value?.trim();
17477
17482
  return trimmed ? trimmed : undefined;
17478
17483
  }
17484
+ function normalizeServerTransport(value, fallback = "stdio") {
17485
+ if (value === undefined)
17486
+ return fallback;
17487
+ if (typeof value !== "string") {
17488
+ throw new Error("Invalid transport type");
17489
+ }
17490
+ const transport = value.trim();
17491
+ if (!transport) {
17492
+ throw new Error("Invalid transport type");
17493
+ }
17494
+ if (!VALID_TRANSPORTS.has(transport)) {
17495
+ throw new Error("Invalid transport type");
17496
+ }
17497
+ return transport;
17498
+ }
17499
+ function normalizeServerUrl(value) {
17500
+ if (value === null || value === undefined)
17501
+ return null;
17502
+ if (typeof value !== "string") {
17503
+ throw new Error("URL must be a valid HTTP(S) URL");
17504
+ }
17505
+ const trimmed = value.trim();
17506
+ if (!trimmed)
17507
+ return null;
17508
+ try {
17509
+ const parsed = new URL(trimmed);
17510
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
17511
+ throw new Error("unsupported protocol");
17512
+ }
17513
+ } catch {
17514
+ throw new Error("URL must be a valid HTTP(S) URL");
17515
+ }
17516
+ return trimmed;
17517
+ }
17479
17518
  function pickNameFromArgs(args) {
17480
17519
  if (!args || args.length === 0)
17481
17520
  return;
@@ -17517,9 +17556,11 @@ function addServer(opts) {
17517
17556
  if (!id) {
17518
17557
  throw new Error("Unable to generate a valid server ID");
17519
17558
  }
17559
+ const transport = normalizeServerTransport(opts.transport);
17560
+ const url = normalizeServerUrl(opts.url);
17520
17561
  const row = db2.prepare(`INSERT INTO servers (id, name, description, command, args, env, credential_refs, transport, url, source)
17521
17562
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
17522
- RETURNING *`).get(id, name, opts.description || null, command, JSON.stringify(opts.args || []), JSON.stringify(normalizeLiteralEnv(opts.env)), JSON.stringify(normalizeCredentialRefs(opts.credentialRefs)), opts.transport || "stdio", opts.url || null, opts.source || "local");
17563
+ RETURNING *`).get(id, name, opts.description || null, command, JSON.stringify(opts.args || []), JSON.stringify(normalizeLiteralEnv(opts.env)), JSON.stringify(normalizeCredentialRefs(opts.credentialRefs)), transport, url, opts.source || "local");
17523
17564
  return parseRow(row);
17524
17565
  }
17525
17566
  function removeServer(id) {
@@ -17540,9 +17581,21 @@ function updateServer(id, updates) {
17540
17581
  const db2 = getDb();
17541
17582
  const sets = [];
17542
17583
  const values = [];
17584
+ let nextTransport;
17585
+ let nextUrl;
17586
+ if (updates.transport !== undefined) {
17587
+ nextTransport = normalizeServerTransport(updates.transport);
17588
+ }
17589
+ if (updates.url !== undefined) {
17590
+ nextUrl = normalizeServerUrl(updates.url);
17591
+ }
17543
17592
  if (updates.name !== undefined) {
17593
+ const name = normalizeCandidate(updates.name);
17594
+ if (!name) {
17595
+ throw new Error("Name is required");
17596
+ }
17544
17597
  sets.push("name = ?");
17545
- values.push(updates.name);
17598
+ values.push(name);
17546
17599
  }
17547
17600
  if (updates.description !== undefined) {
17548
17601
  sets.push("description = ?");
@@ -17570,11 +17623,11 @@ function updateServer(id, updates) {
17570
17623
  }
17571
17624
  if (updates.transport !== undefined) {
17572
17625
  sets.push("transport = ?");
17573
- values.push(updates.transport);
17626
+ values.push(nextTransport);
17574
17627
  }
17575
17628
  if (updates.url !== undefined) {
17576
17629
  sets.push("url = ?");
17577
- values.push(updates.url);
17630
+ values.push(nextUrl ?? null);
17578
17631
  }
17579
17632
  if (updates.enabled !== undefined) {
17580
17633
  sets.push("enabled = ?");
@@ -25994,14 +26047,11 @@ function buildEnv(extra) {
25994
26047
  return merged;
25995
26048
  }
25996
26049
  function requireUrl(entry) {
25997
- if (!entry.url) {
26050
+ const url2 = normalizeServerUrl(entry.url);
26051
+ if (!url2) {
25998
26052
  throw new Error(`Server "${entry.id}" is missing a URL for ${entry.transport} transport`);
25999
26053
  }
26000
- try {
26001
- return new URL(entry.url);
26002
- } catch {
26003
- throw new Error(`Server "${entry.id}" has an invalid URL: ${entry.url}`);
26004
- }
26054
+ return new URL(url2);
26005
26055
  }
26006
26056
  async function connectToServer(entry, options = {}) {
26007
26057
  if (connections.has(entry.id)) {
@@ -26033,8 +26083,10 @@ async function connectToServer(entry, options = {}) {
26033
26083
  });
26034
26084
  } else if (entry.transport === "sse") {
26035
26085
  transport = new SSEClientTransport(requireUrl(entry));
26036
- } else {
26086
+ } else if (entry.transport === "streamable-http") {
26037
26087
  transport = new StreamableHTTPClientTransport(requireUrl(entry));
26088
+ } else {
26089
+ throw new Error(`Unsupported transport type for server "${entry.id}": ${entry.transport}`);
26038
26090
  }
26039
26091
  await client.connect(transport);
26040
26092
  const result = await client.listTools();
@@ -1,4 +1,7 @@
1
1
  import type { CredentialReference, McpServerEntry, AddServerOptions } from "../types.js";
2
+ export declare const VALID_TRANSPORTS: Set<"stdio" | "sse" | "streamable-http">;
3
+ export declare function normalizeServerTransport(value: unknown, fallback?: McpServerEntry["transport"]): McpServerEntry["transport"];
4
+ export declare function normalizeServerUrl(value: unknown): string | null;
2
5
  export declare function addServer(opts: AddServerOptions): McpServerEntry;
3
6
  export declare function removeServer(id: string): void;
4
7
  export declare function listServers(): McpServerEntry[];
package/dist/mcp/index.js CHANGED
@@ -30759,6 +30759,40 @@ function normalizeCandidate(value) {
30759
30759
  const trimmed = value?.trim();
30760
30760
  return trimmed ? trimmed : undefined;
30761
30761
  }
30762
+ function normalizeServerTransport(value, fallback = "stdio") {
30763
+ if (value === undefined)
30764
+ return fallback;
30765
+ if (typeof value !== "string") {
30766
+ throw new Error("Invalid transport type");
30767
+ }
30768
+ const transport = value.trim();
30769
+ if (!transport) {
30770
+ throw new Error("Invalid transport type");
30771
+ }
30772
+ if (!VALID_TRANSPORTS.has(transport)) {
30773
+ throw new Error("Invalid transport type");
30774
+ }
30775
+ return transport;
30776
+ }
30777
+ function normalizeServerUrl(value) {
30778
+ if (value === null || value === undefined)
30779
+ return null;
30780
+ if (typeof value !== "string") {
30781
+ throw new Error("URL must be a valid HTTP(S) URL");
30782
+ }
30783
+ const trimmed = value.trim();
30784
+ if (!trimmed)
30785
+ return null;
30786
+ try {
30787
+ const parsed = new URL(trimmed);
30788
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
30789
+ throw new Error("unsupported protocol");
30790
+ }
30791
+ } catch {
30792
+ throw new Error("URL must be a valid HTTP(S) URL");
30793
+ }
30794
+ return trimmed;
30795
+ }
30762
30796
  function pickNameFromArgs(args) {
30763
30797
  if (!args || args.length === 0)
30764
30798
  return;
@@ -30800,9 +30834,11 @@ function addServer(opts) {
30800
30834
  if (!id) {
30801
30835
  throw new Error("Unable to generate a valid server ID");
30802
30836
  }
30837
+ const transport = normalizeServerTransport(opts.transport);
30838
+ const url2 = normalizeServerUrl(opts.url);
30803
30839
  const row = db2.prepare(`INSERT INTO servers (id, name, description, command, args, env, credential_refs, transport, url, source)
30804
30840
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
30805
- RETURNING *`).get(id, name, opts.description || null, command, JSON.stringify(opts.args || []), JSON.stringify(normalizeLiteralEnv(opts.env)), JSON.stringify(normalizeCredentialRefs(opts.credentialRefs)), opts.transport || "stdio", opts.url || null, opts.source || "local");
30841
+ RETURNING *`).get(id, name, opts.description || null, command, JSON.stringify(opts.args || []), JSON.stringify(normalizeLiteralEnv(opts.env)), JSON.stringify(normalizeCredentialRefs(opts.credentialRefs)), transport, url2, opts.source || "local");
30806
30842
  return parseRow(row);
30807
30843
  }
30808
30844
  function removeServer(id) {
@@ -30823,9 +30859,21 @@ function updateServer(id, updates) {
30823
30859
  const db2 = getDb();
30824
30860
  const sets = [];
30825
30861
  const values = [];
30862
+ let nextTransport;
30863
+ let nextUrl;
30864
+ if (updates.transport !== undefined) {
30865
+ nextTransport = normalizeServerTransport(updates.transport);
30866
+ }
30867
+ if (updates.url !== undefined) {
30868
+ nextUrl = normalizeServerUrl(updates.url);
30869
+ }
30826
30870
  if (updates.name !== undefined) {
30871
+ const name = normalizeCandidate(updates.name);
30872
+ if (!name) {
30873
+ throw new Error("Name is required");
30874
+ }
30827
30875
  sets.push("name = ?");
30828
- values.push(updates.name);
30876
+ values.push(name);
30829
30877
  }
30830
30878
  if (updates.description !== undefined) {
30831
30879
  sets.push("description = ?");
@@ -30853,11 +30901,11 @@ function updateServer(id, updates) {
30853
30901
  }
30854
30902
  if (updates.transport !== undefined) {
30855
30903
  sets.push("transport = ?");
30856
- values.push(updates.transport);
30904
+ values.push(nextTransport);
30857
30905
  }
30858
30906
  if (updates.url !== undefined) {
30859
30907
  sets.push("url = ?");
30860
- values.push(updates.url);
30908
+ values.push(nextUrl ?? null);
30861
30909
  }
30862
30910
  if (updates.enabled !== undefined) {
30863
30911
  sets.push("enabled = ?");
@@ -30910,9 +30958,15 @@ function getCachedTools(serverId) {
30910
30958
  input_schema: safeJsonParse(r.input_schema, {})
30911
30959
  }));
30912
30960
  }
30961
+ var VALID_TRANSPORTS;
30913
30962
  var init_registry = __esm(() => {
30914
30963
  init_db();
30915
30964
  init_credentials();
30965
+ VALID_TRANSPORTS = new Set([
30966
+ "stdio",
30967
+ "sse",
30968
+ "streamable-http"
30969
+ ]);
30916
30970
  });
30917
30971
 
30918
30972
  // src/lib/local-command-consent.ts
@@ -34448,14 +34502,11 @@ function buildEnv(extra) {
34448
34502
  return merged;
34449
34503
  }
34450
34504
  function requireUrl(entry) {
34451
- if (!entry.url) {
34505
+ const url2 = normalizeServerUrl(entry.url);
34506
+ if (!url2) {
34452
34507
  throw new Error(`Server "${entry.id}" is missing a URL for ${entry.transport} transport`);
34453
34508
  }
34454
- try {
34455
- return new URL(entry.url);
34456
- } catch {
34457
- throw new Error(`Server "${entry.id}" has an invalid URL: ${entry.url}`);
34458
- }
34509
+ return new URL(url2);
34459
34510
  }
34460
34511
  async function connectToServer(entry, options = {}) {
34461
34512
  if (connections.has(entry.id)) {
@@ -34487,8 +34538,10 @@ async function connectToServer(entry, options = {}) {
34487
34538
  });
34488
34539
  } else if (entry.transport === "sse") {
34489
34540
  transport = new SSEClientTransport(requireUrl(entry));
34490
- } else {
34541
+ } else if (entry.transport === "streamable-http") {
34491
34542
  transport = new StreamableHTTPClientTransport(requireUrl(entry));
34543
+ } else {
34544
+ throw new Error(`Unsupported transport type for server "${entry.id}": ${entry.transport}`);
34492
34545
  }
34493
34546
  await client.connect(transport);
34494
34547
  const result = await client.listTools();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mcps",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "Meta-MCP registry & CLI — discover, manage, and proxy MCP servers",
5
5
  "type": "module",
6
6
  "repository": {