Skip to content

Commit 006f0b3

Browse files
authored
fix baseURL typo (#15)
1 parent eef8eec commit 006f0b3

File tree

8 files changed

+68
-42
lines changed

8 files changed

+68
-42
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
},
7272
"dependencies": {
7373
"@alcyone-labs/zod-to-json-schema": "4.0.10",
74-
"@iterable/api": "0.3.0",
74+
"@iterable/api": "0.4.0",
7575
"@modelcontextprotocol/sdk": "1.18.1",
7676
"@primno/dpapi": "^2.0.1",
7777
"@types/json-schema": "7.0.15",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export interface McpServerConfig {
1414
readonly allowWrites: boolean;
1515
/** If false, exclude tools that can send messages (campaign/journey/event-triggered sends) */
1616
readonly allowSends: boolean;
17-
/** The active Iterable API key (optional for tests) */
18-
readonly apiKey?: string;
19-
/** The Iterable API base URL (defaults to https://api.iterable.com) */
20-
readonly baseUrl?: string;
17+
/** The active Iterable API key */
18+
readonly apiKey: string;
19+
/** The Iterable API base URL */
20+
readonly baseUrl: string;
2121
}
2222

2323
export function resolveAllowFlags(

src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class IterableMcpServer {
208208
// Initialize Iterable client with API key and base URL from config
209209
this.iterableClient = new IterableClient({
210210
apiKey: mcpConfig.apiKey,
211-
baseURL: mcpConfig.baseUrl || "https://api.iterable.com",
211+
baseUrl: mcpConfig.baseUrl,
212212
});
213213
this.setupHttpInterceptors();
214214

tests/unit/prompts.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it } from "@jest/globals";
44
import { generatePromptMessage, generatePrompts } from "../../src/prompts.js";
55
import { filterTools } from "../../src/tool-filter.js";
66
import { createAllTools } from "../../src/tools/index.js";
7+
import { createTestConfig } from "../utils/test-config.js";
78

89
describe("MCP Prompts", () => {
910
let client: IterableClient;
@@ -115,11 +116,11 @@ describe("MCP Prompts", () => {
115116
it("should work with filtered read-only tools", () => {
116117
// Test the pattern used in the server: filter to read-only tools first
117118
const allTools = createAllTools(client);
118-
const readOnlyConfig = {
119+
const readOnlyConfig = createTestConfig({
119120
allowUserPii: true,
120121
allowWrites: false,
121122
allowSends: false,
122-
};
123+
});
123124
const readOnlyTools = filterTools(allTools, readOnlyConfig);
124125
const prompts = generatePrompts(readOnlyTools);
125126

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { filterTools } from "../../src/tool-filter";
1+
import { filterTools } from "../../src/tool-filter.js";
2+
import { createTestConfig } from "../utils/test-config.js";
23

34
describe("filterTools defaults", () => {
45
const readOnlyTool: any = {
@@ -16,21 +17,27 @@ describe("filterTools defaults", () => {
1617
} as any;
1718

1819
it("excludes write tools when allowWrites=false", () => {
19-
const out = filterTools([readOnlyTool, writeTool], {
20-
allowUserPii: false,
21-
allowWrites: false,
22-
allowSends: true,
23-
});
20+
const out = filterTools(
21+
[readOnlyTool, writeTool],
22+
createTestConfig({
23+
allowUserPii: false,
24+
allowWrites: false,
25+
allowSends: true,
26+
})
27+
);
2428
expect(out.map((t) => t.name)).toContain("get_campaigns");
2529
expect(out.map((t) => t.name)).not.toContain("create_campaign");
2630
});
2731

2832
it("includes write tools when allowWrites=true", () => {
29-
const out = filterTools([readOnlyTool, writeTool], {
30-
allowUserPii: false,
31-
allowWrites: true,
32-
allowSends: true,
33-
});
33+
const out = filterTools(
34+
[readOnlyTool, writeTool],
35+
createTestConfig({
36+
allowUserPii: false,
37+
allowWrites: true,
38+
allowSends: true,
39+
})
40+
);
3441
expect(out.map((t) => t.name)).toContain("create_campaign");
3542
});
3643
});

tests/unit/tool-filter.test.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
READ_ONLY_TOOLS,
1313
} from "../../src/tool-filter.js";
1414
import { createAllTools } from "../../src/tools/index.js";
15+
import { createTestConfig } from "../utils/test-config.js";
1516

1617
// Mock Iterable client for testing
1718
const mockClient = {} as any;
@@ -23,11 +24,11 @@ describe("Tool Filter", () => {
2324
describe("Safe tool lists validation", () => {
2425
it("should have all NON_PII_TOOLS in actual tool names", () => {
2526
// Get the safe non-PII tools by testing with restrictive config
26-
const restrictiveConfig: McpServerConfig = {
27+
const restrictiveConfig: McpServerConfig = createTestConfig({
2728
allowUserPii: false,
2829
allowWrites: true, // Allow writes to isolate PII filtering
2930
allowSends: true,
30-
};
31+
});
3132

3233
const nonPiiTools = filterTools(allTools, restrictiveConfig);
3334
const nonPiiToolNames = nonPiiTools.map((tool) => tool.name);
@@ -40,11 +41,11 @@ describe("Tool Filter", () => {
4041

4142
it("should have all READ_ONLY_TOOLS in actual tool names", () => {
4243
// Get the read-only tools by testing with restrictive config
43-
const restrictiveConfig: McpServerConfig = {
44+
const restrictiveConfig: McpServerConfig = createTestConfig({
4445
allowUserPii: true, // Allow PII to isolate write filtering
4546
allowWrites: false,
4647
allowSends: true,
47-
};
48+
});
4849

4950
const readOnlyTools = filterTools(allTools, restrictiveConfig);
5051
const readOnlyToolNames = readOnlyTools.map((tool) => tool.name);
@@ -70,23 +71,23 @@ describe("Tool Filter", () => {
7071
});
7172

7273
it("should filter tools when restrictions are applied", () => {
73-
const permissiveConfig: McpServerConfig = {
74+
const permissiveConfig: McpServerConfig = createTestConfig({
7475
allowUserPii: true,
7576
allowWrites: true,
7677
allowSends: true,
77-
};
78+
});
7879

79-
const restrictivePiiConfig: McpServerConfig = {
80+
const restrictivePiiConfig: McpServerConfig = createTestConfig({
8081
allowUserPii: false,
8182
allowWrites: true,
8283
allowSends: true,
83-
};
84+
});
8485

85-
const restrictiveWriteConfig: McpServerConfig = {
86+
const restrictiveWriteConfig: McpServerConfig = createTestConfig({
8687
allowUserPii: true,
8788
allowWrites: false,
8889
allowSends: true,
89-
};
90+
});
9091

9192
const allToolsCount = filterTools(allTools, permissiveConfig).length;
9293
const nonPiiToolsCount = filterTools(
@@ -107,11 +108,11 @@ describe("Tool Filter", () => {
107108

108109
describe("Configuration filtering", () => {
109110
it("should filter PII tools when allowUserPii is false", () => {
110-
const config: McpServerConfig = {
111+
const config: McpServerConfig = createTestConfig({
111112
allowUserPii: false,
112113
allowWrites: true,
113114
allowSends: true,
114-
};
115+
});
115116

116117
const filteredTools = filterTools(allTools, config);
117118
const filteredNames = filteredTools.map((tool) => tool.name);
@@ -134,11 +135,11 @@ describe("Tool Filter", () => {
134135
});
135136

136137
it("should filter write tools when allowWrites is false", () => {
137-
const config: McpServerConfig = {
138+
const config: McpServerConfig = createTestConfig({
138139
allowUserPii: true,
139140
allowWrites: false,
140141
allowSends: true,
141-
};
142+
});
142143

143144
const filteredTools = filterTools(allTools, config);
144145
const filteredNames = filteredTools.map((tool) => tool.name);
@@ -163,22 +164,22 @@ describe("Tool Filter", () => {
163164
});
164165

165166
it("should allow all tools when both restrictions are disabled", () => {
166-
const config: McpServerConfig = {
167+
const config: McpServerConfig = createTestConfig({
167168
allowUserPii: true,
168169
allowWrites: true,
169170
allowSends: true,
170-
};
171+
});
171172

172173
const filteredTools = filterTools(allTools, config);
173174
expect(filteredTools).toHaveLength(allTools.length);
174175
});
175176

176177
it("should apply both restrictions when both are enabled", () => {
177-
const config: McpServerConfig = {
178+
const config: McpServerConfig = createTestConfig({
178179
allowUserPii: false,
179180
allowWrites: false,
180181
allowSends: false,
181-
};
182+
});
182183

183184
const filteredTools = filterTools(allTools, config);
184185

tests/utils/test-config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { McpServerConfig } from "../../src/config.js";
2+
3+
/**
4+
* Helper to create test config with required fields
5+
*/
6+
export function createTestConfig(
7+
overrides: Partial<McpServerConfig> = {}
8+
): McpServerConfig {
9+
return {
10+
apiKey: "test-api-key",
11+
baseUrl: "https://api.iterable.com",
12+
allowUserPii: false,
13+
allowWrites: false,
14+
allowSends: false,
15+
...overrides,
16+
};
17+
}

0 commit comments

Comments
 (0)