Package Exports
- @sprigr/mcp-server
- @sprigr/mcp-server/runtime
- @sprigr/mcp-server/schema/search-request.json
- @sprigr/mcp-server/search-types
- @sprigr/mcp-server/wasm-bundler
- @sprigr/mcp-server/wasm-bundler/sprigr_browser_bg.js
- @sprigr/mcp-server/wasm-nodejs
- @sprigr/mcp-server/wasm-workers
Readme
@sprigr/mcp-server
MCP server for AI agents with WASM-powered local full-text search and hybrid semantic search.
Full-text searches run locally via WebAssembly (~5ms). Hybrid semantic search combines keyword matching with vector embeddings for higher relevance. Writes go to the Sprigr API. The binary index auto-refreshes when your data changes.
Two ways to consume this package
| Sub-path | Use it for | Loads WASM via |
|---|---|---|
@sprigr/mcp-server (default) |
Local Node.js stdio MCP server invoked by Claude Desktop / Cursor / etc. | --target nodejs build, auto-loads from filesystem |
@sprigr/mcp-server/runtime |
Cloudflare Workers / bundled environments — embed the search engine directly in your Worker | Consumer injects a WASM module |
@sprigr/mcp-server/wasm-bundler |
The companion --target bundler WASM build for the runtime sub-path |
Imported as a module by your bundler |
@sprigr/mcp-server/wasm-nodejs |
The --target nodejs WASM build, exposed for completeness |
Auto-loads via fs |
Workers / bundler example:
import * as wasmModule from '@sprigr/mcp-server/wasm-bundler';
import { createSprigrRuntime } from '@sprigr/mcp-server/runtime';
const runtime = createSprigrRuntime({
apiKey: env.SPRIGR_API_KEY,
wasmModule,
});
const results = await runtime.search('my-index', 'wireless headphones');
// ↑ runs locally via WASM (~5ms), or falls back to the cloud for semantic searchThe runtime exposes search, importObjects, getObject, listIndexes, deleteObjects, and invalidate. It auto-invalidates the local engine after writes that go through it.
Quick Start
Add to your AI client config (Claude Desktop, Cursor, Windsurf, etc.):
{
"mcpServers": {
"sprigr": {
"command": "npx",
"args": ["-y", "@sprigr/mcp-server"],
"env": {
"SPRIGR_API_KEY": "your-api-key"
}
}
}
}Don't have an API key? Ask your AI agent to use the signup tool, or visit sprigr.com.
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
SPRIGR_API_KEY |
Yes | — | Your Sprigr API key |
SPRIGR_API_BASE |
No | https://search.sprigr.com |
API base URL |
How It Works
AI Agent ──stdio──> @sprigr/mcp-server (local Node.js)
│
├── search → Local WASM engine (~5ms)
├── import/delete → Sprigr API → invalidate local cache
└── On change → re-download binary index → reload WASM- Searches run entirely in-process via a compiled WASM search engine, with optional hybrid semantic search for improved relevance
- Writes (import, delete, create index, update settings) go to the Sprigr API
- After any write, the local binary index is automatically refreshed on the next search
- Cache version checks are throttled (5s TTL) to avoid unnecessary API calls
Available Tools
| Tool | Description |
|---|---|
signup |
Create a Sprigr account and get an API key |
list_indexes |
List all indexes in your account |
create_index |
Create a search index with searchable attributes and facets |
update_settings |
Update index settings (searchable attributes, facets, synonyms) |
import_objects |
Upsert JSON objects into an index (max 1000/call, same objectID = replace) |
search |
Full-text search with filters, facets, pagination, and field selection |
multi_search |
Search across multiple indexes in one call |
get_object |
Fetch a single object by ID |
export_objects |
Export all objects from an index as JSON (paginated) |
get_stats |
Get account statistics |
delete_objects |
Delete objects by ID (max 1000/call) |
delete_index |
Permanently delete an entire index |
clear_index |
Remove all objects but keep index settings |
set_alias |
Point an alias name at an index (for zero-downtime reindexing) |
delete_alias |
Remove an alias |
list_aliases |
List all index aliases |
Requirements
- Node.js 18+
License
MIT