Skip to content

MCP server semble_search tool times out on first queries (CLI works fine) #133

@cycle2zhou

Description

@cycle2zhou

Environment

  • Semble version: v0.1.10
  • OS: macOS (darwin)
  • Agent: OpenCode (Claude Code-compatible MCP client)
  • Python/uv: uvx via uvx --from "semble[mcp]" semble
  • Repo size: Java project, ~48 relevant files for JDBC module

Description

When using the Semble MCP server through an agent harness (OpenCode), the semble_search tool consistently returns MCP error -32001: Request timed out on the first several queries. The exact same queries work immediately via the CLI.

Reproduction Steps

  1. Configure Semble as MCP server in the agent config:
    {
      "mcp": {
        "semble": {
          "type": "local",
          "command": ["uvx", "--from", "semble[mcp]", "semble"]
        }
      }
    }
  2. Start agent session and invoke semble_search with any query:
  • Query: JDBC type conversion ResultSet PreparedStatement DataType
  • Mode: hybrid or bm25
  • top_k: 1–5
  • repo:
  1. Result: MCP error -32001: Request timed out (repeated across 5+ attempts)
  2. Run the same query via CLI:
    uvx --from "semble[mcp]" semble search "AbstractJdbcRowDataConverter"
    Result: Returns results in ~1 second.
    Expected Behavior
    MCP tool should return search results within a reasonable timeout, matching CLI performance.
    Actual Behavior
    MCP tool times out with MCP error -32001: Request timed out on every attempt. CLI works fine with same repo and query.
    Additional Context
  • CLI version works correctly after a manual semble search run
  • No ~/.cache/semble directory exists (first run)
  • MCP server appears to start successfully (no startup errors)
  • Timeout occurs even with minimal query (DataType, bm25 mode, top_k: 1)
  • After CLI indexing, MCP tool eventually works on subsequent calls
  • Suggests the MCP server may not be handling initial indexing asynchronously or may have a different timeout/initialization path than CLI
    Possible Causes
  1. MCP server initialization blocks on indexing without proper async handling
  2. MCP transport layer timeout is too short for cold-start indexing
  3. Index cache path differs between CLI and MCP server (~/.cache/semble not created)
  4. MCP server may not be reusing the same index location as CLI
    Workaround
    Run semble search via CLI once to pre-build the index, then MCP tool works on subsequent calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions