MCP ExplorerExplorer

Aider Mcp Client

@Jemsukieon a year ago
1 MIT
FreeCommunity
AI Systems
A Python tool to query Context7 MCP for library docs. Integrates with Aider for AI coding. Install via pip install mcp_query and fetch docs easily.

Overview

What is Aider Mcp Client

Aider-MCP-Client is a Python tool designed to query the Context7 MCP for library documentation. It integrates with Aider to enhance AI coding by fetching documentation snippets directly into coding sessions.

Use cases

Use cases include enhancing coding efficiency by providing relevant documentation snippets during coding sessions, reducing context-switching, and improving the accuracy of AI-generated code by grounding it in actual documentation.

How to use

To use aider-mcp-client, install it via pip with the command ‘pip install aider-mcp-client’. After installation, you can access its command-line interface to query documentation as needed.

Key features

Key features include simple JSON configuration, a command-line interface, Aider-compatible JSON output, and integration with Context7 MCP servers. It also offers smart token management to optimize coding sessions.

Where to use

Aider-mcp-client can be used in software development environments where AI-assisted coding is beneficial, particularly in projects that require frequent reference to library documentation.

Content

Aider MCP Client: Supercharge Your Coding with AI-Powered Documentation

A Python client that seamlessly integrates MCP (Model Control Protocol) with Aider, creating a powerful AI-assisted development workflow. Fetch precise documentation snippets directly into your coding sessions while efficiently managing token usage.

PyPI version

Why Use MCP with Aider?

  • Context-Aware Coding: Get relevant documentation snippets injected directly into your AI coding sessions
  • Token Efficiency: Aider’s smart token management ensures you get maximum context without wasting tokens
  • Reduced Hallucinations: Ground your AI coding in actual documentation rather than made-up examples
  • Faster Development: Eliminate context-switching between docs and code
  • Precision Answers: Get documentation tailored to your exact coding context

Key Features

  • Simple configuration via JSON
  • Command-line interface
  • Aider-compatible JSON output
  • Integration with Context7 MCP servers

Smart Token Management with Aider

Aider was chosen as the foundation for this client because of its excellent token management capabilities:

  • Automatic Token Optimization: Aider intelligently manages context window size
  • Prioritized Context: Keeps the most relevant documentation in the prompt
  • Documentation Chunking: Breaks large docs into manageable pieces
  • Session Awareness: Maintains context across multiple queries

This ensures you get the most value from your AI coding sessions without hitting token limits.

Installation

From PyPI:

pip install aider-mcp-client

From GitHub:

pip install git+https://github.com/alvinveroy/aider-mcp-client.git

For development:

git clone https://github.com/alvinveroy/aider-mcp-client.git
cd aider-mcp-client
pip install -e .

Usage

After installation, you can use the command-line interface:

aider_mcp_client <command> [options] [args...]

Or as a module:

python -m aider_mcp_client <command> [options] [args...]

Command-line Options

usage: aider_mcp_client [-h] [-v] [--debug] [--verbose] [--quiet] [--server SERVER] [--json]
                        {fetch,resolve,list} ...

Aider MCP client for fetching library documentation.

positional arguments:
  {fetch,resolve,list}  Available commands
    fetch               Fetch documentation for a library
    resolve             Resolve a library name to a Context7-compatible ID
    list                List supported libraries

options:
  -h, --help            show this help message and exit
  -v, --version         Show version information
  --debug               Enable debug logging
  --verbose             Show detailed logs in console
  --quiet               Suppress informational output
  --server SERVER       MCP server to use (default: context7)
  --json                Force JSON output format

Example Workflows

Basic Documentation Fetch

# Get React hooks documentation (automatically optimized for token usage)
aider_mcp_client fetch react --topic "hooks"

# Get Next.js routing docs with 10k token budget
aider_mcp_client fetch vercel/nextjs --topic "routing" --tokens 10000

Integration with Aider

# Start an Aider session with React context
aider --context $(aider_mcp_client fetch react --json)

Advanced Usage

# Resolve library name to ID (useful for scripting)
aider_mcp_client resolve next.js

# Get docs in JSON format for processing
aider_mcp_client fetch react --topic "state" --json

# Debug connection issues
aider_mcp_client fetch react --verbose --debug

Configuration

The client uses a configuration file located at ~/.aider-mcp-client/config.json. If this file doesn’t exist, default settings are used.

Default configuration:

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp@latest"
      ],
      "enabled": true,
      "timeout": 30
    }
  }
}

You can create a custom configuration file:

mkdir -p ~/.aider-mcp-client
echo '{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp@latest"],
      "enabled": true,
      "timeout": 30
    }
  }
}' > ~/.aider-mcp-client/config.json

Available Commands

  • version: Display version information

    aider_mcp_client
    # or
    aider_mcp_client -v
    # or
    aider_mcp_client --version
    
  • fetch: Retrieve documentation for a specific library

    aider_mcp_client fetch <library_id> [--topic "topic"] [--tokens 5000]
    

    or

    python -m aider_mcp_client.client fetch <library_id> [--topic "topic"] [--tokens 5000]
    

Aider Integration

The client outputs JSON in Aider-compatible format:

Development

Running Tests

# Install pytest first
pip install pytest

# Then run the tests
python -m pytest tests/

You can also use unittest if you prefer:

python -m unittest discover tests

Code Structure

  • aider_mcp_client/client.py: Main client implementation with CLI interface
  • aider_mcp_client/config.json: Default configuration template
  • tests/: Unit tests

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

License

MIT - See LICENSE for details.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers