Skip to content

Commit 51f3135

Browse files
authored
Merge branch 'main' into feat/proxyServerUrl
2 parents 4fdbcee + 043f604 commit 51f3135

File tree

16 files changed

+4253
-277
lines changed

16 files changed

+4253
-277
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
# Working around https://github.com/npm/cli/issues/4828
2626
# - run: npm ci
2727
- run: npm install --no-package-lock
28+
29+
- name: Run client tests
30+
working-directory: ./client
31+
run: npm test
32+
2833
- run: npm run build
2934

3035
publish:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ server/build
44
client/dist
55
client/tsconfig.app.tsbuildinfo
66
client/tsconfig.node.tsbuildinfo
7+
.vscode

bin/cli.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ async function main() {
2727
}
2828

2929
if (parsingFlags && arg === "-e" && i + 1 < args.length) {
30-
const [key, value] = args[++i].split("=");
31-
if (key && value) {
30+
const envVar = args[++i];
31+
const equalsIndex = envVar.indexOf("=");
32+
33+
if (equalsIndex !== -1) {
34+
const key = envVar.substring(0, equalsIndex);
35+
const value = envVar.substring(equalsIndex + 1);
3236
envVars[key] = value;
37+
} else {
38+
envVars[envVar] = "";
3339
}
3440
} else if (!command) {
3541
command = arg;

client/jest.config.cjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
preset: "ts-jest",
3+
testEnvironment: "jsdom",
4+
moduleNameMapper: {
5+
"^@/(.*)$": "<rootDir>/src/$1",
6+
"^../components/DynamicJsonForm$":
7+
"<rootDir>/src/utils/__mocks__/DynamicJsonForm.ts",
8+
"^../../components/DynamicJsonForm$":
9+
"<rootDir>/src/utils/__mocks__/DynamicJsonForm.ts",
10+
},
11+
transform: {
12+
"^.+\\.tsx?$": [
13+
"ts-jest",
14+
{
15+
useESM: true,
16+
jsx: "react-jsx",
17+
tsconfig: "tsconfig.jest.json",
18+
},
19+
],
20+
},
21+
extensionsToTreatAsEsm: [".ts", ".tsx"],
22+
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
23+
// Exclude directories and files that don't need to be tested
24+
testPathIgnorePatterns: [
25+
"/node_modules/",
26+
"/dist/",
27+
"/bin/",
28+
"\\.config\\.(js|ts|cjs|mjs)$",
29+
],
30+
// Exclude the same patterns from coverage reports
31+
coveragePathIgnorePatterns: [
32+
"/node_modules/",
33+
"/dist/",
34+
"/bin/",
35+
"\\.config\\.(js|ts|cjs|mjs)$",
36+
],
37+
};

client/package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"dev": "vite",
1919
"build": "tsc -b && vite build",
2020
"lint": "eslint .",
21-
"preview": "vite preview"
21+
"preview": "vite preview",
22+
"test": "jest --config jest.config.cjs",
23+
"test:watch": "jest --config jest.config.cjs --watch"
2224
},
2325
"dependencies": {
2426
"@modelcontextprotocol/sdk": "^1.6.1",
@@ -35,8 +37,8 @@
3537
"clsx": "^2.1.1",
3638
"cmdk": "^1.0.4",
3739
"lucide-react": "^0.447.0",
38-
"prismjs": "^1.29.0",
3940
"pkce-challenge": "^4.1.0",
41+
"prismjs": "^1.29.0",
4042
"react": "^18.3.1",
4143
"react-dom": "^18.3.1",
4244
"react-simple-code-editor": "^0.14.1",
@@ -48,18 +50,23 @@
4850
},
4951
"devDependencies": {
5052
"@eslint/js": "^9.11.1",
53+
"@types/jest": "^29.5.14",
5154
"@types/node": "^22.7.5",
5255
"@types/react": "^18.3.10",
5356
"@types/react-dom": "^18.3.0",
5457
"@types/serve-handler": "^6.1.4",
5558
"@vitejs/plugin-react": "^4.3.2",
5659
"autoprefixer": "^10.4.20",
60+
"co": "^4.6.0",
5761
"eslint": "^9.11.1",
5862
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
5963
"eslint-plugin-react-refresh": "^0.4.12",
6064
"globals": "^15.9.0",
65+
"jest": "^29.7.0",
66+
"jest-environment-jsdom": "^29.7.0",
6167
"postcss": "^8.4.47",
6268
"tailwindcss": "^3.4.13",
69+
"ts-jest": "^29.2.6",
6370
"typescript": "^5.5.3",
6471
"typescript-eslint": "^8.7.0",
6572
"vite": "^5.4.8"

client/src/App.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
Root,
1616
ServerNotification,
1717
Tool,
18+
LoggingLevel,
1819
} from "@modelcontextprotocol/sdk/types.js";
1920
import React, { Suspense, useEffect, useRef, useState } from "react";
2021
import { useConnection } from "./lib/hooks/useConnection";
@@ -91,6 +92,7 @@ const App = () => {
9192
(localStorage.getItem("lastTransportType") as "stdio" | "sse") || "stdio"
9293
);
9394
});
95+
const [logLevel, setLogLevel] = useState<LoggingLevel>("debug");
9496
const [notifications, setNotifications] = useState<ServerNotification[]>([]);
9597
const [stdErrNotifications, setStdErrNotifications] = useState<
9698
StdErrNotification[]
@@ -412,6 +414,17 @@ const App = () => {
412414
await sendNotification({ method: "notifications/roots/list_changed" });
413415
};
414416

417+
const sendLogLevelRequest = async (level: LoggingLevel) => {
418+
await makeRequest(
419+
{
420+
method: "logging/setLevel" as const,
421+
params: { level },
422+
},
423+
z.object({}),
424+
);
425+
setLogLevel(level);
426+
};
427+
415428
return (
416429
<div className="flex h-screen bg-background">
417430
<Sidebar
@@ -430,6 +443,9 @@ const App = () => {
430443
setBearerToken={setBearerToken}
431444
onConnect={connectMcpServer}
432445
stdErrNotifications={stdErrNotifications}
446+
logLevel={logLevel}
447+
sendLogLevelRequest={sendLogLevelRequest}
448+
loggingSupported={!!serverCapabilities?.logging || false}
433449
/>
434450
<div className="flex-1 flex flex-col overflow-hidden">
435451
<div className="flex-1 overflow-auto">

0 commit comments

Comments
 (0)