A Pydantic AI agent that leverages the Context7 MCP server for intelligent document retrieval and context-aware responses through a command-line interface (CLI).
- Intelligent Documentation Retrieval: Access documentation for various programming libraries using the Context7 MCP server
- Context-Aware Responses: Get helpful responses based on documentation context
- Conversation History: Maintain conversation history for context-aware interactions
- Command-Line Interface: Intuitive CLI for user interaction
- Modular Design: Built with a modular, maintainable architecture using Pydantic AI
- Python 3.9 or higher
- Node.js (for the Context7 MCP server)
- Clone the repository:
git clone https://github.com/yourusername/context7_agent.git
cd context7_agent- Create a virtual environment and activate it:
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate- Install the package in development mode:
pip install -e .- Create a
.envfile based on the provided.env.example:
cp .env.example .env- Edit the
.envfile to add your OpenAI API key and other configuration options.
Start an interactive chat session with the Context7 AI Agent:
context7 chatProcess a single query:
context7 query "How do I use Pydantic's BaseModel?"List all saved conversations:
context7 list-conversationsContinue a previous conversation by specifying its ID:
context7 chat --conversation YOUR_CONVERSATION_ID--env-file PATH: Specify a custom .env file path--debug: Enable debug logging
context7_agent/
├── cli/ # Command-line interface
├── core/ # Core agent functionality
├── models/ # Pydantic data models
├── context7/ # Context7 MCP integration
└── utils/ # Utility functions
pytestblack context7_agent tests
isort context7_agent testsMIT
- Pydantic AI - Agent framework for Pydantic
- Context7 - Documentation retrieval service
- OpenAI - Language model provider