Labsco
searchcraft-inc logo

Searchcraft

β˜… 8

from searchcraft-inc

Manage Searchcraft cluster's Documents, Indexes, Federations, Access Keys, and Analytics.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredAdvanced setup
<img alt="ReTail website screenshot" src="./header.png"> <h1 align="center">searchcraft-mcp-server</h1> <p align="center"> An MCP Server powered by <a href="https://searchcraft.io">Searchcraft</a> – the developer-first vertical search engine. </p> <p align="center"> <a href="https://www.typescriptlang.org/"> <img src="https://img.shields.io/badge/TypeScript-5.8-blue.svg?logo=typescript&style=flat" alt="TypeScript"> </a> <a href="https://nodejs.org/en/"> <img src="https://img.shields.io/badge/Node.js-22+-339933.svg?logo=node.js&style=flat" alt="Node.js"> </a> <a href="https://expressjs.com/"> <img src="https://img.shields.io/badge/Express-5.1-330033.svg?logo=express&style=flat" alt="Node.js"> </a> </p>

The Searchcraft MCP Server provides a suite of tools for managing your Searchcraft cluster's Documents, Indexes, Federations, Access Keys, and Analytics. It enables MCP Clients, like Claude Desktop, to be prompted in plain English to perform administrative actions like setting up search indexes, access keys, ingesting documents, viewing analytics, searching indexes, and more.

Building an app in 2 minutes with Searchcraft MCP Server (video link)

<div align="center"> <a href="https://youtu.be/Vs_98sUrFqA?si=m9aH-tvUAAFwQQVy" title="Watch the video"> <img src="https://img.youtube.com/vi/Vs_98sUrFqA/hqdefault.jpg" alt="Building an app in 2 minutes with Searchcraft MCP Server"> </a> </div>

Sample Prompts

Here is a sample prompt that could be used once Claude is connected to the Searchcraft MCP Server.

Copy & paste β€” that's it
I'd like to create a product search application using the create_vite_app tool.

Please use this JSON dataset https://dummyjson.com/products
First use the Searchcraft create_index_from_json tool to create the index and add the documents.

Then create an API read key for the vite app using the create_key tool.

App details:
- App name: "my-ecommerce-app"
- Endpoint: http://localhost:8000
- Index name: my-ecommerce-app

Available Tools

The Searchcraft MCP Server currently provides three categories of tools, import tools, engine api tools, and app generation tools:

Engine API Tools

These tools provide direct access to your Searchcraft cluster's core functionality for managing indexes, documents, federations, authentication, and search operations.

Index Management

Tool NameDescription
create_indexCreate a new index with the specified schema. This will empty the index if it already exists.
delete_indexDelete an index and all its documents permanently.
get_all_index_statsGet document counts and statistics for all indexes.
get_index_schemaGet the schema definition for a specific index.
get_index_statsGet statistics and metadata for a specific index (document count, etc.).
list_all_indexesGet a list of all indexes in the Searchcraft instance.
patch_indexMake partial configuration changes to an index schema (search_fields, weight_multipliers, etc.).
update_indexReplace the entire contents of an existing index with a new schema definition.

Document Management

Tool NameDescription
add_documentsAdd one or multiple documents to an index. Documents should be provided as an array of JSON objects.
delete_all_documentsDelete all documents from an index. The index will continue to exist after all documents are deleted.
delete_document_by_idDelete a single document from an index by its internal Searchcraft ID (_id).
delete_documents_by_fieldDelete one or several documents from an index by field term match (e.g., {id: 'xyz'} or {title: 'foo'}).
delete_documents_by_queryDelete one or several documents from an index by query match.
get_document_by_idGet a single document from an index by its internal Searchcraft ID (_id).

Federation Management

Tool NameDescription
create_federationCreate or update a federation with the specified configuration.
delete_federationDelete a federation permanently.
get_federation_detailsGet detailed information for a specific federation.
get_federation_statsGet document counts per index for a federation as well as the total document count.
get_organization_federationsGet a list of all federations for a specific organization.
list_all_federationsGet a list of all federations in the Searchcraft instance.
update_federationReplace the current federation entity with an updated one.

Authentication & Key Management

Tool NameDescription
create_keyCreate a new authentication key with specified permissions and access controls.
delete_all_keysDelete all authentication keys on the Searchcraft cluster. Use with extreme caution!
delete_keyDelete a specific authentication key permanently.
get_application_keysGet a list of all authentication keys associated with a specific application.
get_federation_keysGet a list of all authentication keys associated with a specific federation.
get_key_detailsGet detailed information for a specific authentication key.
get_organization_keysGet a list of all authentication keys associated with a specific organization.
list_all_keysGet a list of all authentication keys on the Searchcraft cluster.
update_keyUpdate an existing authentication key with new configuration.

Stopwords Management

Tool NameDescription
add_stopwordsAdd custom stopwords to an index. These are added on top of the default language-specific dictionary.
delete_all_stopwordsDelete all custom stopwords from an index. This only affects custom stopwords, not the default language dictionary.
delete_stopwordsDelete specific custom stopwords from an index. This only affects custom stopwords, not the default language dictionary.
get_index_stopwordsGet all stopwords for an index, including both default language dictionary and custom stopwords.

Synonyms Management

Tool NameDescription
add_synonymsAdd synonyms to an index. Synonyms only work with fuzzy queries, not exact match queries.
delete_all_synonymsDelete all synonyms from an index.
delete_synonymsDelete specific synonyms from an index by their keys.
get_index_synonymsGet all synonyms defined for an index.

Search & Analytics

Tool NameDescription
get_measure_conversionGet measurement conversion data with optional filtering and aggregation parameters. *requires Clickhouse if running locally
get_measure_summaryGet measurement summary data with optional filtering and aggregation parameters. *requires Clickhouse if running locally
get_search_resultsPerforms a search query using the Searchcraft API with support for fuzzy/exact matching, facets, and date ranges.
get_prelim_search_dataGet schema fields and facet information for a search index to understand available fields for constructing queries.
get_searchcraft_statusGet the current status of the Searchcraft search service.

Import Tools

These tools provide workflows for importing JSON data and automatically generating Searchcraft schemas. Perfect for quickly setting up new indexes from existing data sources.

Tool NameDescription
analyze_json_from_fileRead JSON data from a local file and analyze its structure to understand field types and patterns for Searchcraft index schema generation.
analyze_json_from_urlFetch JSON data from a URL and analyze its structure to understand field types and patterns for Searchcraft index schema generation.
generate_searchcraft_schemaGenerate a complete Searchcraft index schema from analyzed JSON structure, with customizable options for search fields, weights, and other index settings.
create_index_from_jsonComplete workflow to create a Searchcraft index from JSON data. Fetches JSON from URL or file, analyzes structure, generates schema, creates the index, and adds all documents in one step.

Import Tools Workflow

The import tools are designed to work together in a streamlined workflow:

  1. Analyze β†’ Use analyze_json_from_file or analyze_json_from_url to examine your JSON data structure
  2. Generate β†’ Use generate_searchcraft_schema to create a customized Searchcraft schema from the analysis
  3. Create β†’ Use the Engine API create_index tool to create the index with your generated schema
  4. Import β†’ Use add_documents to populate your new index with data

Or use the all-in-one approach:

  • One-Step β†’ Use create_index_from_json to analyze, generate schema, create the index, and import all documents in one command

App Generation Tools

These tools create complete, ready-to-run search applications from your JSON data, perfect for prototyping and demos.

Tool NameDescription
create_vite_appCreates a complete Vite + React search application from JSON data. Analyzes your data structure, generates optimized search templates, and creates a fully functional web app with Searchcraft integration.

App Generation Workflow

The app generation tools provide an end-to-end solution for creating search applications:

  1. Data Analysis β†’ Automatically analyzes your JSON structure to understand field types and content
  2. Template Generation β†’ Creates optimized search result templates based on your data fields
  3. App Creation β†’ Clones and configures a complete Vite + React application
  4. Environment Setup β†’ Configures Searchcraft connection settings
  5. Ready to Run β†’ Provides a fully functional search app you can immediately start and customize

Testing

The Searchcraft MCP Server includes a comprehensive test suite built with Vitest.

Run Tests

Copy & paste β€” that's it
# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

# Show test reports
npm run test:ui

Test Coverage

  • βœ… 89 tests covering core functionality
  • βœ… 84%+ coverage on helpers and utilities
  • βœ… 93%+ coverage on JSON analyzer
  • βœ… 100% coverage on server creation
  • βœ… Integration tests for HTTP endpoints
  • βœ… Unit tests for all major components

See test/README.md for detailed testing documentation.

Debugging

Claude Desktop Logs

To view Claude Desktop's logs for debugging MCP connections:

Copy & paste β€” that's it
yarn claude-logs

Testing with MCP Inspector

The MCP Inspector allows you to test your server tools interactively.

For stdio server (recommended):

Copy & paste β€” that's it
yarn inspect
  • Choose Transport Type: stdio
  • Command: node dist/stdio-server.js

For HTTP server:

Copy & paste β€” that's it
yarn start  # Start HTTP server first
yarn inspect
  • Choose Transport Type: Streamable HTTP
  • URL: http://localhost:3100/mcp

Manual Testing

Test HTTP server:

Copy & paste β€” that's it
# Health check
curl http://localhost:3100/health

# Test MCP endpoint
curl -X POST http://localhost:3100/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'

Test stdio server:

Copy & paste β€” that's it
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | node dist/stdio-server.js

Resources

Issues and Feature Requests

Visit https://github.com/searchcraft-inc/searchcraft-issues

License

Licensed under the Apache 2.0 License.

<p align="center"> Built with πŸ›°οΈ by the <a href="https://searchcraft.io">Searchcraft</a> team </p>