oh-my-opencode/src/mcp/index.test.ts
YeonGyu-Kim a2bfb5e556
feat(mcp): restore Exa websearch support (#549)
* feat(mcp): restore Exa MCP websearch support

- Add websearch.ts with Exa remote MCP configuration
- Update McpNameSchema to include websearch
- Wire websearch MCP into plugin initialization

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)

* test(mcp): update tests and docs for websearch MCP

- Update index.test.ts to verify 3 MCPs (websearch, context7, grep_app)
- Add Exa/websearch documentation to README.md MCPs section

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-01-07 01:24:50 +09:00

87 lines
2.5 KiB
TypeScript

import { describe, expect, test } from "bun:test"
import { createBuiltinMcps } from "./index"
describe("createBuiltinMcps", () => {
test("should return all MCPs when disabled_mcps is empty", () => {
//#given
const disabledMcps: string[] = []
//#when
const result = createBuiltinMcps(disabledMcps)
//#then
expect(result).toHaveProperty("websearch")
expect(result).toHaveProperty("context7")
expect(result).toHaveProperty("grep_app")
expect(Object.keys(result)).toHaveLength(3)
})
test("should filter out disabled built-in MCPs", () => {
//#given
const disabledMcps = ["context7"]
//#when
const result = createBuiltinMcps(disabledMcps)
//#then
expect(result).toHaveProperty("websearch")
expect(result).not.toHaveProperty("context7")
expect(result).toHaveProperty("grep_app")
expect(Object.keys(result)).toHaveLength(2)
})
test("should filter out all built-in MCPs when all disabled", () => {
//#given
const disabledMcps = ["websearch", "context7", "grep_app"]
//#when
const result = createBuiltinMcps(disabledMcps)
//#then
expect(result).not.toHaveProperty("websearch")
expect(result).not.toHaveProperty("context7")
expect(result).not.toHaveProperty("grep_app")
expect(Object.keys(result)).toHaveLength(0)
})
test("should ignore custom MCP names in disabled_mcps", () => {
//#given
const disabledMcps = ["context7", "playwright", "custom"]
//#when
const result = createBuiltinMcps(disabledMcps)
//#then
expect(result).toHaveProperty("websearch")
expect(result).not.toHaveProperty("context7")
expect(result).toHaveProperty("grep_app")
expect(Object.keys(result)).toHaveLength(2)
})
test("should handle empty disabled_mcps by default", () => {
//#given
//#when
const result = createBuiltinMcps()
//#then
expect(result).toHaveProperty("websearch")
expect(result).toHaveProperty("context7")
expect(result).toHaveProperty("grep_app")
expect(Object.keys(result)).toHaveLength(3)
})
test("should only filter built-in MCPs, ignoring unknown names", () => {
//#given
const disabledMcps = ["playwright", "sqlite", "unknown-mcp"]
//#when
const result = createBuiltinMcps(disabledMcps)
//#then
expect(result).toHaveProperty("websearch")
expect(result).toHaveProperty("context7")
expect(result).toHaveProperty("grep_app")
expect(Object.keys(result)).toHaveLength(3)
})
})