Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
31 changes: 31 additions & 0 deletions sink/agent-vault.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
{
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] });
Expand Down
17 changes: 14 additions & 3 deletions src/api/types/agent-vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: 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[];
}
Expand Down Expand Up @@ -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[];
}
Expand Down Expand Up @@ -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. */
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -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"]
}
6 changes: 6 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Comment thread
scott-ray-wilson marked this conversation as resolved.
Resolved
enabled: true,
include: ["sink/**/*.test.ts"],
tsconfig: "./tsconfig.test.json",
},
},
});
Loading