@@ -58,19 +58,27 @@ const mcpServer = new McpServer({
5858});
5959```
6060
61- ### client(mcpServer, models)
61+ ### client(mcpServer, models, config? )
6262
6363Create a client instance to execute prompts:
6464
6565``` typescript
66- const agent = client (mcpServer , [" claude-3-haiku-20240307" , " gpt-4" ])
66+ const agent = client (mcpServer , [" claude-3-haiku-20240307" , " gpt-4" ], {
67+ // Provider-specific API keys (optional - can also use environment variables)
68+ anthropicApiKey: " your-anthropic-key-here" ,
69+ openaiApiKey: " your-openai-key-here"
70+ })
6771 .prompt (" Your prompt here" )
6872 .execute ();
6973```
7074
7175** Parameters:**
7276- ` mcpServer ` : Configured MCP server instance
7377- ` models ` : Array of AI model names to use
78+ - ` config ` : Optional configuration object
79+ - ` anthropicApiKey ` : API key for Anthropic models
80+ - ` openaiApiKey ` : API key for OpenAI models
81+
7482
7583** Supported Models:**
7684- Claude models: ` claude-3-haiku-20240307 ` , ` claude-3-5-sonnet-20240620 ` , etc.
@@ -114,10 +122,19 @@ const mcpServer = new McpServer({
114122
115123describe (" MCP Server Tests" , () => {
116124 test (" should use expected tools" , async () => {
125+ // Option 1: Use environment variables (no config needed)
117126 const agent = await client (mcpServer , [" claude-3-haiku-20240307" ])
118127 .prompt (" Update the content using the available tools." )
119128 .execute ();
120129
130+ // Option 2: Pass API keys directly in config
131+ const agentWithConfig = await client (mcpServer , [" claude-3-haiku-20240307" , " gpt-4" ], {
132+ anthropicApiKey: " your-anthropic-key-here" ,
133+ openaiApiKey: " your-openai-key-here"
134+ })
135+ .prompt (" Update the content using the available tools." )
136+ .execute ();
137+
121138 // Verify tools were used
122139 expect (agent .usedTools ).toHaveProperty (" claude-3-haiku-20240307" );
123140 expect (agent .usedTools [" claude-3-haiku-20240307" ]! ).toEqual (
@@ -149,4 +166,4 @@ Set the following environment variables for AI model authentication:
149166ANTHROPIC_API_KEY=your_anthropic_key_here
150167OPENAI_API_KEY=your_openai_key_here
151168MCP_TOKEN=your_mcp_server_token_here
152- ```
169+ ```
0 commit comments