Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit 0d56910

Browse files
authored
Merge pull request #46 from runbasehq/dev
fix: add automatic .env file loading for API keys
2 parents 4dcf3e3 + d08a3df commit 0d56910

File tree

4 files changed

+62
-12
lines changed

4 files changed

+62
-12
lines changed

packages/mcp-check/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# mcp-testing-library
22

3+
## 0.3.3
4+
5+
### Patch Changes
6+
7+
- fix: add automatic .env file loading for API keys
8+
39
## 0.3.2
410

511
### Patch Changes

packages/mcp-check/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mcp-check",
33
"module": "dist/src/index.js",
4-
"version": "0.3.2",
4+
"version": "0.3.3",
55
"type": "module",
66
"main": "dist/src/index.js",
77
"types": "dist/src/index.d.ts",
@@ -19,6 +19,7 @@
1919
"dependencies": {
2020
"@anthropic-ai/sdk": "^0.56.0",
2121
"@modelcontextprotocol/sdk": "^1.16.0",
22+
"dotenv": "^16.6.1",
2223
"glob": "^11.0.0",
2324
"ink": "^6.1.0",
2425
"openai": "^5.10.1",

packages/mcp-check/src/index.ts

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
import { config } from "dotenv";
12
import type { ModelName } from "./providers";
23
import type { ProviderConfig } from "./providers/types";
3-
import type { AgentResponse, AgentsExecutionResult, ToolCallStats } from "./chunks/types";
4+
import type {
5+
AgentResponse,
6+
AgentsExecutionResult,
7+
ToolCallStats,
8+
} from "./chunks/types";
49
import { createProvider } from "./providers";
510

11+
config();
12+
613
export type { ModelName, Models } from "./providers";
714

815
export {
@@ -19,26 +26,30 @@ export {
1926

2027
/**
2128
* Creates a new AgentsClient instance for executing prompts against MCP servers.
22-
*
29+
*
2330
* @template T - The type of model names to use
2431
* @param mcpServer - The MCP server configuration
2532
* @param models - Array of model names to execute
2633
* @param config - Optional provider configuration (API keys, silent mode, etc.)
2734
* @returns A configured AgentsClient instance
28-
*
35+
*
2936
* @example
3037
* ```typescript
3138
* const client = client(mcpServer, ["claude-3-haiku-20240307", "gpt-4"], {
3239
* silent: true,
3340
* anthropicApiKey: process.env.ANTHROPIC_API_KEY
3441
* });
35-
*
42+
*
3643
* const result = await client
3744
* .prompt("What tools are available?")
3845
* .execute();
3946
* ```
4047
*/
41-
export function client<T extends ModelName>(mcpServer: McpServer, models: T[], config: ProviderConfig = {}): AgentsClient<T> {
48+
export function client<T extends ModelName>(
49+
mcpServer: McpServer,
50+
models: T[],
51+
config: ProviderConfig = {}
52+
): AgentsClient<T> {
4253
return new AgentsClient(mcpServer, models, config);
4354
}
4455

@@ -48,7 +59,17 @@ export class McpServer {
4859
public name: string;
4960
public type: string;
5061

51-
constructor({ url, authorizationToken, name, type }: { url: string; authorizationToken: string; name: string; type: string }) {
62+
constructor({
63+
url,
64+
authorizationToken,
65+
name,
66+
type,
67+
}: {
68+
url: string;
69+
authorizationToken: string;
70+
name: string;
71+
type: string;
72+
}) {
5273
this.url = url;
5374
this.authorizationToken = authorizationToken;
5475
this.name = name;
@@ -89,7 +110,9 @@ export class AgentsResult<T extends ModelName = ModelName> {
89110
const successfulExecutions = Object.keys(this.responses).length;
90111
const failedExecutions = this.models.length - successfulExecutions;
91112

92-
const allTools = (Object.values(this.responses) as AgentResponse[]).flatMap((r) => r.usedTools);
113+
const allTools = (Object.values(this.responses) as AgentResponse[]).flatMap(
114+
(r) => r.usedTools
115+
);
93116
const toolCounts = allTools.reduce(
94117
(acc, tool) => {
95118
acc[tool] = (acc[tool] || 0) + 1;
@@ -129,13 +152,18 @@ export class AgentsResult<T extends ModelName = ModelName> {
129152
}
130153

131154
stats[toolName].callCount += (calls as any[]).length;
132-
stats[toolName].lastCalled = Math.max(stats[toolName].lastCalled || 0, response.metadata?.timestamp || 0);
155+
stats[toolName].lastCalled = Math.max(
156+
stats[toolName].lastCalled || 0,
157+
response.metadata?.timestamp || 0
158+
);
133159
});
134160
});
135161

136162
return Object.values(stats).map((stat) => ({
137163
...stat,
138-
averageDuration: stat.totalDuration ? stat.totalDuration / stat.callCount : undefined,
164+
averageDuration: stat.totalDuration
165+
? stat.totalDuration / stat.callCount
166+
: undefined,
139167
}));
140168
}
141169

@@ -202,7 +230,12 @@ export class AgentsClient<T extends ModelName = ModelName> {
202230
const executionStartTime = Date.now();
203231

204232
this.executionPromises = this.models.map(async (model) => {
205-
const provider = createProvider(model, this.mcpServer!, this.promptText, this.config);
233+
const provider = createProvider(
234+
model,
235+
this.mcpServer!,
236+
this.promptText,
237+
this.config
238+
);
206239
const result = await provider.stream(model);
207240

208241
this.usedTools[model] = result.usedTools;
@@ -231,6 +264,12 @@ export class AgentsClient<T extends ModelName = ModelName> {
231264
{} as Record<T, AgentResponse>
232265
);
233266

234-
return new AgentsResult(responsesMap, executionStartTime, executionEndTime, this.models, this);
267+
return new AgentsResult(
268+
responsesMap,
269+
executionStartTime,
270+
executionEndTime,
271+
this.models,
272+
this
273+
);
235274
}
236275
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)