@index9/mcp 1.0.30 → 4.0.0

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.
Files changed (45) hide show
  1. package/README.md +16 -64
  2. package/dist/cli.d.ts +1 -0
  3. package/dist/cli.js +868 -0
  4. package/manifest.json +55 -0
  5. package/package.json +26 -43
  6. package/LICENSE +0 -21
  7. package/dist/client.d.ts +0 -5
  8. package/dist/client.d.ts.map +0 -1
  9. package/dist/client.js +0 -39
  10. package/dist/config.d.ts +0 -8
  11. package/dist/config.d.ts.map +0 -1
  12. package/dist/config.js +0 -9
  13. package/dist/index.d.ts +0 -3
  14. package/dist/index.d.ts.map +0 -1
  15. package/dist/index.js +0 -32
  16. package/dist/logger.d.ts +0 -4
  17. package/dist/logger.d.ts.map +0 -1
  18. package/dist/logger.js +0 -8
  19. package/dist/mcp.d.ts +0 -4
  20. package/dist/mcp.d.ts.map +0 -1
  21. package/dist/mcp.js +0 -147
  22. package/dist/schemas.d.ts +0 -162
  23. package/dist/schemas.d.ts.map +0 -1
  24. package/dist/schemas.js +0 -208
  25. package/dist/tools/find_models.d.ts +0 -3
  26. package/dist/tools/find_models.d.ts.map +0 -1
  27. package/dist/tools/find_models.js +0 -4
  28. package/dist/tools/get_model.d.ts +0 -3
  29. package/dist/tools/get_model.d.ts.map +0 -1
  30. package/dist/tools/get_model.js +0 -4
  31. package/dist/tools/test_model.d.ts +0 -3
  32. package/dist/tools/test_model.d.ts.map +0 -1
  33. package/dist/tools/test_model.js +0 -5
  34. package/dist/types/api.d.ts +0 -107
  35. package/dist/types/api.d.ts.map +0 -1
  36. package/dist/types/api.js +0 -1
  37. package/dist/types/index.d.ts +0 -3
  38. package/dist/types/index.d.ts.map +0 -1
  39. package/dist/types/index.js +0 -2
  40. package/dist/types/models.d.ts +0 -63
  41. package/dist/types/models.d.ts.map +0 -1
  42. package/dist/types/models.js +0 -1
  43. package/dist/utils/rateLimiter.d.ts +0 -7
  44. package/dist/utils/rateLimiter.d.ts.map +0 -1
  45. package/dist/utils/rateLimiter.js +0 -20
package/manifest.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "manifest_version": "0.3",
3
+ "name": "index9",
4
+ "version": "4.0.0",
5
+ "description": "Search, inspect, and benchmark 300+ AI models from your editor",
6
+ "author": {
7
+ "name": "Index9"
8
+ },
9
+ "server": {
10
+ "type": "node",
11
+ "entry_point": "dist/cli.js",
12
+ "mcp_config": {
13
+ "command": "node",
14
+ "args": [
15
+ "${__dirname}/dist/cli.js"
16
+ ],
17
+ "env": {
18
+ "OPENROUTER_API_KEY": "${user_config.openrouter_api_key}"
19
+ }
20
+ }
21
+ },
22
+ "tools": [
23
+ {
24
+ "name": "find_models",
25
+ "description": "Search and paginate AI models by semantic query or filters"
26
+ },
27
+ {
28
+ "name": "get_models",
29
+ "description": "Get full model metadata by IDs or aliases (batch, up to 100)"
30
+ },
31
+ {
32
+ "name": "test_model",
33
+ "description": "Run live inference or dry-run cost estimation across up to 10 models"
34
+ }
35
+ ],
36
+ "compatibility": {
37
+ "platforms": [
38
+ "darwin",
39
+ "linux",
40
+ "win32"
41
+ ],
42
+ "runtimes": {
43
+ "node": ">=20.0.0"
44
+ }
45
+ },
46
+ "user_config": {
47
+ "openrouter_api_key": {
48
+ "type": "string",
49
+ "title": "OpenRouter API Key",
50
+ "description": "Required for live test_model calls. dryRun=true does not require it.",
51
+ "sensitive": true,
52
+ "required": false
53
+ }
54
+ }
55
+ }
package/package.json CHANGED
@@ -1,59 +1,42 @@
1
1
  {
2
2
  "name": "@index9/mcp",
3
- "mcpName": "io.github.index9-org/mcp",
4
- "version": "1.0.30",
5
- "description": "Up-to-date model data for AI coding assistants.",
6
- "keywords": [
7
- "mcp",
8
- "model-context-protocol",
9
- "ai",
10
- "llm",
11
- "models",
12
- "pricing",
13
- "capabilities",
14
- "context-window",
15
- "openrouter"
3
+ "version": "4.0.0",
4
+ "bin": {
5
+ "index9-mcp": "./dist/cli.js"
6
+ },
7
+ "files": [
8
+ "dist",
9
+ "manifest.json"
16
10
  ],
17
- "homepage": "https://index9.dev",
11
+ "type": "module",
12
+ "main": "./dist/cli.js",
13
+ "types": "./dist/cli.d.ts",
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
18
17
  "repository": {
19
18
  "type": "git",
20
19
  "url": "git+https://github.com/index9-org/mcp.git"
21
20
  },
22
- "bugs": {
23
- "url": "https://github.com/index9-org/mcp/issues"
24
- },
25
21
  "license": "MIT",
26
- "author": "index9 <hello@index9.dev>",
27
- "type": "module",
28
- "main": "dist/index.js",
29
- "types": "dist/index.d.ts",
30
- "files": [
31
- "dist"
32
- ],
33
- "bin": {
34
- "index9": "./dist/index.js"
35
- },
36
22
  "dependencies": {
37
- "@modelcontextprotocol/sdk": "^1.25.1",
38
- "axios": "^1.13.2",
39
- "pino": "^10.1.0",
40
- "zod": "^4.3.4"
23
+ "@modelcontextprotocol/sdk": "^1.26.0",
24
+ "zod": "^4.3.6"
41
25
  },
42
26
  "devDependencies": {
43
- "@types/node": "^25.0.3",
44
- "pino-pretty": "^13.1.3",
45
- "tsx": "^4.21.0",
46
- "typescript": "^5.9.3"
27
+ "@types/node": "^25.2.3",
28
+ "tsup": "^8.5.1",
29
+ "typescript": "5.9.3",
30
+ "@index9/core": "2.3.0"
47
31
  },
48
- "publishConfig": {
49
- "access": "public"
32
+ "engines": {
33
+ "node": ">=20"
50
34
  },
51
35
  "scripts": {
52
- "build": "tsc",
53
- "typecheck": "tsc --noEmit",
54
- "start": "node dist/index.js",
55
- "dev": "tsx watch --env-file=.env src/index.ts",
56
- "publish:beta": "pnpm publish --tag beta",
57
- "publish:prod": "pnpm publish --tag latest"
36
+ "build": "node ../../scripts/generate-docs.mjs && tsup",
37
+ "clean": "rm -rf dist",
38
+ "lint": "tsc --noEmit",
39
+ "start": "node dist/cli.js",
40
+ "test": "echo 'No tests in @index9/mcp'"
58
41
  }
59
42
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Index9
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/dist/client.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { GetModelResponse, FindModelsResponse, FindModelsRequest, TestModelResponse } from "./types/index.js";
2
- export declare function findModels(params: FindModelsRequest): Promise<FindModelsResponse>;
3
- export declare function getModel(modelId: string): Promise<GetModelResponse>;
4
- export declare function testModel(modelIds: string[], testType?: "quick" | "code" | "reasoning" | "instruction" | "tool_calling", openRouterApiKey?: string | null, prompt?: string, maxTokens?: number, temperature?: number, systemPrompt?: string): Promise<TestModelResponse>;
5
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AA2B1B,wBAAsB,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAGvF;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAGzE;AAED,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,EAC1E,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,EAChC,MAAM,CAAC,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,CAAC,CAW5B"}
package/dist/client.js DELETED
@@ -1,39 +0,0 @@
1
- import axios from "axios";
2
- import { API_URL, API_TIMEOUT, TEST_MODEL_TIMEOUT } from "./config.js";
3
- const createAxiosClient = (timeout) => {
4
- const client = axios.create({ baseURL: API_URL, timeout });
5
- client.interceptors.response.use((res) => res, (error) => {
6
- if (error.response?.status === 404) {
7
- const message = error.response?.data?.message || "Resource not found";
8
- throw new Error(message);
9
- }
10
- const message = error.response?.data?.message ||
11
- (error.code === "ECONNABORTED" ? `Request timeout` : null) ||
12
- (error.code === "ECONNREFUSED" ? `Unable to connect to API server` : null) ||
13
- error.message;
14
- throw new Error(message);
15
- });
16
- return client;
17
- };
18
- const client = createAxiosClient(API_TIMEOUT);
19
- const testClient = createAxiosClient(TEST_MODEL_TIMEOUT); // test operations with longer timeout
20
- export async function findModels(params) {
21
- const { data } = await client.post("/models/find", params);
22
- return data;
23
- }
24
- export async function getModel(modelId) {
25
- const { data } = await client.get(`/models/${encodeURIComponent(modelId)}`);
26
- return data;
27
- }
28
- export async function testModel(modelIds, testType, openRouterApiKey, prompt, maxTokens, temperature, systemPrompt) {
29
- const { data } = await testClient.post("/test", {
30
- model_ids: modelIds,
31
- test_type: testType,
32
- custom_prompt: prompt,
33
- openrouter_api_key: openRouterApiKey || undefined,
34
- max_tokens: maxTokens,
35
- temperature,
36
- system_prompt: systemPrompt,
37
- });
38
- return data;
39
- }
package/dist/config.d.ts DELETED
@@ -1,8 +0,0 @@
1
- declare const API_URL: string;
2
- declare const OPENROUTER_API_KEY: string | null;
3
- declare const API_TIMEOUT: number;
4
- declare const TEST_MODEL_TIMEOUT: number;
5
- declare const RATE_LIMIT_WINDOW_MS: number;
6
- declare const RATE_LIMIT_MAX_REQUESTS: number;
7
- export { API_URL, OPENROUTER_API_KEY, API_TIMEOUT, TEST_MODEL_TIMEOUT, RATE_LIMIT_WINDOW_MS, RATE_LIMIT_MAX_REQUESTS, };
8
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,QAAyD,CAAC;AACvE,QAAA,MAAM,kBAAkB,eAAyC,CAAC;AAGlE,QAAA,MAAM,WAAW,QAAsD,CAAC;AACxE,QAAA,MAAM,kBAAkB,QAAuD,CAAC;AAGhF,QAAA,MAAM,oBAAoB,QAAwD,CAAC;AACnF,QAAA,MAAM,uBAAuB,QAAyD,CAAC;AAEvF,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,GACxB,CAAC"}
package/dist/config.js DELETED
@@ -1,9 +0,0 @@
1
- const API_URL = process.env.INDEX9_API_URL || "https://index9.dev/api";
2
- const OPENROUTER_API_KEY = process.env.OPENROUTER_API_KEY || null;
3
- // Configurable timeouts (in milliseconds)
4
- const API_TIMEOUT = parseInt(process.env.INDEX9_API_TIMEOUT || "30000"); // 30 seconds default
5
- const TEST_MODEL_TIMEOUT = parseInt(process.env.TEST_MODEL_TIMEOUT || "120000"); // 2 minutes for testing
6
- // Rate limiting configuration
7
- const RATE_LIMIT_WINDOW_MS = parseInt(process.env.RATE_LIMIT_WINDOW_MS || "60000"); // 1 minute
8
- const RATE_LIMIT_MAX_REQUESTS = parseInt(process.env.RATE_LIMIT_MAX_REQUESTS || "100"); // requests per window
9
- export { API_URL, OPENROUTER_API_KEY, API_TIMEOUT, TEST_MODEL_TIMEOUT, RATE_LIMIT_WINDOW_MS, RATE_LIMIT_MAX_REQUESTS, };
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export * from "./types/index.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAMA,cAAc,kBAAkB,CAAC"}
package/dist/index.js DELETED
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env node
2
- import { logger } from "./logger.js";
3
- import { startMCPServer } from "./mcp.js";
4
- // Export types for library usage
5
- export * from "./types/index.js";
6
- async function main() {
7
- if (process.env.DEBUG_MCP === "true") {
8
- logger.info("Starting index9 MCP server");
9
- }
10
- await startMCPServer();
11
- }
12
- process.on("unhandledRejection", (error) => {
13
- logger.error({
14
- error: error instanceof Error ? error.message : String(error),
15
- stack: error instanceof Error ? error.stack : undefined,
16
- }, "Unhandled rejection");
17
- process.exit(1);
18
- });
19
- process.on("uncaughtException", (error) => {
20
- logger.error({
21
- error: error instanceof Error ? error.message : String(error),
22
- stack: error instanceof Error ? error.stack : undefined,
23
- }, "Uncaught exception");
24
- process.exit(1);
25
- });
26
- main().catch((error) => {
27
- logger.error({
28
- error: error instanceof Error ? error.message : String(error),
29
- stack: error instanceof Error ? error.stack : undefined,
30
- }, "Failed to start");
31
- process.exit(1);
32
- });
package/dist/logger.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import pino from "pino";
2
- declare const logger: pino.Logger<never, boolean>;
3
- export { logger };
4
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,QAAA,MAAM,MAAM,6BAOX,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
package/dist/logger.js DELETED
@@ -1,8 +0,0 @@
1
- import pino from "pino";
2
- // Minimize stderr logs to avoid interfering with JSON-RPC; log only warnings/errors.
3
- const logger = pino({
4
- name: "index9",
5
- level: process.env.LOG_LEVEL || "warn",
6
- enabled: process.env.NODE_ENV !== "production" || process.env.DEBUG_MCP === "true",
7
- }, process.stderr);
8
- export { logger };
package/dist/mcp.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function createMCPServer(): McpServer;
3
- export declare function startMCPServer(): Promise<void>;
4
- //# sourceMappingURL=mcp.d.ts.map
package/dist/mcp.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA0BpE,wBAAgB,eAAe,cAmI9B;AAED,wBAAsB,cAAc,kBAoBnC"}
package/dist/mcp.js DELETED
@@ -1,147 +0,0 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
- import { readFileSync } from "node:fs";
4
- import { fileURLToPath } from "node:url";
5
- import { dirname, join } from "node:path";
6
- import { logger } from "./logger.js";
7
- import { checkRateLimit } from "./utils/rateLimiter.js";
8
- import { findModelsTool } from "./tools/find_models.js";
9
- import { getModelTool } from "./tools/get_model.js";
10
- import { testModelTool } from "./tools/test_model.js";
11
- import { OPENROUTER_API_KEY } from "./config.js";
12
- import { findModelsSchema, getModelSchema, testModelSchema, findModelsOutputSchema, getModelOutputSchema, testModelOutputSchema, } from "./schemas.js";
13
- const __filename = fileURLToPath(import.meta.url);
14
- const __dirname = dirname(__filename);
15
- const packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
16
- export function createMCPServer() {
17
- const server = new McpServer({
18
- name: "index9",
19
- version: packageJson.version,
20
- });
21
- server.registerTool("find_models", {
22
- title: "Find AI Models",
23
- description: `Search and filter 300+ AI models. Returns ranked results with pricing, context windows, and capabilities.
24
-
25
- Call this tool first to discover model IDs, unless the user provides one (format: 'provider/model-name').
26
-
27
- Parameters:
28
- - query: Natural language search (e.g., 'fast cheap coding model')
29
- - provider: Filter by provider(s). Comma-separated for multiple (e.g., 'openai,anthropic')
30
- - min_context, max_context, max_price_per_m, capabilities: Exact filters
31
- - sort_by: 'relevance' (default), 'price_asc', 'price_desc', 'date_desc', 'context_desc'
32
- - limit, offset: Pagination
33
-
34
- Scores: Results include a 'score' field (0-150+). Higher = more relevant. Combines semantic similarity, capability matching, and model quality signals. Use for relative ranking, not absolute measurement.
35
-
36
- Use model IDs from results with get_model for full specs or test_model for live testing.`,
37
- inputSchema: findModelsSchema,
38
- outputSchema: findModelsOutputSchema,
39
- }, async (input) => {
40
- if (!checkRateLimit("find_models")) {
41
- logger.warn({ tool: "find_models" }, "Rate limit exceeded");
42
- throw new Error("Rate limit exceeded. Please try again later.");
43
- }
44
- try {
45
- const result = await findModelsTool(input);
46
- return {
47
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
48
- structuredContent: result,
49
- };
50
- }
51
- catch (error) {
52
- const errorMessage = error instanceof Error ? error.message : String(error);
53
- logger.error({ tool: "find_models", error: errorMessage }, "Tool execution failed");
54
- throw error;
55
- }
56
- });
57
- server.registerTool("get_model", {
58
- title: "Get Model Details",
59
- description: `Get complete specs for a model by ID. Returns pricing, context window, capabilities, architecture, and per-request limits.
60
-
61
- Call after find_models to get full details, or when the user provides a model ID (format: 'provider/model-name').
62
-
63
- Returns 404 if model not found. Use find_models to discover valid IDs.`,
64
- inputSchema: getModelSchema,
65
- outputSchema: getModelOutputSchema,
66
- }, async (input) => {
67
- if (!checkRateLimit("get_model")) {
68
- logger.warn({ tool: "get_model" }, "Rate limit exceeded");
69
- throw new Error("Rate limit exceeded. Please try again later.");
70
- }
71
- try {
72
- const result = await getModelTool(input);
73
- return {
74
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
75
- structuredContent: result,
76
- };
77
- }
78
- catch (error) {
79
- const errorMessage = error instanceof Error ? error.message : String(error);
80
- logger.error({ tool: "get_model", error: errorMessage }, "Tool execution failed");
81
- throw error;
82
- }
83
- });
84
- server.registerTool("test_model", {
85
- title: "Test AI Models",
86
- description: `Make live API calls to 1-5 models via OpenRouter. Returns output text, latency (ms), token usage, and cost estimates.
87
-
88
- Requires OPENROUTER_API_KEY in MCP client configuration. Costs are billed to your OpenRouter account.
89
-
90
- Parameters:
91
- - model_ids: 1-5 model IDs to test (all receive identical prompts)
92
- - test_type: 'quick' (math), 'code', 'reasoning', 'instruction', 'tool_calling'
93
- - prompt: Custom prompt (overrides test_type)
94
- - max_tokens: Response length limit (default 1000)
95
-
96
- Use find_models or get_model first to identify model IDs.`,
97
- inputSchema: testModelSchema,
98
- outputSchema: testModelOutputSchema,
99
- }, async (input) => {
100
- if (!checkRateLimit("test_model")) {
101
- logger.warn({ tool: "test_model" }, "Rate limit exceeded");
102
- throw new Error("Rate limit exceeded. Please try again later.");
103
- }
104
- try {
105
- if (!OPENROUTER_API_KEY) {
106
- logger.warn({ tool: "test_model" }, "Missing OpenRouter API key");
107
- return {
108
- content: [
109
- {
110
- type: "text",
111
- text: "Error: OPENROUTER_API_KEY is required to use test_model. This tool runs live tests against AI models via OpenRouter API.\n\nTo use this tool:\n1. Get your API key from https://openrouter.ai/keys\n2. Add OPENROUTER_API_KEY to your MCP client configuration (e.g., in Cursor settings or Claude Desktop config)\n3. Restart your MCP client\n\nCharges are billed directly to your OpenRouter account.",
112
- },
113
- ],
114
- isError: true,
115
- };
116
- }
117
- const result = await testModelTool(input);
118
- return {
119
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
120
- structuredContent: result,
121
- };
122
- }
123
- catch (error) {
124
- const errorMessage = error instanceof Error ? error.message : String(error);
125
- logger.error({ tool: "test_model", error: errorMessage }, "Tool execution failed");
126
- throw error;
127
- }
128
- });
129
- return server;
130
- }
131
- export async function startMCPServer() {
132
- // Minimal startup logging to avoid stdio interference
133
- if (process.env.DEBUG_MCP === "true") {
134
- logger.info("Starting MCP server with stdio transport");
135
- }
136
- const server = createMCPServer();
137
- const transport = new StdioServerTransport();
138
- await server.connect(transport);
139
- if (process.env.DEBUG_MCP === "true") {
140
- logger.info("MCP server ready - awaiting requests");
141
- }
142
- process.on("SIGINT", async () => {
143
- logger.info("Shutting down MCP server");
144
- await server.close();
145
- process.exit(0);
146
- });
147
- }
package/dist/schemas.d.ts DELETED
@@ -1,162 +0,0 @@
1
- import { z } from "zod";
2
- /**
3
- * Find Models Tool Schema
4
- * Unified search and filter for AI models
5
- */
6
- export declare const findModelsSchema: z.ZodObject<{
7
- query: z.ZodOptional<z.ZodString>;
8
- provider: z.ZodOptional<z.ZodString>;
9
- min_context: z.ZodOptional<z.ZodNumber>;
10
- max_context: z.ZodOptional<z.ZodNumber>;
11
- max_price_per_m: z.ZodOptional<z.ZodNumber>;
12
- capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
13
- vision: "vision";
14
- audio: "audio";
15
- video: "video";
16
- tool_calling: "tool_calling";
17
- json_mode: "json_mode";
18
- }>>>;
19
- sort_by: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
20
- relevance: "relevance";
21
- price_asc: "price_asc";
22
- price_desc: "price_desc";
23
- date_desc: "date_desc";
24
- context_desc: "context_desc";
25
- }>>>;
26
- limit: z.ZodDefault<z.ZodNumber>;
27
- offset: z.ZodDefault<z.ZodNumber>;
28
- }, z.core.$strip>;
29
- /**
30
- * Get Model Tool Schema
31
- * Retrieve complete details for a specific model
32
- */
33
- export declare const getModelSchema: z.ZodObject<{
34
- model_id: z.ZodString;
35
- }, z.core.$strip>;
36
- /**
37
- * Test Model Tool Schema
38
- * Run live API tests against models via OpenRouter
39
- */
40
- export declare const testModelSchema: z.ZodObject<{
41
- model_ids: z.ZodArray<z.ZodString>;
42
- test_type: z.ZodDefault<z.ZodEnum<{
43
- quick: "quick";
44
- code: "code";
45
- reasoning: "reasoning";
46
- instruction: "instruction";
47
- tool_calling: "tool_calling";
48
- }>>;
49
- prompt: z.ZodOptional<z.ZodString>;
50
- max_tokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
51
- temperature: z.ZodOptional<z.ZodNumber>;
52
- system_prompt: z.ZodOptional<z.ZodString>;
53
- }, z.core.$strip>;
54
- /**
55
- * Output Schemas for Tool Results
56
- * Define expected return structures for better LLM understanding
57
- */
58
- export declare const findModelsOutputSchema: z.ZodObject<{
59
- results: z.ZodArray<z.ZodObject<{
60
- id: z.ZodString;
61
- name: z.ZodString;
62
- description: z.ZodNullable<z.ZodString>;
63
- score: z.ZodNumber;
64
- provider: z.ZodString;
65
- context_window: z.ZodNullable<z.ZodNumber>;
66
- pricing: z.ZodObject<{
67
- input: z.ZodNullable<z.ZodNumber>;
68
- output: z.ZodNullable<z.ZodNumber>;
69
- }, z.core.$strip>;
70
- capabilities: z.ZodObject<{
71
- vision: z.ZodNullable<z.ZodBoolean>;
72
- audio: z.ZodNullable<z.ZodBoolean>;
73
- tool_calling: z.ZodNullable<z.ZodBoolean>;
74
- json_mode: z.ZodNullable<z.ZodBoolean>;
75
- video: z.ZodNullable<z.ZodBoolean>;
76
- }, z.core.$strip>;
77
- matched_features: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
- hugging_face_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
- release_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
80
- }, z.core.$strip>>;
81
- total: z.ZodOptional<z.ZodNumber>;
82
- }, z.core.$strip>;
83
- export declare const getModelOutputSchema: z.ZodObject<{
84
- id: z.ZodString;
85
- name: z.ZodString;
86
- provider: z.ZodString;
87
- description: z.ZodNullable<z.ZodString>;
88
- family: z.ZodNullable<z.ZodString>;
89
- version: z.ZodNullable<z.ZodString>;
90
- release_date: z.ZodNullable<z.ZodString>;
91
- limits: z.ZodObject<{
92
- context_window: z.ZodNumber;
93
- max_output_tokens: z.ZodNullable<z.ZodNumber>;
94
- }, z.core.$strip>;
95
- pricing: z.ZodObject<{
96
- input: z.ZodNullable<z.ZodNumber>;
97
- output: z.ZodNullable<z.ZodNumber>;
98
- }, z.core.$strip>;
99
- extended_pricing: z.ZodNullable<z.ZodObject<{
100
- image: z.ZodNullable<z.ZodNumber>;
101
- audio: z.ZodNullable<z.ZodNumber>;
102
- web_search: z.ZodNullable<z.ZodNumber>;
103
- cache_read: z.ZodNullable<z.ZodNumber>;
104
- cache_write: z.ZodNullable<z.ZodNumber>;
105
- discount: z.ZodNullable<z.ZodNumber>;
106
- internal_reasoning: z.ZodNullable<z.ZodNumber>;
107
- }, z.core.$strip>>;
108
- capabilities: z.ZodObject<{
109
- vision: z.ZodBoolean;
110
- audio: z.ZodBoolean;
111
- tool_calling: z.ZodBoolean;
112
- json_mode: z.ZodBoolean;
113
- video: z.ZodBoolean;
114
- function_calling: z.ZodBoolean;
115
- custom: z.ZodArray<z.ZodString>;
116
- }, z.core.$strip>;
117
- supported_parameters: z.ZodArray<z.ZodString>;
118
- is_moderated: z.ZodBoolean;
119
- input_modalities: z.ZodArray<z.ZodString>;
120
- output_modalities: z.ZodArray<z.ZodString>;
121
- architecture: z.ZodObject<{
122
- tokenizer: z.ZodNullable<z.ZodString>;
123
- instruct_type: z.ZodNullable<z.ZodString>;
124
- }, z.core.$strip>;
125
- per_request_limits: z.ZodNullable<z.ZodObject<{
126
- prompt_tokens: z.ZodNullable<z.ZodNumber>;
127
- completion_tokens: z.ZodNullable<z.ZodNumber>;
128
- }, z.core.$strip>>;
129
- }, z.core.$strip>;
130
- export declare const testModelOutputSchema: z.ZodObject<{
131
- test_type: z.ZodString;
132
- prompt: z.ZodString;
133
- results: z.ZodArray<z.ZodObject<{
134
- model_id: z.ZodString;
135
- model_name: z.ZodString;
136
- latency_ms: z.ZodNumber;
137
- output: z.ZodNullable<z.ZodString>;
138
- tokens_used: z.ZodNullable<z.ZodObject<{
139
- prompt_tokens: z.ZodNumber;
140
- completion_tokens: z.ZodNumber;
141
- total_tokens: z.ZodNumber;
142
- }, z.core.$strip>>;
143
- cost_estimate: z.ZodObject<{
144
- input_cost: z.ZodNullable<z.ZodNumber>;
145
- output_cost: z.ZodNullable<z.ZodNumber>;
146
- total_cost: z.ZodNullable<z.ZodNumber>;
147
- }, z.core.$strip>;
148
- tool_calls_detected: z.ZodOptional<z.ZodBoolean>;
149
- tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
150
- name: z.ZodString;
151
- arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
152
- }, z.core.$strip>>>;
153
- error: z.ZodNullable<z.ZodString>;
154
- }, z.core.$strip>>;
155
- }, z.core.$strip>;
156
- export type FindModelsInput = z.infer<typeof findModelsSchema>;
157
- export type GetModelInput = z.infer<typeof getModelSchema>;
158
- export type TestModelInput = z.infer<typeof testModelSchema>;
159
- export type FindModelsOutput = z.infer<typeof findModelsOutputSchema>;
160
- export type GetModelOutput = z.infer<typeof getModelOutputSchema>;
161
- export type TestModelOutput = z.infer<typeof testModelOutputSchema>;
162
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;iBA+D3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc;;iBAOzB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;iBA4C1B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;iBA0BjC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkD/B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;iBAiChC,CAAC;AAGH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC3D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}