2026-01-05 21:12:05 +09:00
|
|
|
import { describe, expect, test } from "bun:test"
|
2026-04-04 21:30:42 +09:00
|
|
|
import { createBuiltinMcps } from "../index"
|
2026-01-05 21:12:05 +09:00
|
|
|
|
|
|
|
|
describe("createBuiltinMcps", () => {
|
|
|
|
|
test("should return all MCPs when disabled_mcps is empty", () => {
|
2026-02-01 16:47:50 +09:00
|
|
|
// given
|
2026-01-05 21:12:05 +09:00
|
|
|
const disabledMcps: string[] = []
|
|
|
|
|
|
2026-02-01 16:47:50 +09:00
|
|
|
// when
|
2026-01-05 21:12:05 +09:00
|
|
|
const result = createBuiltinMcps(disabledMcps)
|
|
|
|
|
|
2026-02-01 16:47:50 +09:00
|
|
|
// then
|
2026-04-05 01:01:19 +09:00
|
|
|
expect(Object.keys(result).length).toBeGreaterThan(0)
|
|
|
|
|
expect(result.websearch).toBeDefined()
|
|
|
|
|
expect(result.context7).toBeDefined()
|
|
|
|
|
expect(result.grep_app).toBeDefined()
|
2026-05-18 12:11:21 +09:00
|
|
|
expect(result.lsp).toBeDefined()
|
2026-01-05 21:12:05 +09:00
|
|
|
})
|
|
|
|
|
|
2026-04-04 21:30:42 +09:00
|
|
|
test("should filter out disabled MCPs", () => {
|
2026-02-01 16:47:50 +09:00
|
|
|
// given
|
2026-04-04 21:30:42 +09:00
|
|
|
const disabledMcps = ["websearch"]
|
2026-01-05 21:12:05 +09:00
|
|
|
|
2026-02-01 16:47:50 +09:00
|
|
|
// when
|
2026-01-05 21:12:05 +09:00
|
|
|
const result = createBuiltinMcps(disabledMcps)
|
|
|
|
|
|
2026-02-01 16:47:50 +09:00
|
|
|
// then
|
2026-04-05 01:01:19 +09:00
|
|
|
expect(result.websearch).toBeUndefined()
|
|
|
|
|
expect(result.context7).toBeDefined()
|
|
|
|
|
expect(result.grep_app).toBeDefined()
|
2026-05-18 12:11:21 +09:00
|
|
|
expect(result.lsp).toBeDefined()
|
2026-01-05 21:12:05 +09:00
|
|
|
})
|
|
|
|
|
|
2026-04-04 21:30:42 +09:00
|
|
|
test("should return empty array when all MCPs are disabled", () => {
|
|
|
|
|
// given - disable all known MCPs
|
2026-05-18 12:11:21 +09:00
|
|
|
const disabledMcps = ["websearch", "context7", "grep_app", "lsp"]
|
2026-01-05 21:12:05 +09:00
|
|
|
|
2026-02-01 16:47:50 +09:00
|
|
|
// when
|
2026-01-05 21:12:05 +09:00
|
|
|
const result = createBuiltinMcps(disabledMcps)
|
|
|
|
|
|
2026-04-04 21:30:42 +09:00
|
|
|
// then - may still have MCPs we didn't list
|
2026-04-05 01:01:19 +09:00
|
|
|
const remainingMcpNames = Object.keys(result)
|
2026-04-04 21:30:42 +09:00
|
|
|
expect(remainingMcpNames).not.toContain("websearch")
|
|
|
|
|
expect(remainingMcpNames).not.toContain("context7")
|
2026-04-05 01:01:19 +09:00
|
|
|
expect(remainingMcpNames).not.toContain("grep_app")
|
2026-05-18 12:11:21 +09:00
|
|
|
expect(remainingMcpNames).not.toContain("lsp")
|
2026-04-05 01:01:19 +09:00
|
|
|
expect(remainingMcpNames).toEqual([])
|
2026-02-02 03:55:50 +08:00
|
|
|
})
|
2026-04-05 01:01:19 +09:00
|
|
|
})
|