@vincemakes/kiso-mcp-ext 0.44.0 → 0.45.1

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/README.md CHANGED
@@ -17,6 +17,11 @@ Servers live in `~/.kiso/mcp.json` (or the project-level `.kiso/mcp.json`
17
17
  after the trust gate) — see the kiso README. There is nothing to import;
18
18
  the extension reads the config at startup and connects in the background.
19
19
 
20
+ A host passes the servers instead: `createMcpExtension({ servers })`, the
21
+ same `mcpServers` map. Then no config file is read and the tool cache is
22
+ not used (it is keyed by server name alone and shared with the CLI), so a
23
+ supplied server's tools appear once it connects.
24
+
20
25
  ## Versioning
21
26
 
22
27
  The version counter is this package's own. It is pinned exactly by the kiso
package/dist/kiso-mcp.mjs CHANGED
@@ -18323,12 +18323,13 @@ function kisoHome() {
18323
18323
  return process.env.KISO_HOME ?? join(homedir(), ".kiso");
18324
18324
  }
18325
18325
  function createMcpExtension(opts = {}) {
18326
- const config2 = readConfig(process.env.KISO_MCP_CONFIG ?? join(kisoHome(), "mcp.json"));
18326
+ const hostServers = opts.servers !== void 0;
18327
+ const config2 = hostServers ? { mcpServers: checkServers(opts.servers, "options.servers must be an object map of server name to config") } : readConfig(process.env.KISO_MCP_CONFIG ?? join(kisoHome(), "mcp.json"));
18327
18328
  const status = [];
18328
18329
  const tools = [];
18329
18330
  const clients = [];
18330
18331
  let connecting = false;
18331
- const cache = readToolCache(kisoHome());
18332
+ const cache = hostServers ? {} : readToolCache(kisoHome());
18332
18333
  const entries = Object.entries(config2.mcpServers ?? {}).filter(([, server]) => server.disabled !== true);
18333
18334
  if (entries.length > 0) {
18334
18335
  tools.push(statusTool(status));
@@ -18357,15 +18358,17 @@ function createMcpExtension(opts = {}) {
18357
18358
  if (tools[i].name.startsWith(`mcp__${name}__`)) tools.splice(i, 1);
18358
18359
  }
18359
18360
  tools.push(...mapped);
18360
- writeToolCache(
18361
- kisoHome(),
18362
- name,
18363
- mapped.map((t) => ({
18364
- name: t.name.slice(`mcp__${name}__`.length),
18365
- description: t.description,
18366
- inputSchema: t.parameters
18367
- }))
18368
- );
18361
+ if (!hostServers) {
18362
+ writeToolCache(
18363
+ kisoHome(),
18364
+ name,
18365
+ mapped.map((t) => ({
18366
+ name: t.name.slice(`mcp__${name}__`.length),
18367
+ description: t.description,
18368
+ inputSchema: t.parameters
18369
+ }))
18370
+ );
18371
+ }
18369
18372
  },
18370
18373
  (err) => {
18371
18374
  const e = err;
@@ -18451,7 +18454,16 @@ function readConfig(path) {
18451
18454
  throw new Error(`[mcp] ${path} must be an object with an mcpServers map`);
18452
18455
  }
18453
18456
  const cfg = parsed;
18454
- for (const [name, server] of Object.entries(cfg.mcpServers ?? {})) {
18457
+ checkEntries(cfg.mcpServers ?? {});
18458
+ return cfg;
18459
+ }
18460
+ function checkServers(servers, notAMap) {
18461
+ if (typeof servers !== "object" || servers === null || Array.isArray(servers)) throw new Error(`[mcp] ${notAMap}`);
18462
+ checkEntries(servers);
18463
+ return servers;
18464
+ }
18465
+ function checkEntries(servers) {
18466
+ for (const [name, server] of Object.entries(servers)) {
18455
18467
  if (typeof server !== "object" || server === null || Array.isArray(server)) {
18456
18468
  throw new Error(`[mcp] server "${name}" must be an object`);
18457
18469
  }
@@ -18459,7 +18471,6 @@ function readConfig(path) {
18459
18471
  throw new Error(`[mcp] server "${name}" needs a command (stdio) or a url`);
18460
18472
  }
18461
18473
  }
18462
- return cfg;
18463
18474
  }
18464
18475
  async function connectServer(name, cfg, clients, secretEnvNames = []) {
18465
18476
  const client = new Client({ name: "kiso-mcp", version: "0.1.7" });
package/index.d.ts CHANGED
@@ -11,8 +11,26 @@ import type { KisoExtension } from "@vincemakes/kiso-core";
11
11
  * authenticate with. Only the host's config knows them, so the host
12
12
  * declares them; every stdio child is spawned without them. Omitted (a
13
13
  * standalone extension load) = the exact-list and suffix rules alone. */
14
+ /** One server, in the mcp.json `mcpServers` shape: a stdio `command`
15
+ * (with `args`, `env`, `cwd`) or a remote `url` (with `headers`). */
16
+ export interface McpServerConfig {
17
+ readonly command?: string;
18
+ readonly args?: readonly string[];
19
+ readonly env?: Readonly<Record<string, string>>;
20
+ readonly cwd?: string;
21
+ readonly url?: string;
22
+ readonly headers?: Readonly<Record<string, string>>;
23
+ readonly disabled?: boolean;
24
+ }
25
+
14
26
  export interface McpExtensionOptions {
15
27
  readonly secretEnvNames?: readonly string[];
28
+ /** For a host: the servers, keyed by name as in mcp.json. Given (even
29
+ * `{}`), no config file is read ($KISO_MCP_CONFIG and $KISO_HOME/mcp.json
30
+ * are ignored), every entry is validated as a file entry is, and the
31
+ * tool cache is neither read nor written, so a supplied server's tools
32
+ * register when its connect settles. Omitted = the config file, as today. */
33
+ readonly servers?: Readonly<Record<string, McpServerConfig>>;
16
34
  }
17
35
 
18
36
  declare const createMcpExtension: (opts?: McpExtensionOptions) => KisoExtension | Promise<KisoExtension>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-mcp-ext",
3
- "version": "0.44.0",
3
+ "version": "0.45.1",
4
4
  "description": "kiso official MCP bridge extension \u2014 MCP servers become mcp__ tools, kernel untouched",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@modelcontextprotocol/sdk": "^1.0.0",
27
- "@vincemakes/kiso-core": "0.44.0",
28
- "@vincemakes/kiso-tools-node": "0.44.0",
27
+ "@vincemakes/kiso-core": "0.45.1",
28
+ "@vincemakes/kiso-tools-node": "0.45.1",
29
29
  "@types/node": "^26.1.2",
30
30
  "esbuild": "^0.24.0",
31
31
  "typescript": "^5.7.2",