@iris-eval/mcp-server 0.2.3 → 0.2.4
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/dist/config/index.js +9 -2
- package/dist/index.js +63 -17
- package/dist/storage/index.js +1 -1
- package/dist/storage/sqlite-adapter.js +3 -3
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/config/index.js
CHANGED
|
@@ -38,13 +38,20 @@ function loadConfigFile(path) {
|
|
|
38
38
|
throw new Error(`Invalid JSON in config file ${path}: ${err.message}`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
function parsePortEnv(value, name) {
|
|
42
|
+
const n = parseInt(value, 10);
|
|
43
|
+
if (!Number.isFinite(n) || n < 1 || n > 65535) {
|
|
44
|
+
throw new Error(`${name}=${JSON.stringify(value)} is not a valid port (must be an integer 1-65535)`);
|
|
45
|
+
}
|
|
46
|
+
return n;
|
|
47
|
+
}
|
|
41
48
|
function loadEnvVars() {
|
|
42
49
|
const config = {};
|
|
43
50
|
if (process.env.IRIS_TRANSPORT) {
|
|
44
51
|
config.transport = { type: process.env.IRIS_TRANSPORT };
|
|
45
52
|
}
|
|
46
53
|
if (process.env.IRIS_PORT) {
|
|
47
|
-
config.transport = { ...config.transport, port:
|
|
54
|
+
config.transport = { ...config.transport, port: parsePortEnv(process.env.IRIS_PORT, 'IRIS_PORT') };
|
|
48
55
|
}
|
|
49
56
|
if (process.env.IRIS_HOST) {
|
|
50
57
|
config.transport = { ...config.transport, host: process.env.IRIS_HOST };
|
|
@@ -61,7 +68,7 @@ function loadEnvVars() {
|
|
|
61
68
|
if (process.env.IRIS_DASHBOARD_PORT) {
|
|
62
69
|
config.dashboard = {
|
|
63
70
|
...config.dashboard,
|
|
64
|
-
port:
|
|
71
|
+
port: parsePortEnv(process.env.IRIS_DASHBOARD_PORT, 'IRIS_DASHBOARD_PORT'),
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
74
|
if (process.env.IRIS_API_KEY) {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { parseArgs } from 'node:util';
|
|
3
|
+
import { z } from 'zod';
|
|
3
4
|
import { loadConfig } from './config/index.js';
|
|
4
5
|
import { createStorage } from './storage/index.js';
|
|
5
6
|
import { createIrisServer } from './server.js';
|
|
@@ -7,19 +8,52 @@ import { createStdioTransport } from './transport/stdio.js';
|
|
|
7
8
|
import { createHttpTransport } from './transport/http.js';
|
|
8
9
|
import { createDashboardServer } from './dashboard/server.js';
|
|
9
10
|
import { createLogger } from './utils/logger.js';
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
const PortSchema = z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(/^\d+$/, 'must be a positive integer')
|
|
14
|
+
.transform((s) => parseInt(s, 10))
|
|
15
|
+
.refine((n) => Number.isFinite(n) && n >= 1 && n <= 65535, 'must be between 1 and 65535');
|
|
16
|
+
const CliSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
transport: z.enum(['stdio', 'http']).optional(),
|
|
19
|
+
port: PortSchema.optional(),
|
|
20
|
+
config: z.string().min(1).optional(),
|
|
21
|
+
'db-path': z.string().min(1).optional(),
|
|
22
|
+
'api-key': z.string().min(1).optional(),
|
|
23
|
+
dashboard: z.boolean().optional(),
|
|
24
|
+
'dashboard-port': PortSchema.optional(),
|
|
25
|
+
help: z.boolean().optional(),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = parseArgs({
|
|
31
|
+
options: {
|
|
32
|
+
transport: { type: 'string' },
|
|
33
|
+
port: { type: 'string' },
|
|
34
|
+
config: { type: 'string' },
|
|
35
|
+
'db-path': { type: 'string' },
|
|
36
|
+
'api-key': { type: 'string' },
|
|
37
|
+
dashboard: { type: 'boolean', default: false },
|
|
38
|
+
'dashboard-port': { type: 'string' },
|
|
39
|
+
help: { type: 'boolean', short: 'h', default: false },
|
|
40
|
+
},
|
|
41
|
+
strict: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
process.stderr.write(`iris-mcp: ${err.message}\nRun \`iris-mcp --help\` for usage.\n`);
|
|
46
|
+
process.exit(2);
|
|
47
|
+
}
|
|
48
|
+
const validation = CliSchema.safeParse(parsed.values);
|
|
49
|
+
if (!validation.success) {
|
|
50
|
+
const issues = validation.error.issues
|
|
51
|
+
.map((i) => ` --${i.path.join('.')}: ${i.message}`)
|
|
52
|
+
.join('\n');
|
|
53
|
+
process.stderr.write(`iris-mcp: invalid argument(s):\n${issues}\nRun \`iris-mcp --help\` for usage.\n`);
|
|
54
|
+
process.exit(2);
|
|
55
|
+
}
|
|
56
|
+
const values = validation.data;
|
|
23
57
|
if (values.help) {
|
|
24
58
|
process.stderr.write(`
|
|
25
59
|
Iris — MCP-Native Agent Eval Server
|
|
@@ -28,24 +62,36 @@ Usage: iris-mcp [options]
|
|
|
28
62
|
|
|
29
63
|
Options:
|
|
30
64
|
--transport <type> Transport type: stdio (default) or http
|
|
31
|
-
--port <number> HTTP transport port (default: 3000)
|
|
65
|
+
--port <number> HTTP transport port 1-65535 (default: 3000)
|
|
32
66
|
--config <path> Config file path (default: ~/.iris/config.json)
|
|
33
67
|
--db-path <path> SQLite database path (default: ~/.iris/iris.db)
|
|
34
68
|
--api-key <key> API key for HTTP authentication
|
|
35
69
|
--dashboard Enable web dashboard
|
|
36
|
-
--dashboard-port <port> Dashboard port (default: 6920)
|
|
70
|
+
--dashboard-port <port> Dashboard port 1-65535 (default: 6920)
|
|
37
71
|
-h, --help Show this help message
|
|
72
|
+
|
|
73
|
+
Environment variables (CLI flags take precedence):
|
|
74
|
+
IRIS_TRANSPORT stdio | http
|
|
75
|
+
IRIS_HOST Bind address for HTTP transport (default: 127.0.0.1)
|
|
76
|
+
IRIS_PORT HTTP transport port (1-65535)
|
|
77
|
+
IRIS_DB_PATH SQLite database path
|
|
78
|
+
IRIS_LOG_LEVEL debug | info | warn | error
|
|
79
|
+
IRIS_DASHBOARD true to enable web dashboard
|
|
80
|
+
IRIS_DASHBOARD_PORT Dashboard port (1-65535, default: 6920)
|
|
81
|
+
IRIS_API_KEY API key for HTTP authentication
|
|
82
|
+
IRIS_ALLOWED_ORIGINS Comma-separated CORS origin allowlist
|
|
83
|
+
RATE_LIMIT_SALT (waitlist API only — required when website is deployed)
|
|
38
84
|
`);
|
|
39
85
|
process.exit(0);
|
|
40
86
|
}
|
|
41
87
|
const config = loadConfig({
|
|
42
88
|
transport: values.transport,
|
|
43
|
-
port: values.port
|
|
89
|
+
port: values.port,
|
|
44
90
|
config: values.config,
|
|
45
91
|
dbPath: values['db-path'],
|
|
46
92
|
apiKey: values['api-key'],
|
|
47
93
|
dashboard: values.dashboard,
|
|
48
|
-
dashboardPort: values['dashboard-port']
|
|
94
|
+
dashboardPort: values['dashboard-port'],
|
|
49
95
|
});
|
|
50
96
|
const logger = createLogger(config);
|
|
51
97
|
async function main() {
|
package/dist/storage/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export function createStorage(config) {
|
|
|
4
4
|
case 'sqlite':
|
|
5
5
|
return new SqliteAdapter(config.storage.path);
|
|
6
6
|
default:
|
|
7
|
-
throw new Error(`Unsupported storage type: ${config.storage.type}`);
|
|
7
|
+
throw new Error(`Unsupported storage type: ${config.storage.type} (supported: sqlite)`);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export { SqliteAdapter } from './sqlite-adapter.js';
|
|
@@ -73,10 +73,10 @@ export class SqliteAdapter {
|
|
|
73
73
|
const sortBy = options.sort_by ?? 'timestamp';
|
|
74
74
|
const sortOrder = options.sort_order ?? 'desc';
|
|
75
75
|
if (!ALLOWED_SORT_COLUMNS.has(sortBy)) {
|
|
76
|
-
throw new Error(`Invalid sort column: ${sortBy}`);
|
|
76
|
+
throw new Error(`Invalid sort column: ${sortBy} (allowed: ${[...ALLOWED_SORT_COLUMNS].join(', ')})`);
|
|
77
77
|
}
|
|
78
78
|
if (!ALLOWED_SORT_ORDERS.has(sortOrder)) {
|
|
79
|
-
throw new Error(`Invalid sort order: ${sortOrder}`);
|
|
79
|
+
throw new Error(`Invalid sort order: ${sortOrder} (allowed: ${[...ALLOWED_SORT_ORDERS].join(', ')})`);
|
|
80
80
|
}
|
|
81
81
|
const limit = options.limit ?? 50;
|
|
82
82
|
const offset = options.offset ?? 0;
|
|
@@ -371,7 +371,7 @@ export class SqliteAdapter {
|
|
|
371
371
|
};
|
|
372
372
|
const query = queries[column];
|
|
373
373
|
if (!query) {
|
|
374
|
-
throw new Error(`Column '${column}' is not queryable`);
|
|
374
|
+
throw new Error(`Column '${column}' is not queryable (allowed: ${Object.keys(queries).join(', ')})`);
|
|
375
375
|
}
|
|
376
376
|
const rows = this.db.prepare(query).all();
|
|
377
377
|
return rows.map((row) => row[column]);
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/iris-eval/mcp-server",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.4",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@iris-eval/mcp-server",
|
|
14
|
-
"version": "0.2.
|
|
14
|
+
"version": "0.2.4",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|