
Contextual Mcp Server
io.github.NitishGourishetty由 GitHub 帳號 NitishGourishetty 發布v0.1.0更新於 Oct 24, 2026
RAG-enabled MCP server using Contextual AI. Supports single-agent and multi-agent modes.
概覽
一個本機 MCP 伺服器,將助理連接到 Contextual AI 的 RAG 代理,讓問題依據你的知識庫作答並附上引用。
- 可以做什麼
- 把特定領域的問題送到專用的 Contextual AI 代理,並在聊天用戶端回傳答案(query 指令)。從 Contextual AI 知識庫擷取相關片段,給出有來源依據的回答。回答附上引用與出處,並保留對話脈絡以支援追問。支援單代理與多代理模式,查詢工具的說明文字會影響用戶端何時把問題轉給該代理。
- 適用情境
- 當你已有 Contextual AI 代理與知識庫,希望 Cursor 或 Claude Desktop 依據這些文件回答問題並附上引用,而不是依賴模型的一般知識時使用。
- 執行需求
- 以 Python 套件形式透過 stdio 在本機執行(需要 Python 3.10 或更新版本;README 使用 uv 管理相依套件)。需要 Contextual AI API 金鑰(API_KEY),單代理模式還需要代理 ID(AGENT_ID)。需要 Cursor 或 Claude Desktop 等相容用戶端;僅限桌面環境,在遠端開發環境可能無法使用。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Contextual Mcp Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Contextual MCP Server
A Model Context Protocol (MCP) server that provides RAG (Retrieval-Augmented Generation) capabilities using Contextual AI. This server integrates with a variety of MCP clients. It provides flexibility in you can decide what functionality to offer in the server. In this readme, we will show integration with the both Cursor IDE and Claude Desktop.
Contextual AI now offers a hosted server inside the platform available at: https://mcp.app.contextual.ai/mcp/
After you connect to the server, you can use the tools, such as query, provided by the platform MCP server.
For a complete walkthrough, check out the MCP user guide.
Overview
An MCP server acts as a bridge between AI interfaces (Cursor IDE or Claude Desktop) and a specialized Contextual AI agent. It enables:
- Query Processing: Direct your domain specific questions to a dedicated Contextual AI agent
- Intelligent Retrieval: Searches through comprehensive information in your knowledge base
- Context-Aware Responses: Generates answers that are:
- Grounded in source documentation
- Include citations and attributions
- Maintain conversation context
Integration Flow
Prerequisites
- Python 3.10 or higher
- Cursor IDE and/or Claude Desktop
- Contextual AI API key
- MCP-compatible environment
Installation
- Clone the repository:
- Create and activate a virtual environment:
- Install dependencies:
Configuration
Configure MCP Server
The server requires modifications of settings or use. For example, the single_agent server should be customized with an appropriate docstring for your RAG Agent.
The docstring for your query tool is critical as it helps the MCP client understand when to route questions to your RAG agent. Make it specific to your knowledge domain. Here is an example:
or
The server also requires the following settings from your RAG Agent:
API_KEY: Your Contextual AI API keyAGENT_ID: Your Contextual AI agent ID
If you'd like to store these files in .env file you can specify them like so:
The repo also contains more advance MPC servers for multi-agent systems or a document-agent.
AI Interface Integration
This MCP server can be integrated with a variety of clients. To use with either Cursor IDE or Claude Desktop create or modify the MCP configuration file in the appropriate location:
- First, find the path to your
uvinstallation:
- Create the configuration file using the full path from step 1:
- Move to the correct folder location, see below for options:
Configuration locations:
- For Cursor:
- Project-specific:
.cursor/mcp.jsonin your project directory - Global:
~/.cursor/mcp.jsonfor system-wide access - For Claude Desktop:
- Use the same configuration file format in the appropriate Claude Desktop configuration directory
Environment Setup
This project uses uv for dependency management, which provides faster and more reliable Python package installation.
Usage
The server provides Contextual AI RAG capabilities using the python SDK, which can available a variety of commands accessible from MCP clients, such as Cursor IDE and Claude Desktop. The current server focuses on using the query command from the Contextual AI python SDK, however you could extend this to support other features such as listing all the agents, updating retrieval settings, updating prompts, extracting retrievals, or downloading metrics.
Example Usage
Key Benefits
- Accurate Responses: All answers are grounded in your documentation
- Source Attribution: Every response includes references to source documents
- Context Awareness: The system maintains conversation context for follow-up questions
- Real-time Updates: Responses reflect the latest documentation in your datastore
Development
Modifying the Server
To add new capabilities:
- Add new tools by creating additional functions decorated with
@mcp.tool() - Define the tool's parameters using Python type hints
- Provide a clear docstring describing the tool's functionality
Example:
Limitations
- The server runs locally and may not work in remote development environments
- Tool responses are subject to Contextual AI API limits and quotas
- Currently only supports stdio transport mode
For all the capabilities of Contextual AI, please check the official documentation.
來源:README.md,提交 b3a5a4f
工具
0版本歷史
1- v0.1.0最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。