A Model Context Protocol (MCP) server that provides capabilities using Vectara's RAG
Project description
Vectara MCP Server
🔌 Compatible with Claude Desktop, and any other MCP Client!
Vectara MCP is also compatible with any MCP client
The Model Context Protocol (MCP) is an open standard that enables AI systems to interact seamlessly with various data sources and tools, facilitating secure, two-way connections.
Vectara-MCP provides any agentic application with access to fast, reliable RAG with reduced hallucination, powered by Vectara's Trusted RAG platform, through the MCP protocol.
Installation
You can install the package directly from PyPI:
pip install vectara-mcp
Available Tools
API Key Management
-
setup_vectara_api_key: Configure and validate your Vectara API key for the session (one-time setup).
Args:
- api_key: str, Your Vectara API key - required.
Returns:
- Success confirmation with masked API key or validation error.
-
clear_vectara_api_key: Clear the stored API key from server memory.
Returns:
- Confirmation message.
Query Tools
-
ask_vectara: Run a RAG query using Vectara, returning search results with a generated response.
Args:
- query: str, The user query to run - required.
- corpus_keys: list[str], List of Vectara corpus keys to use for the search - required.
- n_sentences_before: int, Number of sentences before the answer to include in the context - optional, default is 2.
- n_sentences_after: int, Number of sentences after the answer to include in the context - optional, default is 2.
- lexical_interpolation: float, The amount of lexical interpolation to use - optional, default is 0.005.
- max_used_search_results: int, The maximum number of search results to use - optional, default is 10.
- generation_preset_name: str, The name of the generation preset to use - optional, default is "vectara-summary-table-md-query-ext-jan-2025-gpt-4o".
- response_language: str, The language of the response - optional, default is "eng".
Returns:
- The response from Vectara, including the generated answer and the search results.
-
search_vectara: Run a semantic search query using Vectara, without generation.
Args:
- query: str, The user query to run - required.
- corpus_keys: list[str], List of Vectara corpus keys to use for the search - required.
- n_sentences_before: int, Number of sentences before the answer to include in the context - optional, default is 2.
- n_sentences_after: int, Number of sentences after the answer to include in the context - optional, default is 2.
- lexical_interpolation: float, The amount of lexical interpolation to use - optional, default is 0.005.
Returns:
- The response from Vectara, including the matching search results.
Analysis Tools
-
correct_hallucinations: Identify and correct hallucinations in generated text using Vectara's VHC (Vectara Hallucination Correction) API.
Args:
- generated_text: str, The generated text to analyze for hallucinations - required.
- documents: list[str], List of source documents to compare against - required.
- query: str, The original user query that led to the generated text - optional.
Returns:
- JSON-formatted string containing corrected text and detailed correction information.
-
eval_factual_consistency: Evaluate the factual consistency of generated text against source documents using Vectara's dedicated factual consistency evaluation API.
Args:
- generated_text: str, The generated text to evaluate for factual consistency - required.
- documents: list[str], List of source documents to compare against - required.
- query: str, The original user query that led to the generated text - optional.
Returns:
- JSON-formatted string containing factual consistency evaluation results and scoring.
Note: API key must be configured first using setup_vectara_api_key tool or VECTARA_API_KEY environment variable.
Configuration with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"Vectara": {
"command": "uv",
"args": [
"tool",
"run",
"vectara-mcp"
]
}
}
}
Usage in Claude Desktop App
Once the installation is complete, and the Claude desktop app is configured, you must completely close and re-open the Claude desktop app to see the Vectara-mcp server. You should see a hammer icon in the bottom left of the app, indicating available MCP tools, you can click on the hammer icon to see more detial on the Vectara-search and Vectara-extract tools.
Now claude will have complete access to the Vectara-mcp server, including all six Vectara tools.
Secure Setup Workflow
First-time setup (one-time per session):
- Configure your API key securely:
setup-vectara-api-key
API key: [your-vectara-api-key]
After setup, use any tools without exposing your API key:
Vectara Tool Examples
- RAG Query with Generation:
ask-vectara
Query: Who is Amr Awadallah?
Corpus keys: ["your-corpus-key"]
- Semantic Search Only:
search-vectara
Query: events in NYC?
Corpus keys: ["your-corpus-key"]
- Hallucination Correction:
correct-hallucinations
Generated text: "The capital of France is Berlin and it's located in Germany."
Documents: ["Paris is the capital of France.", "Berlin is the capital of Germany."]
- Factual Consistency Evaluation:
eval-factual-consistency
Generated text: "The Eiffel Tower was built in 1887 in London."
Documents: ["The Eiffel Tower was built in 1889 in Paris, France."]
Alternative: Environment Variable Setup
You can also set the VECTARA_API_KEY environment variable instead of using the setup tool:
export VECTARA_API_KEY=your-vectara-api-key
The server will automatically detect and use environment variables, providing the same secure experience.
Development and Release
Running Tests
# Run all tests
python -m pytest tests/ -v
# Run integration tests
python -m pytest tests/test_integration.py -v -s
# Run unit tests
python -m pytest tests/test_server.py -v
Releasing New Versions
This project uses GitHub Actions for automated PyPI publishing. To release a new version:
- Update version in
pyproject.toml - Commit and push changes to main branch
- Create and push a version tag:
git tag v<VERSION> git push origin v<VERSION>
- GitHub Actions will automatically:
- Run tests
- Build the package
- Publish to PyPI
The workflow requires PyPI trusted publishing to be configured:
- Go to PyPI trusted publisher management
- Add this repository with workflow:
publish-to-pypi.yml
Acknowledgments ✨
- Model Context Protocol for the MCP specification
- Anthropic for Claude Desktop
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vectara-mcp-0.1.5.tar.gz.
File metadata
- Download URL: vectara-mcp-0.1.5.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57ac9b781bc547adb8bd15c497aaffbe631079ee3c2ef913bbd3eb7f30843404
|
|
| MD5 |
e9805d290d273a97a3776c6f2a00d410
|
|
| BLAKE2b-256 |
105d21d0931a255a25af37a8c277037bcb9723833476b648b4d7c148314cd6d5
|
Provenance
The following attestation bundles were made for vectara-mcp-0.1.5.tar.gz:
Publisher:
publish-to-pypi.yml on vectara/vectara-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vectara-mcp-0.1.5.tar.gz -
Subject digest:
57ac9b781bc547adb8bd15c497aaffbe631079ee3c2ef913bbd3eb7f30843404 - Sigstore transparency entry: 584837508
- Sigstore integration time:
-
Permalink:
vectara/vectara-mcp@ab0fe7652739194b220c221a0f85eae5fb927a0a -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/vectara
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ab0fe7652739194b220c221a0f85eae5fb927a0a -
Trigger Event:
push
-
Statement type:
File details
Details for the file vectara_mcp-0.1.5-py3-none-any.whl.
File metadata
- Download URL: vectara_mcp-0.1.5-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18a2d6288d6adff493627daca63d410ee2b76ccebb1e46b0f562ddc2d28a4e04
|
|
| MD5 |
04738f567e2782a697bf90d0e9c2aa6b
|
|
| BLAKE2b-256 |
478873188de4ddd24200cbbea215cc958242741f90398f5bf35c7e5504e6d27c
|
Provenance
The following attestation bundles were made for vectara_mcp-0.1.5-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on vectara/vectara-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vectara_mcp-0.1.5-py3-none-any.whl -
Subject digest:
18a2d6288d6adff493627daca63d410ee2b76ccebb1e46b0f562ddc2d28a4e04 - Sigstore transparency entry: 584837510
- Sigstore integration time:
-
Permalink:
vectara/vectara-mcp@ab0fe7652739194b220c221a0f85eae5fb927a0a -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/vectara
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ab0fe7652739194b220c221a0f85eae5fb927a0a -
Trigger Event:
push
-
Statement type: