Skip to content

feat(mcp): add MCP server discovery (Phase 6)#16

Merged
MadBomber merged 1 commit intomainfrom
develop
Mar 22, 2026
Merged

feat(mcp): add MCP server discovery (Phase 6)#16
MadBomber merged 1 commit intomainfrom
develop

Conversation

@MadBomber
Copy link
Copy Markdown
Owner

Summary

  • Adds MCP::ServerDiscovery — TF cosine similarity selection of MCP servers by query relevance
  • MCP::Server gains a :description field used as the topic text for scoring
  • Robot gains mcp_discovery: true — filters servers before the first ensure_mcp_clients call
  • Fallback to all servers when: no descriptions, classifier unavailable, blank query, or no match above threshold

What ships

File Change
lib/robot_lab/mcp/server_discovery.rb New — ServerDiscovery module
lib/robot_lab/mcp/server.rb description attr reader + constructor param + to_h
lib/robot_lab/robot.rb mcp_discovery: false constructor param + run-time filter hook
test/robot_lab/mcp/server_discovery_test.rb 17 tests (selection, fallbacks, helpers)
examples/28_mcp_discovery.rb Demo — no LLM calls, exercises all code paths
docs/guides/mcp-integration.md "Server Discovery" section
examples/README.md Example 28 entry
improvements.md #9 marked DONE, Phase 6 complete

Test plan

  • bundle exec rake test → 1081 runs, 0 failures, 0 errors, 0 skips, 98.39% coverage
  • ruby examples/28_mcp_discovery.rb — correct server selected for each query
  • All fallback cases verified (no descriptions, blank query, high threshold)

🤖 Generated with Claude Code

MCP::ServerDiscovery.select(query, from:, threshold:) scores each
server's name+description against the user query and returns only
the relevant subset. mcp_discovery: true on Robot enables automatic
filtering before the first MCP connection.

MCP::Server gains a :description field. Falls back to all servers
when no descriptions are present, the classifier gem is unavailable,
the query is blank, or nothing scores above DEFAULT_THRESHOLD (0.05).

1081 tests, 0 failures, 98.39% coverage.
Demo: examples/28_mcp_discovery.rb
@MadBomber MadBomber merged commit 092cd89 into main Mar 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant