Contextual MCP Server
OfficialSupports configuration of API keys and agent IDs through environment variables stored in a .env file.
Allows connection to a repository containing the MCP server code, which can be cloned and customized for domain-specific RAG capabilities.
Uses the Contextual AI Python SDK to provide RAG capabilities, query processing, and potential extension to other features like agent management and retrieval settings.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Contextual MCP Serverexplain the RF345 microchip initialization sequence"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Cursor/Claude Desktop → MCP Server → Contextual AI RAG Agent
↑ ↓ ↓
└──────────────────┴─────────────┴─────────────── Response with citationsRelated MCP server: MCP Boilerplate
Prerequisites
Python 3.10 or higher
Cursor IDE and/or Claude Desktop
Contextual AI API key
MCP-compatible environment
Installation
Clone the repository:
git clone https://github.com/ContextualAI/contextual-mcp-server.git
cd contextual-mcp-serverCreate and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`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 firmsor
A research tool focused on technical documents for Omaha semiconductorsThe 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:
cat > .env << EOF
API_KEY=key...
AGENT_ID=...
EOFThe 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:
UV_PATH=$(which uv)
echo $UV_PATH
# Example output: /Users/username/miniconda3/bin/uvCreate the configuration file using the full path from step 1:
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"
]
}
}
}
EOFMove to the correct folder location, see below for options:
mkdir -p .cursor/
mv mcp.json .cursor/Configuration locations:
For Cursor:
Project-specific:
.cursor/mcp.jsonin your project directoryGlobal:
~/.cursor/mcp.jsonfor system-wide accessFor 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
# 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 agent
2. Retrieve relevant documentation
3. Generate a response with specific citations
4. Return the formatted answer to CursorKey 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:
@mcp.tool()
def new_tool(param: str) -> str:
"""Description of what the tool does"""
# Implementation
return resultLimitations
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.
Available Tools
1 toolqueryC
An enterprise search tool that can answer questions about any sort of knowledge base
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool can 'answer questions' but doesn't describe how it behaves—such as whether it returns summaries, citations, or raw data; latency; authentication needs; or rate limits. This leaves significant gaps for a search tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. It's appropriately sized for a basic tool, though it could be more structured with additional context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity as a search/query function with no annotations, no output schema, and low parameter coverage, the description is incomplete. It lacks details on behavior, output format, and parameter usage, making it inadequate for effective tool selection and invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 1 parameter with 0% description coverage, and the tool description adds no information about the 'prompt' parameter—such as what format it expects, examples, or constraints. This fails to compensate for the low schema coverage, leaving the parameter's meaning unclear.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the tool performs 'enterprise search' to 'answer questions about any sort of knowledge base', which gives a general purpose but lacks specificity about what resources it searches or how it differs from other search tools. It's vague about the exact verb and resource scope, though it distinguishes itself as a search/query tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or limitations. It mentions 'any sort of knowledge base' but doesn't specify contexts or exclusions, leaving usage entirely implicit with no sibling tools to differentiate from.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
- First observed
query
TDQS
With only one tool, there is no possibility of confusion or overlap between tools. The tool 'query' has a clearly distinct and singular purpose, making disambiguation perfect.
Since there is only one tool, naming consistency is inherently perfect. The tool name 'query' follows a simple, clear pattern with no deviations to assess.
A single tool for an 'enterprise search' server feels thin and under-scoped. While it might handle basic queries, it lacks complementary tools for managing or refining searches, making the count inappropriate for the apparent domain.
The tool surface is severely incomplete for enterprise search. It only provides a query function, missing essential operations like indexing, filtering, updating knowledge bases, or handling search results, which are critical for such a domain.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
The CustomGPT.ai MCP server is a fully managed, RAG-powered endpoint that connects large language models with private knowledge bases and external data sources. It provides tools for retrieval-augmented generation queries (send_message), data ingestion (upload_file), and source listing, enabling AI agents to query private documents like PDFs with high accuracy and real-time citations.
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
Related MCP Servers
AlicenseNot gradedqualityAmaintenanceA Model Context Protocol server that enhances AI agents by providing deep semantic understanding of codebases, enabling more intelligent interactions through advanced code search and contextual awareness.89MIT- AlicenseNot gradedqualityDmaintenanceA server that implements the Model Context Protocol, providing a standardized way to connect AI models to different data sources and tools.1511MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that exposes Retrieval-Augmented Generation capabilities and a weather tool, allowing clients to interact with document knowledge bases and retrieve weather information.-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides persistent memory and conversation continuity for Claude Desktop and Claude Code, allowing users to save and restore project context when threads hit token limits.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ContextualAI/contextual-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server