PHANTOM
🇮🇳 IN
Skip to content

Feature/experimental mcp server#6067

Draft
tpayet wants to merge 7 commits intomeilisearch:mainfrom
tpayet:feature/experimental-mcp-server
Draft

Feature/experimental mcp server#6067
tpayet wants to merge 7 commits intomeilisearch:mainfrom
tpayet:feature/experimental-mcp-server

Conversation

@tpayet
Copy link
Member

@tpayet tpayet commented Dec 19, 2025

Related issue

Fixes #...

Requirements

⚠️ Ensure the following requirements before merging ⚠️

  • Automated tests have been added.
  • If some tests cannot be automated, manual rigorous tests should be applied.
  • ⚠️ If there is any change in the DB:
    • Test that any impacted DB still works as expected after using --experimental-dumpless-upgrade on a DB created with the last released Meilisearch
    • Test that during the upgrade, search is still available (artificially make the upgrade longer if needed)
    • Set the db change label.
  • If necessary, the feature have been tested in the Cloud production environment (with prototypes) and the Cloud UI is ready.
  • If necessary, the documentation related to the implemented feature in the PR is ready.
  • If necessary, the integrations related to the implemented feature in the PR are ready.

tpayet and others added 7 commits December 4, 2025 12:15
Implements an MCP server behind the `experimental-mcp` feature flag, exposing
Meilisearch functionality through the JSON-RPC 2.0 protocol at /mcp endpoint.

Features:
- MCP protocol implementation (initialize, tools/list, tools/call)
- Session management with Mcp-Session-Id header
- Three tools: meilisearch_list_indexes, meilisearch_get_index_info, meilisearch_search
- Batch request support per JSON-RPC 2.0 spec
- Comprehensive integration test suite (17 tests)

The MCP server enables AI assistants (Claude, etc.) to discover available indexes
and perform searches against a Meilisearch instance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove dead code from protocol.rs (unused McpMethod enum and ToolCallParams struct)
- Fix protocol.rs docstring to reference HTTP transport instead of STDIO
- Use consistent camelCase parameter naming for get_index_info tool (indexUid)
- Update tests to use the new parameter name

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add TTL-based session cleanup (1 hour expiry)
- Add max sessions limit (10000) with forced cleanup
- Track last_accessed timestamp on each session
- Change verbose info!/debug! logging to trace! level
- Keep tool execution logging at debug! level
- Replace .unwrap() with .expect() for better panic messages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- tools.rs: Reduce redundant clones in get_index_info and search functions
  by moving ownership earlier
- error.rs: Remove unused error variants (AttributeNotFilterable,
  AttributeNotSortable, EmbedderNotFound, SearchError) and their match arms

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Migrate MCP from compile-time feature flags (#[cfg(feature = "experimental-mcp")])
to runtime toggle via RuntimeTogglableFeatures, consistent with other experimental
features like chat, network, and metrics.

Changes:
- Add `mcp: bool` to RuntimeTogglableFeatures struct
- Add `check_mcp()` method to RoFeatures for runtime gating
- Always register /mcp route, check feature at handler level
- Remove all #[cfg(feature = "experimental-mcp")] conditions
- Make strsim a regular dependency (was conditional)
- Update tests to enable MCP via experimental features API
- Add test for feature gate behavior when disabled

Users can now enable MCP via PATCH /experimental-features {"mcp": true}

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive documentation for the experimental MCP server:
- How to enable/disable the feature
- Protocol overview (JSON-RPC 2.0 over HTTP)
- Session management
- Complete tool reference with parameters and examples
- Integration examples for Claude Desktop and Python
- Error handling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Integrate with Meilisearch's existing API key authentication system
- Add action-based permission checks (search, indexes.get, settings.get)
- Support index-scoped API key restrictions in MCP endpoints
- Add comprehensive auth integration tests
- Fix filterable_attributes format in get_index_info (proper JSON values)
- Fix mcp_unknown_tool test to check JSON-RPC error correctly
- Update documentation with auth details

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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