trackmcp
Back to directory
contextualai

contextual-mcp-server

View on GitHub
19 stars PythonServers & Infrastructure Updated Aug 27, 2025

Documentation

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:

    Integration Flow

    code
    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.git
    cd contextual-mcp-server

    2. Create and activate a virtual environment:

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

    3. 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:

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

    or

    code
    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  mcp.json  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.

    Frequently asked questions

    What is contextual-mcp-server?

    contextual-mcp-server is a Model Context Protocol (MCP) server listed in the TrackMCP directory.

    How do I install contextual-mcp-server?

    Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

    Is contextual-mcp-server open source?

    Yes — it is hosted on GitHub at https://github.com/contextualai/contextual-mcp-server and has 19 stars.

    Related MCP tools

    Run your own MCP server? See who uses it and what to fix.

    Measure it with TrackMCP