Skip to content

Jaydheeer07/Context7_agent

Repository files navigation

Context7 AI Agent

A Pydantic AI agent that leverages the Context7 MCP server for intelligent document retrieval and context-aware responses through a command-line interface (CLI).

Features

  • 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

Installation

Prerequisites

  • Python 3.9 or higher
  • Node.js (for the Context7 MCP server)

Setup

  1. Clone the repository:
git clone https://github.com/yourusername/context7_agent.git
cd context7_agent
  1. Create a virtual environment and activate it:
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
  1. Install the package in development mode:
pip install -e .
  1. Create a .env file based on the provided .env.example:
cp .env.example .env
  1. Edit the .env file to add your OpenAI API key and other configuration options.

Usage

Interactive Chat

Start an interactive chat session with the Context7 AI Agent:

context7 chat

Single Query

Process a single query:

context7 query "How do I use Pydantic's BaseModel?"

List Conversations

List all saved conversations:

context7 list-conversations

Continue a Conversation

Continue a previous conversation by specifying its ID:

context7 chat --conversation YOUR_CONVERSATION_ID

Additional Options

  • --env-file PATH: Specify a custom .env file path
  • --debug: Enable debug logging

Project Structure

context7_agent/
├── cli/               # Command-line interface
├── core/              # Core agent functionality
├── models/            # Pydantic data models
├── context7/          # Context7 MCP integration
└── utils/             # Utility functions

Development

Running Tests

pytest

Code Formatting

black context7_agent tests
isort context7_agent tests

License

MIT

Acknowledgments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages