|
|
@@ -71,6 +71,7 @@ describe("McpHub", () => {
|
|
|
JSON.stringify({
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
alwaysAllow: ["allowed-tool"],
|
|
|
@@ -87,6 +88,7 @@ describe("McpHub", () => {
|
|
|
const mockConfig = {
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
alwaysAllow: [],
|
|
|
@@ -109,6 +111,7 @@ describe("McpHub", () => {
|
|
|
const mockConfig = {
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
alwaysAllow: ["existing-tool"],
|
|
|
@@ -131,6 +134,7 @@ describe("McpHub", () => {
|
|
|
const mockConfig = {
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
},
|
|
|
@@ -155,6 +159,7 @@ describe("McpHub", () => {
|
|
|
const mockConfig = {
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
disabled: false,
|
|
|
@@ -294,6 +299,7 @@ describe("McpHub", () => {
|
|
|
it("should validate timeout values", () => {
|
|
|
// Test valid timeout values
|
|
|
const validConfig = {
|
|
|
+ type: "stdio",
|
|
|
command: "test",
|
|
|
timeout: 60,
|
|
|
}
|
|
|
@@ -301,9 +307,9 @@ describe("McpHub", () => {
|
|
|
|
|
|
// Test invalid timeout values
|
|
|
const invalidConfigs = [
|
|
|
- { command: "test", timeout: 0 }, // Too low
|
|
|
- { command: "test", timeout: 3601 }, // Too high
|
|
|
- { command: "test", timeout: -1 }, // Negative
|
|
|
+ { type: "stdio", command: "test", timeout: 0 }, // Too low
|
|
|
+ { type: "stdio", command: "test", timeout: 3601 }, // Too high
|
|
|
+ { type: "stdio", command: "test", timeout: -1 }, // Negative
|
|
|
]
|
|
|
|
|
|
invalidConfigs.forEach((config) => {
|
|
|
@@ -315,7 +321,7 @@ describe("McpHub", () => {
|
|
|
const mockConnection: McpConnection = {
|
|
|
server: {
|
|
|
name: "test-server",
|
|
|
- config: JSON.stringify({ command: "test" }), // No timeout specified
|
|
|
+ config: JSON.stringify({ type: "stdio", command: "test" }), // No timeout specified
|
|
|
status: "connected",
|
|
|
},
|
|
|
client: {
|
|
|
@@ -338,7 +344,7 @@ describe("McpHub", () => {
|
|
|
const mockConnection: McpConnection = {
|
|
|
server: {
|
|
|
name: "test-server",
|
|
|
- config: JSON.stringify({ command: "test", timeout: 120 }), // 2 minutes
|
|
|
+ config: JSON.stringify({ type: "stdio", command: "test", timeout: 120 }), // 2 minutes
|
|
|
status: "connected",
|
|
|
},
|
|
|
client: {
|
|
|
@@ -363,6 +369,7 @@ describe("McpHub", () => {
|
|
|
const mockConfig = {
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
timeout: 60,
|
|
|
@@ -385,6 +392,7 @@ describe("McpHub", () => {
|
|
|
const mockConfig = {
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
timeout: 60,
|
|
|
@@ -406,6 +414,7 @@ describe("McpHub", () => {
|
|
|
server: {
|
|
|
name: "test-server",
|
|
|
config: JSON.stringify({
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
timeout: 3601, // Invalid timeout
|
|
|
@@ -435,6 +444,7 @@ describe("McpHub", () => {
|
|
|
const mockConfig = {
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
timeout: 60,
|
|
|
@@ -458,6 +468,7 @@ describe("McpHub", () => {
|
|
|
const mockConfig = {
|
|
|
mcpServers: {
|
|
|
"test-server": {
|
|
|
+ type: "stdio",
|
|
|
command: "node",
|
|
|
args: ["test.js"],
|
|
|
timeout: 60,
|