Contextual MCP Server

by ContextualAI

21 stars
139 downloads
Not rated
GitHub

Description

# 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…

About

# 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…

Details

Author
ContextualAI
GitHub stars
21
Downloads
139
Categories
Search, Knowledge Base, AI, Other

- Query processing via a dedicated Contextual AI agent
- Intelligent retrieval from a comprehensive knowledge base
- Context-aware responses grounded in source documentation
- Responses include citations and attributions
- Maintains conversation context for follow-up questions
- Flexible tooling; new tools can be added with @mcp.tool()

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Contextual MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install with Python 3.10 or higher, clone the repo, create a virtual environment, and run pip install -e .. Configure by setting your Contextual AI API key and agent ID in a .env file (or directly), then modify the MCP configuration file (.cursor/mcp.json or Claude Desktop config) with the path to uv and the server script. Invoke the query tool from any MCP client.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "contextual mcp server": {
            "contextual-mcp-server": {
                "command": "python",
                "args": [
                    "-m",
                    "venv",
                    ".venv"
                ]
            }
        }
    }
}

McpServers

{
    "contextual-mcp-server": {
        "command": "python",
        "args": [
            "-m",
            "venv",
            ".venv"
        ]
    }
}

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:

git clone https://github.com/ContextualAI/contextual-mcp-server.git
cd contextual-mcp-server

2. Create and activate a virtual environment:

python -m venv .venv
source .venv/bin/activate # On Windows, use .venv\Scripts\activate

3. Install dependencies:

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:

cat > .env << EOF
API_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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.