Skip to content

feat(mcp-server): implement MCP server for Trieve API#3038

Merged
cdxker merged 6 commits intodevflowinc:mainfrom
gerred:feat/mcp-server-trieve
Jan 2, 2025
Merged

feat(mcp-server): implement MCP server for Trieve API#3038
cdxker merged 6 commits intodevflowinc:mainfrom
gerred:feat/mcp-server-trieve

Conversation

@gerred
Copy link
Copy Markdown
Contributor

@gerred gerred commented Jan 2, 2025

kapture.mp4

Description

This PR implements a Model Context Protocol (MCP) server for Trieve, enabling AI agents to use Trieve datasets as a retrieval source. The server provides a standardized interface for AI agents to search and interact with Trieve datasets through the MCP protocol.

Features

  • Dataset Access: List and access Trieve datasets from dashboard.trieve.ai
  • Search Integration: Semantic, fulltext, hybrid, and BM25 search across datasets
  • Advanced Filtering: Support for metadata filtering and tag-based search
  • Highlighting: Configurable result highlighting with score thresholds
  • Environment Management: Simple configuration via env vars or CLI args

Implementation Details

Server Implementation

  • New TypeScript-based MCP server in clients/mcp-server
  • Built on @modelcontextprotocol/sdk for MCP compatibility
  • Integrated with trieve-ts-sdk for API communication

MCP Resources

  • Dataset listing with usage statistics
  • Resource URIs follow trieve://datasets/{dataset-id} format

MCP Tools

  • search: Advanced search tool with:
    • Multiple search types (semantic, fulltext, hybrid, BM25)
    • Filtering capabilities
    • Result highlighting
    • Pagination support
    • Score thresholding

Usage

Configure credentials:

# Via environment variables
export TRIEVE_API_KEY=your-api-key
export TRIEVE_ORGANIZATION_ID=your-org-id

# Or via CLI arguments
mcp-server-trieve --api-key <key> --org-id <id>

Requirements Checklist

  • MCP server implementation
  • TypeScript setup with proper types
  • Trieve SDK integration
  • Environment/CLI configuration
  • Dataset listing
  • Advanced search capabilities
  • Error handling
  • Documentation

Related Issues

Closes #3031

/claim #3031

@gerred
Copy link
Copy Markdown
Contributor Author

gerred commented Jan 2, 2025

followups:

smithery-ai/sdk#22

and mcp.run will link issues out.

@gerred
Copy link
Copy Markdown
Contributor Author

gerred commented Jan 2, 2025

I went through and used the tool itself to optimize the responses and everything from datasets as well. It's pretty robust for multi-turn but will need evals:

Screenshot 2025-01-02 at 11 14 30 AM Screenshot 2025-01-02 at 11 14 34 AM

@skeptrunedev
Copy link
Copy Markdown
Contributor

@fedhacks as the resident MacOS user, you will have to be the one to review here

@skeptrunedev skeptrunedev requested a review from fedhacks January 2, 2025 18:36
@cdxker
Copy link
Copy Markdown
Member

cdxker commented Jan 2, 2025

image

Seems to have gotten working, Can you add instructions on how to add this into your claude desktop as an end user? Something kind of like this. https://github.com/Flux159/mcp-server-kubernetes?tab=readme-ov-file#usage-with-claude-desktop.

It took me a while to figure it out. After that it should be good to merge!

@gerred Thank you for you quick turn around on this issue!

Copy link
Copy Markdown
Member

@cdxker cdxker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above comment

@gerred
Copy link
Copy Markdown
Contributor Author

gerred commented Jan 2, 2025

Above comment

On it! There's a few configs depending on if it's Claude or Cline, so eventually I'm going to do a PR to update it to use smithery/mcp.run so that was the reasoning behind leaving it out once the Smithery side issue is resolved. But, this is still early...one sec!

@gerred
Copy link
Copy Markdown
Contributor Author

gerred commented Jan 2, 2025

Above comment

Done!

Copy link
Copy Markdown
Member

@cdxker cdxker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Approoved.

@cdxker cdxker merged commit 27b5695 into devflowinc:main Jan 2, 2025
@gerred gerred deleted the feat/mcp-server-trieve branch January 2, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: trieve mcp server

3 participants