@mcpjam/inspector 0.3.9 โ 0.8.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.
- package/.next/BUILD_ID +1 -0
- package/.next/app-build-manifest.json +89 -0
- package/.next/app-path-routes-manifest.json +13 -0
- package/.next/build-manifest.json +33 -0
- package/.next/cache/.previewinfo +1 -0
- package/.next/cache/.rscinfo +1 -0
- package/.next/cache/.tsbuildinfo +1 -0
- package/.next/cache/eslint/.cache_11b5ofe +1 -0
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/diagnostics/build-diagnostics.json +6 -0
- package/.next/diagnostics/framework.json +1 -0
- package/.next/export-marker.json +6 -0
- package/.next/images-manifest.json +57 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +41 -0
- package/.next/react-loadable-manifest.json +1 -0
- package/.next/required-server-files.json +318 -0
- package/.next/routes-manifest.json +65 -0
- package/.next/server/app/_not-found/page.js +2 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/chat/route.js +45 -0
- package/.next/server/app/api/mcp/chat/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/chat/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/connect/route.js +1 -0
- package/.next/server/app/api/mcp/connect/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/connect/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/prompts/get/route.js +1 -0
- package/.next/server/app/api/mcp/prompts/get/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/prompts/get/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/prompts/list/route.js +1 -0
- package/.next/server/app/api/mcp/prompts/list/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/prompts/list/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/resources/list/route.js +1 -0
- package/.next/server/app/api/mcp/resources/list/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/resources/list/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/resources/read/route.js +1 -0
- package/.next/server/app/api/mcp/resources/read/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/resources/read/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/tools/route.js +21 -0
- package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/tools/route_client-reference-manifest.js +1 -0
- package/.next/server/app/favicon.ico/route.js +1 -0
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
- package/.next/server/app/favicon.ico.body +0 -0
- package/.next/server/app/favicon.ico.meta +1 -0
- package/.next/server/app/oauth/callback/page.js +2 -0
- package/.next/server/app/oauth/callback/page.js.nft.json +1 -0
- package/.next/server/app/oauth/callback/page_client-reference-manifest.js +1 -0
- package/.next/server/app/page.js +16 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +13 -0
- package/.next/server/chunks/175.js +8 -0
- package/.next/server/chunks/260.js +82 -0
- package/.next/server/chunks/546.js +1 -0
- package/.next/server/chunks/548.js +6 -0
- package/.next/server/chunks/55.js +1 -0
- package/.next/server/chunks/985.js +22 -0
- package/.next/server/functions-config-manifest.json +4 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages/_app.js +1 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +1 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +19 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +5 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/chunks/14-ae3a01e72ea53777.js +1 -0
- package/.next/static/chunks/214-cc4c35d88f2695ed.js +1 -0
- package/.next/static/chunks/4bd1b696-cf72ae8a39fa05aa.js +1 -0
- package/.next/static/chunks/866-04c19dda4c52f2bf.js +1 -0
- package/.next/static/chunks/964-eda38e26c0391a47.js +1 -0
- package/.next/static/chunks/app/_not-found/page-d7e832b54474da82.js +1 -0
- package/.next/static/chunks/app/api/mcp/chat/route-0341498a8bf5f2da.js +1 -0
- package/.next/static/chunks/app/api/mcp/connect/route-0341498a8bf5f2da.js +1 -0
- package/.next/static/chunks/app/api/mcp/prompts/get/route-0341498a8bf5f2da.js +1 -0
- package/.next/static/chunks/app/api/mcp/prompts/list/route-0341498a8bf5f2da.js +1 -0
- package/.next/static/chunks/app/api/mcp/resources/list/route-0341498a8bf5f2da.js +1 -0
- package/.next/static/chunks/app/api/mcp/resources/read/route-0341498a8bf5f2da.js +1 -0
- package/.next/static/chunks/app/api/mcp/tools/route-0341498a8bf5f2da.js +1 -0
- package/.next/static/chunks/app/layout-fb6e1ad5933381f3.js +1 -0
- package/.next/static/chunks/app/oauth/callback/page-d8b3908ea67ba3e3.js +1 -0
- package/.next/static/chunks/app/page-81e35b2a61edb363.js +1 -0
- package/.next/static/chunks/framework-7c95b8e5103c9e90.js +1 -0
- package/.next/static/chunks/main-app-7d61da15faa6c1af.js +1 -0
- package/.next/static/chunks/main-bbdafee21a7bd1d6.js +1 -0
- package/.next/static/chunks/pages/_app-0a0020ddd67f79cf.js +1 -0
- package/.next/static/chunks/pages/_error-03529f2c21436739.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-cdfccaf38062dd25.js +1 -0
- package/.next/static/css/1e852d83e9c1d0c6.css +1 -0
- package/.next/static/css/f30152c0704fba31.css +1 -0
- package/.next/static/css/fe751fdbe975e9ca.css +1 -0
- package/.next/static/media/569ce4b8f30dc480-s.p.woff2 +0 -0
- package/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- package/.next/static/media/ollama_dark.9af45ac0.png +0 -0
- package/.next/static/media/ollama_logo.9f08a95b.svg +7 -0
- package/.next/static/media/openai_logo.3f83154a.png +0 -0
- package/.next/static/wgHmsxKAquUu9gOMW6Qd5/_buildManifest.js +1 -0
- package/.next/static/wgHmsxKAquUu9gOMW6Qd5/_ssgManifest.js +1 -0
- package/.next/trace +35 -0
- package/.next/types/app/api/mcp/chat/route.ts +347 -0
- package/.next/types/app/api/mcp/connect/route.ts +347 -0
- package/.next/types/app/api/mcp/prompts/get/route.ts +347 -0
- package/.next/types/app/api/mcp/prompts/list/route.ts +347 -0
- package/.next/types/app/api/mcp/resources/list/route.ts +347 -0
- package/.next/types/app/api/mcp/resources/read/route.ts +347 -0
- package/.next/types/app/api/mcp/tools/route.ts +347 -0
- package/.next/types/app/layout.ts +84 -0
- package/.next/types/app/oauth/callback/page.ts +84 -0
- package/.next/types/app/page.ts +84 -0
- package/.next/types/cache-life.d.ts +141 -0
- package/.next/types/package.json +1 -0
- package/README.md +76 -161
- package/bin/start.js +504 -0
- package/next.config.ts +7 -0
- package/package.json +71 -54
- package/public/claude_logo.png +0 -0
- package/public/demo_1.png +0 -0
- package/public/demo_2.png +0 -0
- package/public/demo_3.png +0 -0
- package/public/file.svg +1 -0
- package/public/globe.svg +1 -0
- package/public/mcp.svg +1 -0
- package/public/next.svg +1 -0
- package/public/ollama_dark.png +0 -0
- package/public/ollama_logo.svg +7 -0
- package/public/openai_logo.png +0 -0
- package/public/vercel.svg +1 -0
- package/public/window.svg +1 -0
- package/LICENSE +0 -200
- package/cli/build/cli.js +0 -251
- package/cli/build/client/connection.js +0 -33
- package/cli/build/client/index.js +0 -6
- package/cli/build/client/prompts.js +0 -23
- package/cli/build/client/resources.js +0 -30
- package/cli/build/client/tools.js +0 -64
- package/cli/build/client/types.js +0 -1
- package/cli/build/error-handler.js +0 -18
- package/cli/build/index.js +0 -166
- package/cli/build/transport.js +0 -47
- package/client/bin/client.js +0 -71
- package/client/bin/start.js +0 -143
- package/client/dist/assets/OAuthCallback-BSOXmPlE.js +0 -56
- package/client/dist/assets/OAuthDebugCallback-DyzqkofK.js +0 -44
- package/client/dist/assets/index-BT03cD-1.js +0 -63301
- package/client/dist/assets/index-Bwd_BFIj.css +0 -4164
- package/client/dist/index.html +0 -14
- package/client/dist/ollama_logo.png +0 -0
- package/client/dist/openai_logo.png +0 -0
- package/server/build/database/DatabaseManager.js +0 -108
- package/server/build/database/index.js +0 -8
- package/server/build/database/routes.js +0 -86
- package/server/build/database/types.js +0 -27
- package/server/build/database/utils.js +0 -86
- package/server/build/index.js +0 -331
- package/server/build/mcpProxy.js +0 -54
- package/server/build/shared/MCPProxyService.js +0 -221
- package/server/build/shared/TransportFactory.js +0 -130
- package/server/build/shared/index.js +0 -4
- package/server/build/shared/types.js +0 -1
- package/server/build/shared/utils.js +0 -27
- package/server/build/test-server.js +0 -145
- package/server/build/testing/HealthCheck.js +0 -42
- package/server/build/testing/TestExecutor.js +0 -240
- package/server/build/testing/TestRunner.js +0 -198
- package/server/build/testing/TestServer.js +0 -440
- package/server/build/testing/types.js +0 -1
- /package/{client/dist/claude_logo.png โ .next/static/media/claude_logo.d33b25b0.png} +0 -0
- /package/{client/dist โ public}/mcp_jam.svg +0 -0
- /package/{client/dist โ public}/mcp_jam_dark.png +0 -0
- /package/{client/dist โ public}/mcp_jam_light.png +0 -0
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
// server/src/testing/TestServer.ts
|
|
2
|
-
import express from "express";
|
|
3
|
-
import cors from "cors";
|
|
4
|
-
import { HealthCheck } from "./HealthCheck.js";
|
|
5
|
-
import { ConsoleLogger } from "../shared/utils.js";
|
|
6
|
-
export class TestServer {
|
|
7
|
-
app;
|
|
8
|
-
server;
|
|
9
|
-
healthCheck = null;
|
|
10
|
-
logger;
|
|
11
|
-
config;
|
|
12
|
-
constructor(config) {
|
|
13
|
-
this.config = config;
|
|
14
|
-
this.logger = new ConsoleLogger();
|
|
15
|
-
this.app = express();
|
|
16
|
-
this.setupMiddleware();
|
|
17
|
-
}
|
|
18
|
-
setupMiddleware() {
|
|
19
|
-
// CORS support
|
|
20
|
-
if (this.config.cors) {
|
|
21
|
-
this.app.use(cors({
|
|
22
|
-
origin: true,
|
|
23
|
-
credentials: true,
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
// Body parsing
|
|
27
|
-
this.app.use(express.json({ limit: "10mb" }));
|
|
28
|
-
this.app.use(express.urlencoded({ extended: true }));
|
|
29
|
-
// Request logging
|
|
30
|
-
this.app.use((req, res, next) => {
|
|
31
|
-
this.logger.info(`${req.method} ${req.path}`, {
|
|
32
|
-
ip: req.ip,
|
|
33
|
-
userAgent: req.get("User-Agent"),
|
|
34
|
-
});
|
|
35
|
-
next();
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
setupRoutes() {
|
|
39
|
-
// Health check endpoints
|
|
40
|
-
this.app.get("/api/test/health", (req, res) => {
|
|
41
|
-
if (!this.healthCheck) {
|
|
42
|
-
return res.status(503).json({ error: "Health check not initialized" });
|
|
43
|
-
}
|
|
44
|
-
res.json(this.healthCheck.getStatus());
|
|
45
|
-
});
|
|
46
|
-
this.app.get("/api/test/status", (req, res) => {
|
|
47
|
-
if (!this.healthCheck) {
|
|
48
|
-
return res.status(503).json({ error: "Health check not initialized" });
|
|
49
|
-
}
|
|
50
|
-
res.json(this.healthCheck.getDetailedStatus());
|
|
51
|
-
});
|
|
52
|
-
// Test execution endpoints
|
|
53
|
-
this.app.post("/api/test/run", async (req, res) => {
|
|
54
|
-
try {
|
|
55
|
-
const { testCase } = req.body;
|
|
56
|
-
if (!testCase ||
|
|
57
|
-
!testCase.id ||
|
|
58
|
-
!testCase.prompt ||
|
|
59
|
-
!testCase.serverConfigs) {
|
|
60
|
-
return res.status(400).json({
|
|
61
|
-
success: false,
|
|
62
|
-
error: "Invalid test case format. Required fields: id, prompt, serverConfigs",
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
this.logger.info(`๐งช Starting test execution for: ${testCase.name || testCase.id}`);
|
|
66
|
-
// Mock test execution for now - will be replaced with actual implementation
|
|
67
|
-
const startTime = Date.now();
|
|
68
|
-
// Simulate test execution
|
|
69
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
70
|
-
const result = {
|
|
71
|
-
id: `result-${Date.now()}`,
|
|
72
|
-
testCase: testCase,
|
|
73
|
-
toolCalls: [],
|
|
74
|
-
duration: Date.now() - startTime,
|
|
75
|
-
success: true,
|
|
76
|
-
timestamp: new Date().toISOString(),
|
|
77
|
-
metadata: {
|
|
78
|
-
executionMode: "single",
|
|
79
|
-
server: "test-server",
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
this.logger.info(`โ
Test execution completed for: ${testCase.name || testCase.id}`);
|
|
83
|
-
res.json({
|
|
84
|
-
success: true,
|
|
85
|
-
result: result,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
this.logger.error("โ Test execution failed:", error);
|
|
90
|
-
res.status(500).json({
|
|
91
|
-
success: false,
|
|
92
|
-
error: "Test execution failed",
|
|
93
|
-
details: error instanceof Error ? error.message : String(error),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
this.app.post("/api/test/run-batch", async (req, res) => {
|
|
98
|
-
try {
|
|
99
|
-
const { testCases } = req.body;
|
|
100
|
-
if (!Array.isArray(testCases) || testCases.length === 0) {
|
|
101
|
-
return res.status(400).json({
|
|
102
|
-
success: false,
|
|
103
|
-
error: "Invalid request format. Expected array of test cases",
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
this.logger.info(`๐งช Starting batch test execution for ${testCases.length} tests`);
|
|
107
|
-
const results = [];
|
|
108
|
-
const startTime = Date.now();
|
|
109
|
-
// Process each test case
|
|
110
|
-
for (const testCase of testCases) {
|
|
111
|
-
if (!testCase.id || !testCase.prompt || !testCase.serverConfigs) {
|
|
112
|
-
results.push({
|
|
113
|
-
id: `result-${Date.now()}`,
|
|
114
|
-
testCase: testCase,
|
|
115
|
-
toolCalls: [],
|
|
116
|
-
duration: 0,
|
|
117
|
-
success: false,
|
|
118
|
-
error: "Invalid test case format",
|
|
119
|
-
timestamp: new Date().toISOString(),
|
|
120
|
-
});
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
const testStartTime = Date.now();
|
|
124
|
-
// Simulate test execution
|
|
125
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
126
|
-
results.push({
|
|
127
|
-
id: `result-${Date.now()}`,
|
|
128
|
-
testCase: testCase,
|
|
129
|
-
toolCalls: [],
|
|
130
|
-
duration: Date.now() - testStartTime,
|
|
131
|
-
success: true,
|
|
132
|
-
timestamp: new Date().toISOString(),
|
|
133
|
-
metadata: {
|
|
134
|
-
executionMode: "batch",
|
|
135
|
-
server: "test-server",
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
const totalDuration = Date.now() - startTime;
|
|
140
|
-
const successCount = results.filter((r) => r.success).length;
|
|
141
|
-
this.logger.info(`โ
Batch test execution completed: ${successCount}/${testCases.length} passed`);
|
|
142
|
-
res.json({
|
|
143
|
-
success: true,
|
|
144
|
-
results: results,
|
|
145
|
-
summary: {
|
|
146
|
-
total: testCases.length,
|
|
147
|
-
passed: successCount,
|
|
148
|
-
failed: testCases.length - successCount,
|
|
149
|
-
duration: totalDuration,
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
this.logger.error("โ Batch test execution failed:", error);
|
|
155
|
-
res.status(500).json({
|
|
156
|
-
success: false,
|
|
157
|
-
error: "Batch test execution failed",
|
|
158
|
-
details: error instanceof Error ? error.message : String(error),
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
this.app.get("/api/test/results", (req, res) => {
|
|
163
|
-
try {
|
|
164
|
-
const { limit = 50, offset = 0, testCaseId } = req.query;
|
|
165
|
-
// Mock results for now - will be replaced with database queries
|
|
166
|
-
const mockResults = [
|
|
167
|
-
{
|
|
168
|
-
id: "result-1",
|
|
169
|
-
testCase: {
|
|
170
|
-
id: "test-1",
|
|
171
|
-
name: "Sample Test",
|
|
172
|
-
prompt: "Test prompt",
|
|
173
|
-
},
|
|
174
|
-
toolCalls: [],
|
|
175
|
-
duration: 1250,
|
|
176
|
-
success: true,
|
|
177
|
-
timestamp: new Date().toISOString(),
|
|
178
|
-
},
|
|
179
|
-
];
|
|
180
|
-
res.json({
|
|
181
|
-
success: true,
|
|
182
|
-
results: mockResults,
|
|
183
|
-
pagination: {
|
|
184
|
-
limit: parseInt(limit),
|
|
185
|
-
offset: parseInt(offset),
|
|
186
|
-
total: mockResults.length,
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
this.logger.error("โ Failed to retrieve test results:", error);
|
|
192
|
-
res.status(500).json({
|
|
193
|
-
success: false,
|
|
194
|
-
error: "Failed to retrieve test results",
|
|
195
|
-
details: error instanceof Error ? error.message : String(error),
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
this.app.get("/api/test/results/:id", (req, res) => {
|
|
200
|
-
try {
|
|
201
|
-
const { id } = req.params;
|
|
202
|
-
// Mock result for now - will be replaced with database query
|
|
203
|
-
const mockResult = {
|
|
204
|
-
id: id,
|
|
205
|
-
testCase: {
|
|
206
|
-
id: "test-1",
|
|
207
|
-
name: "Sample Test",
|
|
208
|
-
prompt: "Test prompt",
|
|
209
|
-
},
|
|
210
|
-
toolCalls: [],
|
|
211
|
-
duration: 1250,
|
|
212
|
-
success: true,
|
|
213
|
-
timestamp: new Date().toISOString(),
|
|
214
|
-
metadata: {
|
|
215
|
-
executionMode: "single",
|
|
216
|
-
server: "test-server",
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
res.json({
|
|
220
|
-
success: true,
|
|
221
|
-
result: mockResult,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
this.logger.error("โ Failed to retrieve test result:", error);
|
|
226
|
-
res.status(500).json({
|
|
227
|
-
success: false,
|
|
228
|
-
error: "Failed to retrieve test result",
|
|
229
|
-
details: error instanceof Error ? error.message : String(error),
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
this.app.get("/api/test/connections", (req, res) => {
|
|
234
|
-
try {
|
|
235
|
-
// Mock connection info for now
|
|
236
|
-
const mockConnections = [
|
|
237
|
-
{
|
|
238
|
-
id: "conn-1",
|
|
239
|
-
name: "Test Server",
|
|
240
|
-
type: "stdio",
|
|
241
|
-
status: "connected",
|
|
242
|
-
lastActivity: new Date().toISOString(),
|
|
243
|
-
},
|
|
244
|
-
];
|
|
245
|
-
res.json({
|
|
246
|
-
success: true,
|
|
247
|
-
connections: mockConnections,
|
|
248
|
-
summary: {
|
|
249
|
-
total: mockConnections.length,
|
|
250
|
-
active: mockConnections.filter((c) => c.status === "connected")
|
|
251
|
-
.length,
|
|
252
|
-
inactive: mockConnections.filter((c) => c.status !== "connected")
|
|
253
|
-
.length,
|
|
254
|
-
},
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
catch (error) {
|
|
258
|
-
this.logger.error("โ Failed to retrieve connections:", error);
|
|
259
|
-
res.status(500).json({
|
|
260
|
-
success: false,
|
|
261
|
-
error: "Failed to retrieve connections",
|
|
262
|
-
details: error instanceof Error ? error.message : String(error),
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
// Test case management endpoints
|
|
267
|
-
this.app.get("/api/test/cases", (req, res) => {
|
|
268
|
-
try {
|
|
269
|
-
const { limit = 50, offset = 0 } = req.query;
|
|
270
|
-
// Mock test cases for now
|
|
271
|
-
const mockTestCases = [
|
|
272
|
-
{
|
|
273
|
-
id: "test-1",
|
|
274
|
-
name: "Sample Test Case",
|
|
275
|
-
prompt: "Test the weather tool functionality",
|
|
276
|
-
expectedTools: ["get_weather"],
|
|
277
|
-
serverConfigs: [{ id: "server-1", name: "Weather Server" }],
|
|
278
|
-
timeout: 30000,
|
|
279
|
-
metadata: { category: "weather" },
|
|
280
|
-
},
|
|
281
|
-
];
|
|
282
|
-
res.json({
|
|
283
|
-
success: true,
|
|
284
|
-
testCases: mockTestCases,
|
|
285
|
-
pagination: {
|
|
286
|
-
limit: parseInt(limit),
|
|
287
|
-
offset: parseInt(offset),
|
|
288
|
-
total: mockTestCases.length,
|
|
289
|
-
},
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
catch (error) {
|
|
293
|
-
this.logger.error("โ Failed to retrieve test cases:", error);
|
|
294
|
-
res.status(500).json({
|
|
295
|
-
success: false,
|
|
296
|
-
error: "Failed to retrieve test cases",
|
|
297
|
-
details: error instanceof Error ? error.message : String(error),
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
this.app.post("/api/test/cases", async (req, res) => {
|
|
302
|
-
try {
|
|
303
|
-
const testCase = req.body;
|
|
304
|
-
if (!testCase.name || !testCase.prompt || !testCase.serverConfigs) {
|
|
305
|
-
return res.status(400).json({
|
|
306
|
-
success: false,
|
|
307
|
-
error: "Invalid test case format. Required fields: name, prompt, serverConfigs",
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
// Generate ID if not provided
|
|
311
|
-
if (!testCase.id) {
|
|
312
|
-
testCase.id = `test-${Date.now()}`;
|
|
313
|
-
}
|
|
314
|
-
this.logger.info(`๐พ Creating test case: ${testCase.name}`);
|
|
315
|
-
// Mock save operation
|
|
316
|
-
const savedTestCase = {
|
|
317
|
-
...testCase,
|
|
318
|
-
createdAt: new Date().toISOString(),
|
|
319
|
-
updatedAt: new Date().toISOString(),
|
|
320
|
-
};
|
|
321
|
-
res.status(201).json({
|
|
322
|
-
success: true,
|
|
323
|
-
testCase: savedTestCase,
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
catch (error) {
|
|
327
|
-
this.logger.error("โ Failed to create test case:", error);
|
|
328
|
-
res.status(500).json({
|
|
329
|
-
success: false,
|
|
330
|
-
error: "Failed to create test case",
|
|
331
|
-
details: error instanceof Error ? error.message : String(error),
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
this.app.get("/api/test/cases/:id", (req, res) => {
|
|
336
|
-
try {
|
|
337
|
-
const { id } = req.params;
|
|
338
|
-
// Mock test case
|
|
339
|
-
const mockTestCase = {
|
|
340
|
-
id: id,
|
|
341
|
-
name: "Sample Test Case",
|
|
342
|
-
prompt: "Test the weather tool functionality",
|
|
343
|
-
expectedTools: ["get_weather"],
|
|
344
|
-
serverConfigs: [{ id: "server-1", name: "Weather Server" }],
|
|
345
|
-
timeout: 30000,
|
|
346
|
-
metadata: { category: "weather" },
|
|
347
|
-
createdAt: new Date().toISOString(),
|
|
348
|
-
updatedAt: new Date().toISOString(),
|
|
349
|
-
};
|
|
350
|
-
res.json({
|
|
351
|
-
success: true,
|
|
352
|
-
testCase: mockTestCase,
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
catch (error) {
|
|
356
|
-
this.logger.error("โ Failed to retrieve test case:", error);
|
|
357
|
-
res.status(500).json({
|
|
358
|
-
success: false,
|
|
359
|
-
error: "Failed to retrieve test case",
|
|
360
|
-
details: error instanceof Error ? error.message : String(error),
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
// Statistics endpoint
|
|
365
|
-
this.app.get("/api/test/stats", (_req, res) => {
|
|
366
|
-
try {
|
|
367
|
-
const stats = {
|
|
368
|
-
testCases: {
|
|
369
|
-
total: 1,
|
|
370
|
-
active: 1,
|
|
371
|
-
inactive: 0,
|
|
372
|
-
},
|
|
373
|
-
testResults: {
|
|
374
|
-
total: 1,
|
|
375
|
-
passed: 1,
|
|
376
|
-
failed: 0,
|
|
377
|
-
recentRuns: 1,
|
|
378
|
-
},
|
|
379
|
-
connections: {
|
|
380
|
-
total: 1,
|
|
381
|
-
active: 1,
|
|
382
|
-
inactive: 0,
|
|
383
|
-
},
|
|
384
|
-
performance: {
|
|
385
|
-
averageTestDuration: 1250,
|
|
386
|
-
successRate: 100,
|
|
387
|
-
lastRunTime: new Date().toISOString(),
|
|
388
|
-
},
|
|
389
|
-
};
|
|
390
|
-
res.json({
|
|
391
|
-
success: true,
|
|
392
|
-
stats: stats,
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
catch (error) {
|
|
396
|
-
this.logger.error("โ Failed to retrieve statistics:", error);
|
|
397
|
-
res.status(500).json({
|
|
398
|
-
success: false,
|
|
399
|
-
error: "Failed to retrieve statistics",
|
|
400
|
-
details: error instanceof Error ? error.message : String(error),
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
// Error handling
|
|
405
|
-
this.app.use((error, _req, res, _next) => {
|
|
406
|
-
this.logger.error("Unhandled error:", error);
|
|
407
|
-
res.status(500).json({
|
|
408
|
-
success: false,
|
|
409
|
-
error: "Internal server error",
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
async start(mcpProxyService, database) {
|
|
414
|
-
// Initialize components
|
|
415
|
-
this.healthCheck = new HealthCheck(mcpProxyService, database, this.logger);
|
|
416
|
-
// Setup routes
|
|
417
|
-
this.setupRoutes();
|
|
418
|
-
// Start server
|
|
419
|
-
return new Promise((resolve, reject) => {
|
|
420
|
-
this.server = this.app.listen(this.config.port, this.config.host, () => {
|
|
421
|
-
this.logger.info(`๐งช Test server listening on ${this.config.host}:${this.config.port}`);
|
|
422
|
-
resolve();
|
|
423
|
-
});
|
|
424
|
-
this.server.on("error", (error) => {
|
|
425
|
-
this.logger.error("Server error:", error);
|
|
426
|
-
reject(error);
|
|
427
|
-
});
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
async stop() {
|
|
431
|
-
if (this.server) {
|
|
432
|
-
await new Promise((resolve) => {
|
|
433
|
-
this.server.close(() => {
|
|
434
|
-
this.logger.info("๐งช Test server stopped");
|
|
435
|
-
resolve();
|
|
436
|
-
});
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|