Contextual Mcp Server

io.github.NitishGourishettyPublished by GitHub account NitishGourishettyv0.1.0Updated Oct 24, 2026

RAG-enabled MCP server using Contextual AI. Supports single-agent and multi-agent modes.

VerifiedSTDIODesktop onlyKnowledge & MemoryAI & ML

Overview

AI-generated overview

A local MCP server that connects an assistant to a Contextual AI RAG agent, so questions are answered from your knowledge base with citations.

What you can do
Send domain-specific questions to a dedicated Contextual AI agent and get answers back in the chat client (query command). Retrieve relevant passages from your Contextual AI knowledge base and return responses grounded in source documentation. Return answers with citations and attributions, keeping conversation context for follow-up questions. Support single-agent and multi-agent setups, with the query tool's docstring steering when the client routes questions to the agent.
When to use it
Use it when you already have a Contextual AI agent and knowledge base and want Cursor or Claude Desktop to answer domain questions from that documentation with citations, rather than from general model knowledge.
Requirements
Runs locally over stdio as a Python package (Python 3.10 or higher; the README uses uv for dependencies). Needs a Contextual AI API key (API_KEY) and, in single-agent mode, an agent ID (AGENT_ID). A compatible client such as Cursor or Claude Desktop is required; it is desktop-only and not usable in remote development environments.
Before you install
Requires a Contextual AI API key, a secret stored in the environment or a .env file, so keep that file out of version control. Questions and retrieved content are sent to the Contextual AI service, and responses are subject to its API limits and quotas. The server is meant to be customized, including the query tool's docstring, so review local changes before use.

Installation

In SourceWeft

  1. Open Contextual Mcp Server in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

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:

  1. Query Processing: Direct your domain specific questions to a dedicated Contextual AI agent
  2. Intelligent Retrieval: Searches through comprehensive information in your knowledge base
  3. Context-Aware Responses: Generates answers that are:
  • Grounded in source documentation
  • Include citations and attributions
  • Maintain conversation context

Integration Flow

Cursor/Claude Desktop → MCP Server → Contextual AI RAG Agent        ↑                  ↓             ↓                                 └──────────────────┴─────────────┴─────────────── Response with citations

Prerequisites

  • Python 3.10 or higher
  • Cursor IDE and/or Claude Desktop
  • Contextual AI API key
  • MCP-compatible environment

Installation

  1. Clone the repository:
bash
git clone https://github.com/ContextualAI/contextual-mcp-server.gitcd contextual-mcp-server
  1. Create and activate a virtual environment:
bash
python -m venv .venvsource .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
  1. Install dependencies:
bash
pip install -e .

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:

A research tool focused on financial data on the largest US firms

or

A research tool focused on technical documents for Omaha semiconductors

The server also requires the following settings from your RAG Agent:

  • API_KEY: Your Contextual AI API key
  • AGENT_ID: Your Contextual AI agent ID

If you'd like to store these files in .env file you can specify them like so:

bash
cat > .env << EOFAPI_KEY=key...AGENT_ID=...EOF

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:

  1. First, find the path to your uv installation:
bash
UV_PATH=$(which uv)echo $UV_PATH# Example output: /Users/username/miniconda3/bin/uv
  1. Create the configuration file using the full path from step 1:
bash
cat > mcp.json << EOF{ "mcpServers": {   "ContextualAI-TechDocs": {     "command": "$UV_PATH", # make sure this is set properly     "args": [       "--directory",       "\${workspaceFolder}",  # Will be replaced with your project path       "run",       "multi-agent/server.py"     ]   } }}EOF
  1. Move to the correct folder location, see below for options:
bash
mkdir -p .cursor/mv mcp.json .cursor/

Configuration locations:

  • For Cursor:
  • Project-specific: .cursor/mcp.json in your project directory
  • Global: ~/.cursor/mcp.json for 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

python
# In Cursor, you might ask:"Show me the code for initiating the RF345 microchip?"
# The MCP client will:1. Determine if this should be routed to the MCP Server
# Then the MCP server will:1. Route the query to the Contextual AI agent2. Retrieve relevant documentation3. Generate a response with specific citations4. Return the formatted answer to Cursor

Key Benefits

  1. Accurate Responses: All answers are grounded in your documentation
  2. Source Attribution: Every response includes references to source documents
  3. Context Awareness: The system maintains conversation context for follow-up questions
  4. Real-time Updates: Responses reflect the latest documentation in your datastore

Development

Modifying the Server

To add new capabilities:

  1. Add new tools by creating additional functions decorated with @mcp.tool()
  2. Define the tool's parameters using Python type hints
  3. Provide a clear docstring describing the tool's functionality

Example:

python
@mcp.tool()def new_tool(param: str) -> str:   """Description of what the tool does"""   # Implementation   return result

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.

Source: README.md at commit b3a5a4f

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.1.0LatestSep 16, 2026

Score

40% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

    Declare a license in the repository or the registry entry.