From fc032c7e95d920c89e4d9513bc714da606956dac Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Thu, 12 Nov 2026 09:50:56 -0800 Subject: [PATCH 1/4] feat(agent-vault): take allowedTools on a session's MCP servers An MCP server sent with a session can now be limited to some of its tools (Infisical/infisical#9418). AgentVaultInlineMcpServiceInput takes allowedTools, AgentVaultInlineMcpService returns it, and the sessions.create docs no longer say inline MCP servers can't be limited. Co-Authored-By: Claude Opus 5.5 --- sink/agent-vault.test.ts | 31 +++++++++++++++++++++++++++++++ src/api/types/agent-vault.ts | 17 ++++++++++++++--- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/sink/agent-vault.test.ts b/sink/agent-vault.test.ts index 1cefccc..1f9c603 100644 --- a/sink/agent-vault.test.ts +++ b/sink/agent-vault.test.ts @@ -686,6 +686,37 @@ describe("agent vault inline services", () => { expect(lastRequest().body).toEqual({ projectId: PROJECT_ID, services }); }); + it("create sends an MCP server's tool list and reads it back", async () => { + const services: AgentVaultInlineServiceInput[] = [ + { + type: "mcp", + name: "deepwiki", + serverUrl: "https://mcp.deepwiki.com/mcp", + transport: "streamable-http", + credential: { type: "bearer", value: "mcp-token" }, + allowedTools: ["read_wiki_structure"] + } + ]; + const inline = { + id: INLINE_SERVICE.id, + name: "deepwiki", + description: null, + type: "mcp", + serverUrl: "https://mcp.deepwiki.com/mcp", + transport: "streamable-http", + hostPattern: "mcp.deepwiki.com", + allowedTools: ["read_wiki_structure"], + credential: { type: "bearer", headerName: "Authorization", headerPrefix: "Bearer" }, + customHeaders: [] + }; + respondWith({ session: { ...CREATED_SESSION, accessBundle: null, services: [inline] } }); + const created = await agentVault.sessions.create({ ...PROJECT, services }); + expect(lastRequest().body).toEqual({ projectId: PROJECT_ID, services }); + const [service] = created.services; + if (service.type !== "mcp") throw new Error("service was not narrowed"); + expect(service.allowedTools).toEqual(["read_wiki_structure"]); + }); + it("create sends an access bundle and services together", async () => { respondWith({ session: { ...CREATED_SESSION, services: [INLINE_SERVICE] } }); await agentVault.sessions.create({ ...PROJECT, accessBundle: "release", services: [INLINE_SERVICE_INPUT] }); diff --git a/src/api/types/agent-vault.ts b/src/api/types/agent-vault.ts index 04c1ce5..fc14a9c 100644 --- a/src/api/types/agent-vault.ts +++ b/src/api/types/agent-vault.ts @@ -204,6 +204,13 @@ export interface AgentVaultInlineMcpServiceInput { serverUrl: string; transport: AgentVaultMcpTransport; credential: AgentVaultInlineBearerCredential; + /** + * The MCP tools that agents can call through the service, by exact, case-sensitive name: 1 to 100 names, each 1 to + * 128 letters, numbers, underscores, hyphens or dots. The proxy refuses a call to any other tool and leaves it out + * of the server's tool list. Leave it out, or send null, to allow every tool. Needs an Infisical version that + * accepts a tool list on a session's services; an older one refuses the session. + */ + allowedTools?: string[] | null; /** Up to 20. */ customHeaders?: AgentVaultInlineCustomHeader[]; } @@ -324,6 +331,11 @@ export interface AgentVaultInlineMcpService extends AgentVaultInlineServiceBase serverUrl: string; transport: AgentVaultMcpTransport; hostPattern: string; + /** + * The MCP tools that agents can call through the service, or null for every tool. Undefined from an Infisical + * version that doesn't return it. + */ + allowedTools?: string[] | null; credential: AgentVaultInlineBearerCredentialSummary; customHeaders: AgentVaultInlineCustomHeaderSummary[]; } @@ -872,9 +884,8 @@ export type CreateAgentVaultSessionOptions = { /** * Services the session carries itself, instead of or beside its access bundle's: up to 20. Only Agent Vault admins * can send them. Each has the same fields as a service in an access bundle, except that its name is optional for - * HTTP and MCP services (database and SSH services need one), its values can't use variables, it can't use OAuth - * or member-provided values, and an MCP server can't be limited to some of its tools. To limit an MCP server's - * tools, add it to an access bundle instead. + * HTTP and MCP services (database and SSH services need one), its values can't use variables, and it can't use + * OAuth or member-provided values. */ services?: AgentVaultInlineServiceInput[]; /** How long the session lasts: a duration such as "30m", "8h" or "7d" (at least 1m), or "never". Defaults to "7d", or to "1h" for a session on behalf of a user. */ From 5ed6504c5d0041207f75a3094a670077626e3580 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Thu, 12 Nov 2026 09:56:17 -0800 Subject: [PATCH 2/4] test: type-check the sink tests in npm test Vitest ran the tests without checking their types, and the build's tsconfig leaves sink out, so a type regression in the SDK's public types left every test green. npm test now type-checks sink/**/*.test.ts with tsconfig.test.json, which targets ES2022 like the build so Error.cause and AggregateError resolve. Drops the "tsc" devDependency: that npm package is a placeholder whose tsc binary only prints "install typescript", and it shadowed the tsc from the typescript dependency that Vitest's type check runs. Co-Authored-By: Claude Opus 5.5 --- package-lock.json | 11 ----------- package.json | 1 - tsconfig.test.json | 13 +++++++++++++ vitest.config.ts | 6 ++++++ 4 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 tsconfig.test.json diff --git a/package-lock.json b/package-lock.json index 8537494..7a46612 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,6 @@ }, "devDependencies": { "@types/node": "^22.5.1", - "tsc": "^2.0.4", "tsup": "^8.2.4", "vitest": "^2.1.9" }, @@ -3568,16 +3567,6 @@ "dev": true, "license": "Apache-2.0" }, - "node_modules/tsc": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/tsc/-/tsc-2.0.4.tgz", - "integrity": "sha512-fzoSieZI5KKJVBYGvwbVZs/J5za84f2lSTLPYf6AGiIf43tZ3GNrI1QzTLcjtyDDP4aLxd46RTZq1nQxe7+k5Q==", - "dev": true, - "license": "MIT", - "bin": { - "tsc": "bin/tsc" - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", diff --git a/package.json b/package.json index ffa7987..d56bf11 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "description": "The Infisical SDK provides a convenient way to programmatically interact with the Infisical API.", "devDependencies": { "@types/node": "^22.5.1", - "tsc": "^2.0.4", "tsup": "^8.2.4", "vitest": "^2.1.9" }, diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..d3d4cea --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "es2022", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "noEmit": true, + "types": ["node"] + }, + "include": ["sink/**/*.test.ts"] +} diff --git a/vitest.config.ts b/vitest.config.ts index 429cb41..c46e64d 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,5 +4,11 @@ export default defineConfig({ test: { environment: "node", include: ["sink/**/*.test.ts"], + // The build's tsconfig leaves sink out, so this is the only check that the tests compile against the SDK's types. + typecheck: { + enabled: true, + include: ["sink/**/*.test.ts"], + tsconfig: "./tsconfig.test.json", + }, }, }); From fc5137dcef4cacc941a2ae83edf1933f23e4327a Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Thu, 12 Nov 2026 16:41:37 -0800 Subject: [PATCH 3/4] docs(agent-vault): drop the tool count from allowedTools The count was wrong (the server allows 500, not 100), and the server's own error names the limit, so the SDK doc no longer states one that can go stale. Co-Authored-By: Claude Opus 5.5 --- src/api/types/agent-vault.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/types/agent-vault.ts b/src/api/types/agent-vault.ts index fc14a9c..7a5ba14 100644 --- a/src/api/types/agent-vault.ts +++ b/src/api/types/agent-vault.ts @@ -205,9 +205,9 @@ export interface AgentVaultInlineMcpServiceInput { transport: AgentVaultMcpTransport; credential: AgentVaultInlineBearerCredential; /** - * The MCP tools that agents can call through the service, by exact, case-sensitive name: 1 to 100 names, each 1 to - * 128 letters, numbers, underscores, hyphens or dots. The proxy refuses a call to any other tool and leaves it out - * of the server's tool list. Leave it out, or send null, to allow every tool. Needs an Infisical version that + * The MCP tools that agents can call through the service, by exact, case-sensitive name: each 1 to 128 letters, + * numbers, underscores, hyphens or dots. The proxy refuses a call to any other tool and leaves it out of the + * server's tool list. Leave it out, or send null, to allow every tool. Needs an Infisical version that * accepts a tool list on a session's services; an older one refuses the session. */ allowedTools?: string[] | null; From 5413e9c7a0283fb623d2c915f89eb026d4240474 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Thu, 12 Nov 2026 16:42:37 -0800 Subject: [PATCH 4/4] ci: run the tests and build on pull requests The repo only had release.yml, so npm test never ran on a pull request. This runs npm ci, npm test and npm run build on every pull request and on pushes to main, on the same Node version and pinned actions as the release workflow. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e87bd85 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +jobs: + test: + name: Test and build + runs-on: ubuntu-22.04 + steps: + - name: Checkout repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Setup Node + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + with: + node-version: "24.14.0" + cache: "npm" + cache-dependency-path: ./package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + - name: Build + run: npm run build