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. You can install the package directly from PyPI: - Security: Built-in authentication via bearer tokens - Encryption: HTTPS ready - Rate Limiting: 100 requests/minute by default - CORS Protection: Configurable origin validatio
Add this skill
npx mdskills install vectara/vectara-mcpWell-documented MCP server providing RAG capabilities with strong security defaults and multiple transport options
1# Vectara MCP Server2345678> ๐ **Compatible with [Claude Desktop](https://claude.ai/desktop), and any other MCP Client!**9>10> Vectara MCP is also compatible with any MCP client11>1213The 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.1415Vectara-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.1617## Installation1819You can install the package directly from PyPI:2021```bash22pip install vectara-mcp23```2425## Quick Start2627### Secure by Default (HTTP/SSE with Authentication)2829```bash30# Start server with secure HTTP transport (DEFAULT)31python -m vectara_mcp32# Server running at http://127.0.0.1:8000 with authentication enabled33```3435### Local Development Mode (STDIO)3637```bash38# For Claude Desktop or local development (less secure)39python -m vectara_mcp --stdio40# โ ๏ธ Warning: STDIO transport is less secure. Use only for local development.41```4243### Configuration Options4445```bash46# Custom host and port47python -m vectara_mcp --host 0.0.0.0 --port 80804849# SSE transport mode50python -m vectara_mcp --transport sse --path /sse5152# Disable authentication (DANGEROUS - dev only)53python -m vectara_mcp --no-auth54```5556## Transport Modes5758### HTTP Transport (Default - Recommended)59- **Security:** Built-in authentication via bearer tokens60- **Encryption:** HTTPS ready61- **Rate Limiting:** 100 requests/minute by default62- **CORS Protection:** Configurable origin validation63- **Use Case:** Production deployments, cloud environments6465### SSE Transport66- **Streaming:** Server-Sent Events for real-time updates67- **Authentication:** Bearer token support68- **Compatibility:** Works with legacy MCP clients69- **Use Case:** Real-time streaming applications7071### STDIO Transport72- **โ ๏ธ Security Warning:** No transport-layer security73- **Performance:** Low latency for local communication74- **Use Case:** Local development, Claude Desktop75- **Requirement:** Must be explicitly enabled with `--stdio` flag7677## Environment Variables7879```bash80# Required81export VECTARA_API_KEY="your-api-key"8283# Optional84export VECTARA_AUTHORIZED_TOKENS="token1,token2" # Additional auth tokens85export VECTARA_ALLOWED_ORIGINS="http://localhost:*,https://app.example.com"86export VECTARA_TRANSPORT="http" # Default transport mode87export VECTARA_AUTH_REQUIRED="true" # Enforce authentication88```8990## Authentication9192### HTTP/SSE Transport93When using HTTP or SSE transport, authentication is required by default:9495```bash96# Using curl with bearer token97curl -H "Authorization: Bearer $VECTARA_API_KEY" \98 -H "Content-Type: application/json" \99 -X POST http://localhost:8000/call/ask_vectara \100 -d '{"query": "What is Vectara?", "corpus_keys": ["my-corpus"]}'101102# Using X-API-Key header (alternative)103curl -H "X-API-Key: $VECTARA_API_KEY" \104 http://localhost:8000/sse105```106107### Disabling Authentication (Development Only)108```bash109# โ ๏ธ NEVER use in production110python -m vectara_mcp --no-auth111```112113## Available Tools114115### API Key Management116- **setup_vectara_api_key:**117 Configure and validate your Vectara API key for the session (one-time setup).118119 Args:120 - api_key: str, Your Vectara API key - required.121122 Returns:123 - Success confirmation with masked API key or validation error.124125126- **clear_vectara_api_key:**127 Clear the stored API key from server memory.128129 Returns:130 - Confirmation message.131132### Query Tools133- **ask_vectara:**134 Run a RAG query using Vectara, returning search results with a generated response.135136 Args:137 - query: str, The user query to run - required.138 - corpus_keys: list[str], List of Vectara corpus keys to use for the search - required.139 - n_sentences_before: int, Number of sentences before the answer to include in the context - optional, default is 2.140 - n_sentences_after: int, Number of sentences after the answer to include in the context - optional, default is 2.141 - lexical_interpolation: float, The amount of lexical interpolation to use - optional, default is 0.005.142 - max_used_search_results: int, The maximum number of search results to use - optional, default is 10.143 - 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".144 - response_language: str, The language of the response - optional, default is "eng".145146 Returns:147 - The response from Vectara, including the generated answer and the search results.148149- **search_vectara:**150 Run a semantic search query using Vectara, without generation.151152 Args:153 - query: str, The user query to run - required.154 - corpus_keys: list[str], List of Vectara corpus keys to use for the search - required.155 - n_sentences_before: int, Number of sentences before the answer to include in the context - optional, default is 2.156 - n_sentences_after: int, Number of sentences after the answer to include in the context - optional, default is 2.157 - lexical_interpolation: float, The amount of lexical interpolation to use - optional, default is 0.005.158159 Returns:160 - The response from Vectara, including the matching search results.161162### Analysis Tools163- **correct_hallucinations:**164 Identify and correct hallucinations in generated text using Vectara's VHC (Vectara Hallucination Correction) API.165166 Args:167 - generated_text: str, The generated text to analyze for hallucinations - required.168 - documents: list[str], List of source documents to compare against - required.169 - query: str, The original user query that led to the generated text - optional.170171 Returns:172 - JSON-formatted string containing corrected text and detailed correction information.173174- **eval_factual_consistency:**175 Evaluate the factual consistency of generated text against source documents using Vectara's dedicated factual consistency evaluation API.176177 Args:178 - generated_text: str, The generated text to evaluate for factual consistency - required.179 - documents: list[str], List of source documents to compare against - required.180 - query: str, The original user query that led to the generated text - optional.181182 Returns:183 - JSON-formatted string containing factual consistency evaluation results and scoring.184185**Note:** API key must be configured first using `setup_vectara_api_key` tool or `VECTARA_API_KEY` environment variable.186187188## Configuration with Claude Desktop189190To use with Claude Desktop, update your configuration to use STDIO transport:191192```json193{194 "mcpServers": {195 "Vectara": {196 "command": "python",197 "args": ["-m", "vectara_mcp", "--stdio"],198 "env": {199 "VECTARA_API_KEY": "your-api-key"200 }201 }202 }203}204```205206Or using uv:207208```json209{210 "mcpServers": {211 "Vectara": {212 "command": "uv",213 "args": ["tool", "run", "vectara-mcp", "--stdio"]214 }215 }216}217```218219**Note:** Claude Desktop requires STDIO transport. While less secure than HTTP, it's acceptable for local desktop use.220221## Usage in Claude Desktop App222223Once 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 detail on the Vectara-search and Vectara-extract tools.224225Now claude will have complete access to the Vectara-mcp server, including all six Vectara tools.226227## Secure Setup Workflow228229**First-time setup (one-time per session):**2301. Configure your API key securely:231```232setup-vectara-api-key233API key: [your-vectara-api-key]234```235236237**After setup, use any tools without exposing your API key:**238239### Vectara Tool Examples2402411. **RAG Query with Generation**:242```243ask-vectara244Query: Who is Amr Awadallah?245Corpus keys: ["your-corpus-key"]246```2472482. **Semantic Search Only**:249```250search-vectara251Query: events in NYC?252Corpus keys: ["your-corpus-key"]253```2542553. **Hallucination Detection & Correction**:256```257correct-hallucinations258Generated text: [text to check]259Documents: ["source1", "source2"]260```2612624. **Factual Consistency Evaluation**:263```264eval-factual-consistency265Generated text: [text to evaluate]266Documents: ["reference1", "reference2"]267```268269## Security Best Practices2702711. **Always use HTTP transport for production** - Never expose STDIO transport to the network2722. **Keep authentication enabled** - Only disable with `--no-auth` for local testing2733. **Use HTTPS in production** - Deploy behind a reverse proxy with TLS termination2744. **Configure CORS properly** - Set `VECTARA_ALLOWED_ORIGINS` to restrict access2755. **Rotate API keys regularly** - Update `VECTARA_API_KEY` and `VECTARA_AUTHORIZED_TOKENS`2766. **Monitor rate limits** - Default 100 req/min, adjust based on your needs277278See [SECURITY.md](SECURITY.md) for detailed security guidelines.279280## Support281282For issues, questions, or contributions, please visit:283https://github.com/vectara/vectara-mcp
Full transparency โ inspect the skill content before installing.