@mcpjam/cli 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,162 +1,104 @@
1
- # MCPJam CLI
1
+ # MCPJam Evals Testing CLI
2
2
 
3
- MCPJam CLI for programmatic MCP testing, designed for CI/CD integration and local development workflows.
3
+ We built a CLI that performs MCP evals and End to End (E2E) testing. The CLI creates a simulated end user’s environment and tests popular user flows.
4
4
 
5
- ## Installation
5
+ Evals helps you:
6
6
 
7
- ```bash
8
- npm install -g @mcpjam/cli
9
- ```
10
-
11
- ## Usage
12
-
13
- ### Run MCP Evaluations
14
-
15
- ```bash
16
- mcpjam evals run --tests weather-tests.json --environment local-dev.json
17
- ```
7
+ - Discover workflows that are breaking your server and get actionable ways on resolving them.
8
+ - Benchmark your server’s performance and catch regressions in future changes.
9
+ - Programatically test queries on a MCP server with a command. No more doing QA one by one.
18
10
 
19
- Short flags:
11
+ ### Install
20
12
 
21
13
  ```bash
22
- mcpjam evals run -t weather-tests.json -e local-dev.json
14
+ npm install -g @mcpjam/cli
23
15
  ```
24
16
 
25
- ### CLI Options
26
-
27
- - `--tests, -t <file>`: Path to the tests configuration file (required)
28
- - `--environment, -e <file>`: Path to the environment configuration file (required)
29
- - `--help, -h`: Show help information
30
- - `--version, -V`: Display version number
31
-
32
- ### Example Files
17
+ ### Set up tests
33
18
 
34
- The CLI includes example configuration files in the `examples/` directory:
19
+ To set up, create a new folder directory for your test. In that directory, create three files:
35
20
 
36
- - `test-servers.json`: Sample tests configuration
37
- - `mcp-environment.json`: Sample environment configuration
21
+ - `environment.json` to set up your MCP server connections
22
+ - `tests.json` to configure your tests
23
+ - `llms.json` to store your LLM API keys
38
24
 
39
- ## File Formats
40
-
41
- ### Tests File (mcp-tests.json)
42
-
43
- ```json
44
- {
45
- "tests": [
46
- {
47
- "title": "Test weather tool",
48
- "prompt": "What's the weather in San Francisco?",
49
- "expectedTools": ["get_weather"],
50
- "model": { "id": "claude-3-5-sonnet-20241022", "provider": "anthropic" },
51
- "selectedServers": ["weather-server"],
52
- "advancedConfig": {
53
- "instructions": "You are a helpful weather assistant",
54
- "temperature": 0.1,
55
- "maxSteps": 5,
56
- "toolChoice": "auto"
57
- }
58
- }
59
- ]
60
- }
61
- ```
25
+ ### Server connection file (environment.json)
62
26
 
63
- ### Environment File (mcp-environment.json)
27
+ This file is configured very similar to a `mcp.json` file. For servers with OAuth, you must provide your own `Bearer` API tokens. MCPJam CLI does not handle OAuth flows / DCR. For bearer tokens, make sure to wrap your header with `requestInit`.
64
28
 
65
29
  ```json
66
30
  {
67
31
  "servers": {
68
- "weather-server": {
69
- "command": "python",
70
- "args": ["weather_server.py"],
71
- "env": {
72
- "WEATHER_API_KEY": "${WEATHER_API_KEY}"
73
- }
74
- },
75
- "api-server": {
76
- "url": "https://api.example.com/mcp/sse",
32
+ "asana": {
33
+ "url": "https://mcp.asana.com/sse",
77
34
  "requestInit": {
78
35
  "headers": {
79
- "Authorization": "Bearer ${API_TOKEN}"
36
+ "Authorization": "Bearer <ASANA_API_KEY>"
80
37
  }
81
38
  }
39
+ },
40
+ "sequential-thinking": {
41
+ "command": "npx",
42
+ "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"],
43
+ "env": {
44
+ "ENV_1": "<ENV_1>"
45
+ }
82
46
  }
83
47
  }
84
48
  }
85
49
  ```
86
50
 
87
- ## Environment Variables
88
-
89
- The CLI resolves template variables like `${ANTHROPIC_API_KEY}` from your environment at runtime.
51
+ ### Tests file (tests.json)
90
52
 
91
- Required environment variables depend on your test configuration:
53
+ The test file is an array of tests.
92
54
 
93
- - `ANTHROPIC_API_KEY` - For Claude models
94
- - `OPENAI_API_KEY` - For OpenAI models
95
- - `DEEPSEEK_API_KEY` - For DeepSeek models
96
- - Custom variables for your MCP servers (e.g., `WEATHER_API_KEY`)
55
+ ```json
56
+ [
57
+ {
58
+ "title": "Workspace test",
59
+ "query": "What is my asana workspace?",
60
+ "runs": 1, // Number of times to run this test
61
+ "model": "anthropic/claude-3.7-sonnet",
62
+ "provider": "openrouter", // Provider name: "anthropic" | "openai" | "openrouter"
63
+ "expectedToolCalls": ["asana_list_workspaces"]
64
+ },
65
+ {
66
+ "title": "Workspace users test",
67
+ "query": "Can you figure out who is in the workspace?",
68
+ "runs": 1,
69
+ "model": "anthropic/claude-3.7-sonnet",
70
+ "provider": "openrouter",
71
+ "expectedToolCalls": ["asana_list_workspaces", "asana_get_workspace_users"]
72
+ }
73
+ ]
74
+ ```
97
75
 
98
- ## Output Format
76
+ ### LLM API key file (llms.json)
99
77
 
78
+ ```json
79
+ {
80
+ "anthropic": "<ANTHROPIC_API_KEY>",
81
+ "openai": "<OPENAI_API_KEY>",
82
+ "openrouter": "<OPENROUTER_API_KEY>"
83
+ }
100
84
  ```
101
- MCPJAM Evals v1.0.0
102
85
 
103
- Running 3 tests against weather-server...
86
+ ### Run MCP Eval
104
87
 
105
- ✅ Weather tool functionality
106
- Called tools: get_weather
107
- Duration: 1.2s
88
+ ```bash
89
+ mcpjam evals run --tests tests.json --environment environment.json --llms llms.json
90
+ ```
108
91
 
109
- ❌ Error handling test
110
- Called tools: get_weather, validate_location
111
- Missing: []
112
- Unexpected: validate_location
113
- Duration: 0.8s
92
+ #### Short flags
114
93
 
115
- Results: 2 passed, 1 failed (2.0s total)
94
+ ```bash
95
+ mcpjam evals run -t tests.json -e environment.json -l llms.json
116
96
  ```
117
97
 
118
- ## Supported Providers
119
-
120
- - **anthropic**: Claude models via Anthropic API
121
- - **openai**: GPT models via OpenAI API
122
- - **deepseek**: DeepSeek models via DeepSeek API
123
- - **ollama**: Local models via Ollama (requires Ollama to be running)
124
-
125
- ## Supported MCP Server Types
126
-
127
- - **STDIO**: Local processes with command + args
128
- - **HTTP**: Remote servers with URL + headers authentication
129
-
130
- ### Programmatic (TypeScript) configuration example for HTTP/SSE
131
-
132
- When using SSE endpoints that require custom headers (e.g., Authorization), you must provide `eventSourceInit` so the SSE connection includes those headers. If you use a JSON environment file with `requestInit.headers`, the CLI will automatically inject an `eventSourceInit.fetch` wrapper for you.
133
-
134
- ```ts
135
- import { MCPClient } from "@mastra/mcp";
136
-
137
- const client = new MCPClient({
138
- id: "example",
139
- servers: {
140
- exampleServer: {
141
- url: new URL("https://your-mcp-server.com/sse"),
142
- // Note: requestInit alone isn't enough for SSE
143
- requestInit: {
144
- headers: {
145
- Authorization: "Bearer your-token",
146
- },
147
- },
148
- // For programmatic usage, add eventSourceInit when using custom headers
149
- eventSourceInit: {
150
- fetch(input: Request | URL | string, init?: RequestInit) {
151
- const headers = new Headers(init?.headers || {});
152
- headers.set("Authorization", "Bearer your-token");
153
- return fetch(input as any, {
154
- ...init,
155
- headers,
156
- });
157
- },
158
- },
159
- },
160
- },
161
- });
162
- ```
98
+ #### CLI Options
99
+
100
+ - `--tests, -t <file>`: Path to the tests configuration file (required)
101
+ - `--environment, -e <file>`: Path to the environment configuration file (required)
102
+ - `--llms, -l <file>`: Path to the LLM API key configuration file
103
+ - `--help, -h`: Show help information
104
+ - `--version, -V`: Display version number
package/bin/mcpjam.js CHANGED
@@ -1,12 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { fileURLToPath } from "url";
3
+ import { fileURLToPath, pathToFileURL } from "url";
4
4
  import { dirname, resolve } from "path";
5
5
 
6
6
  const __dirname = dirname(fileURLToPath(import.meta.url));
7
7
  const cliPath = resolve(__dirname, "../dist/index.js");
8
8
 
9
- import(cliPath).catch((err) => {
9
+ const fixedCliPath =
10
+ process.platform === "win32" ? pathToFileURL(cliPath).href : cliPath;
11
+
12
+ import(fixedCliPath).catch((err) => {
10
13
  console.error("Failed to start MCPJam CLI:", err.message);
11
14
  process.exit(1);
12
15
  });