Skip to content

feat(mcp): expose semantic_search tool on the MCP server #1674

Description

@fenbox

Is your enhancement request related to a problem? Please describe

The semantic_search tool is already fully implemented but is not exposed on the public MCP server:

  • Tool definition: NewSemanticSearchTool() in internal/schema/mcp_tools/mcp_tools.go
  • Handler: MCPController.MCPSemanticSearchHandler() in internal/controller/mcp_controller.go
  • Availability check: MCPController.SemanticSearchAvailable()

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.:

if a.mcpController.SemanticSearchAvailable() {
    s.AddTool(mcp_tools.NewSemanticSearchTool(), a.mcpController.MCPSemanticSearchHandler())
}

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.

Activity

  1. added theissue type on Nov 19, 2026
  2. shaktimaan00 commented on Nov 21, 2026

    @shaktimaan00

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions