You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(mcp): expose semantic_search tool on the MCP server #1674
However, RegisterMCPRouter in internal/router/mcp_router.go only registers the six basic tools (get_questions, get_answers_by_question_id, get_comments, get_tags, get_tag_detail, get_user). As a result, external MCP clients (Claude Desktop, Cursor, etc.) cannot use semantic search even when a VectorSearch plugin is enabled — the capability is currently only wired into the internal AI chat tool list.
Describe the solution you'd like
Register the tool on the MCP server when a VectorSearch plugin is available, e.g.:
This keeps the tool invisible on sites without a vector search plugin, consistent with how the AI chat tools behave today.
Describe alternatives you've considered
Always registering the tool and returning an error message when no VectorSearch plugin is configured. This was rejected because it exposes a tool that can never succeed and wastes the client's context window; conditional registration better matches the existing SemanticSearchAvailable() behavior used by the AI chat tools.
Opened #1681 for this: RegisterMCPRouter now registers semantic_search when SemanticSearchAvailable() reports a VectorSearch plugin, and leaves it out otherwise, so external MCP clients see the same capability the AI chat does.
internal/router/mcp_router.go — the tool registrations move into addMCPTools(s, c, semanticSearchAvailable); the tool is added last, only when available. No new tool or handler: NewSemanticSearchTool() and MCPSemanticSearchHandler() are used as they are.
internal/router/mcp_router_test.go — covers both branches (7 tools with a plugin, 6 without), mirroring internal/controller/ai_tools_test.go.
Gates in a golang:1.25-bookworm container on main @ 9e6ca4a: go build ./..., go vet, go test ./... (25 packages ok), make test, and golangci-lint run ./internal/router/... (0 issues) all pass. make lint itself needs Docker inside the runner for the ASF-header script, so I ran that script's check by diffing headers and golangci-lint directly.
Happy to adjust the shape if you would rather keep the registration inline in RegisterMCPRouter.
Activity
shaktimaan00 commentedon Nov 21, 2026
Opened #1681 for this:
RegisterMCPRouternow registerssemantic_searchwhenSemanticSearchAvailable()reports a VectorSearch plugin, and leaves it out otherwise, so external MCP clients see the same capability the AI chat does.internal/router/mcp_router.go— the tool registrations move intoaddMCPTools(s, c, semanticSearchAvailable); the tool is added last, only when available. No new tool or handler:NewSemanticSearchTool()andMCPSemanticSearchHandler()are used as they are.internal/router/mcp_router_test.go— covers both branches (7 tools with a plugin, 6 without), mirroringinternal/controller/ai_tools_test.go.Gates in a
golang:1.25-bookwormcontainer onmain@ 9e6ca4a:go build ./...,go vet,go test ./...(25 packages ok),make test, andgolangci-lint run ./internal/router/...(0 issues) all pass.make lintitself needs Docker inside the runner for the ASF-header script, so I ran that script's check by diffing headers and golangci-lint directly.Happy to adjust the shape if you would rather keep the registration inline in
RegisterMCPRouter.