### Install and Authenticate with Qwen Code CLI Source: https://github.com/focusthitipan/consult7/blob/main/docs/QWEN_CODE_SETUP.md Installs the Qwen Code CLI globally using npm and then initiates the login process for OAuth authentication. This is the recommended method for setting up authentication. ```bash # Install Qwen Code CLI npm install -g qwen-code-cli # Authenticate qwen-code auth login ``` -------------------------------- ### Install Gemini CLI Tool Source: https://github.com/focusthitipan/consult7/blob/main/docs/GEMINI_CLI_SETUP.md Installs the Gemini CLI tool globally using npm. This is a prerequisite for setting up OAuth authentication. ```bash npm install -g @google/generative-ai-cli ``` -------------------------------- ### MCP Server Configuration for Qwen Code Source: https://github.com/focusthitipan/consult7/blob/main/docs/QWEN_CODE_SETUP.md An example configuration for Claude Desktop's MCP (Multi-Chat Protocol) server settings, specifically for connecting to `consult7` using the Qwen Code provider via stdio. ```json { "mcpServers": { "consult7-qwen": { "type": "stdio", "command": "consult7", "args": ["qwen-code", "oauth:"] } } } ``` -------------------------------- ### Verify Consult7 Installation Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md Checks if the Consult7 installation was successful and that the 'github-copilot' provider is recognized. This command should list 'github-copilot' in the output. ```bash consult7 --help ``` -------------------------------- ### Python API Usage for Qwen Code Provider Source: https://github.com/focusthitipan/consult7/blob/main/docs/QWEN_CODE_SETUP.md Shows how to use the `consultation_impl` function from the `consult7.consultation` module in Python to interact with Qwen models via OAuth. It includes examples for both `qwen3-coder-plus` and `qwen3-coder-flash`. ```python from consult7.consultation import consultation_impl # Use qwen3-coder-plus (default) result = await consultation_impl( files=["/path/to/file.py"], query="Review this code", model="qwen3-coder-plus", mode="fast", provider="qwen-code", api_key=None # Use default path: ~/.qwen/oauth_creds.json ) # Use qwen3-coder-flash for speed result = await consultation_impl( files=["/path/to/file.py"], query="Quick code analysis", model="qwen3-coder-flash", mode="fast", provider="qwen-code", api_key=None ) ``` -------------------------------- ### Qwen Code Provider Command-Line Usage Source: https://github.com/focusthitipan/consult7/blob/main/docs/QWEN_CODE_SETUP.md Demonstrates various ways to use the `consult7` command-line tool with the Qwen Code provider, including default and custom OAuth paths, specifying models like `qwen3-coder-flash`, and testing the connection. ```bash # Use default OAuth path (~/.qwen/oauth_creds.json) consult7 qwen-code oauth: # Specify custom OAuth path consult7 qwen-code oauth:~/my-custom-path/oauth_creds.json # Use qwen3-coder-flash for speed consult7 qwen-code oauth: --model qwen3-coder-flash # Test the connection consult7 qwen-code oauth: --test ``` -------------------------------- ### Install Consult7 with GitHub Copilot Provider Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md Installs the Consult7 package in editable mode, making the GitHub Copilot provider available. This requires Python 3.11+ and pip. ```powershell git clone https://github.com/focusthitipan/consult7.git cd consult7 pip install -e . ``` -------------------------------- ### Command-Line Usage for Consult7 GitHub Copilot Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md These PowerShell commands demonstrate basic command-line operations for the Consult7 GitHub Copilot provider. The first tests the connection and authentication, while the second starts the MCP server required for Claude Desktop integration. ```powershell # Test connection consult7 github-copilot oauth: --test # Start MCP server (for Claude Desktop) consult7 github-copilot oauth: ``` -------------------------------- ### Setup MCP Server with Various Providers Source: https://context7.com/focusthitipan/consult7/llms.txt Instructions for setting up the MCP server using different LLM providers like OpenRouter, Gemini CLI, and GitHub Copilot. It details installation steps, adding providers using the 'claude mcp add' command, and configuring optional database DSN for hybrid modes. Authentication methods, including API keys and OAuth, are also covered. ```bash # Install Consult7 git clone https://github.com/focusthitipan/consult7.git cd consult7 pip install -e . # Setup with OpenRouter (recommended) claude mcp add -s user consult7 -- consult7 openrouter sk-or-v1-YOUR-API-KEY # Setup with Gemini CLI (free OAuth) npm install -g @google/generative-ai-cli gemini # Login with Google account claude mcp add -s user consult7-gemini -- consult7 gemini-cli oauth: # Setup with GitHub Copilot (requires subscription) consult7 github-copilot oauth: --test # Authenticate first claude mcp add -s user consult7-copilot -- consult7 github-copilot oauth: # Setup with database DSN for hybrid mode claude mcp add -s user consult7 -- consult7 openrouter sk-or-v1-... --db-dsn mysql://root:@localhost:3306/mydb # Test connection consult7 openrouter sk-or-v1-... --test # Output: # Testing openrouter API connection... # API Key: sk-or-v1... # Test Model: google/gemini-2.5-flash # Test Mode: fast # Running test query... # [PASSED] Test PASSED # Response: Connection successful. This Python code defines... ``` -------------------------------- ### MCP Configuration for Consult7 Gemini CLI Provider Source: https://github.com/focusthitipan/consult7/blob/main/docs/GEMINI_CLI_SETUP.md Provides an example MCP (Multi-Cloud Provider) configuration for Claude Desktop, setting up Consult7 to use the Gemini CLI OAuth provider. This allows integrating Gemini models within the Claude Desktop environment. ```json { "mcpServers": { "consult7-gemini": { "type": "stdio", "command": "consult7", "args": ["gemini-cli", "oauth:"] } } } ``` -------------------------------- ### Python API Usage with Gemini CLI Provider Source: https://github.com/focusthitipan/consult7/blob/main/docs/GEMINI_CLI_SETUP.md Shows how to integrate the Gemini CLI provider with Consult7 using Python. This example demonstrates calling the `consultation_impl` function, specifying the model, query, and provider, with options for default or custom OAuth paths. ```python from consult7.consultation import consultation_impl result = await consultation_impl( files=["/path/to/file.py"], query="Explain this code", model="gemini-2.5-flash", mode="mid", provider="gemini-cli", api_key=None # Use default path: ~/.gemini/oauth_creds.json # or api_key="/custom/path/oauth_creds.json" for custom path ) ``` -------------------------------- ### Use Consult7 GitHub Copilot Tool in Claude Desktop Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md Example of how to invoke the consult7-gith_consultation tool within Claude Desktop for security analysis. It specifies the files to analyze, the query, and the desired AI model and reasoning mode. ```text Analyze these Python files for security vulnerabilities: [Use consultation tool] Files: ["h:/project/src/*.py", "h:/project/tests/*.py"] Query: "Find security vulnerabilities and suggest fixes" Model: "gpt-4o" Mode: "think" ``` -------------------------------- ### Troubleshooting Authentication Error Source: https://github.com/focusthitipan/consult7/blob/main/docs/QWEN_CODE_SETUP.md Provides the error message for authentication failures with the Qwen Code provider and suggests verifying the existence and correct format of the `~/.qwen/oauth_creds.json` file. ```text Error: Failed to load Qwen Code OAuth credentials **Solution**: Verify that the file `~/.qwen/oauth_creds.json` exists and has the correct format ``` -------------------------------- ### Authenticate Gemini CLI with Google Account Source: https://github.com/focusthitipan/consult7/blob/main/docs/GEMINI_CLI_SETUP.md Initiates the authentication process for the Gemini CLI tool by running the 'gemini' command. This opens a browser for Google login and saves credentials locally. ```bash gemini ``` -------------------------------- ### Consult7 OpenRouter API Key Setup Source: https://github.com/focusthitipan/consult7/blob/main/README.md This command configures Consult7 to use the OpenRouter service by providing an API key. The optional `--test` flag can be used to verify the connection after setup. ```bash consult7 openrouter [--test] ``` -------------------------------- ### Consult7 Command-Line Usage with Gemini CLI OAuth Source: https://github.com/focusthitipan/consult7/blob/main/docs/GEMINI_CLI_SETUP.md Demonstrates how to use Consult7 with the Gemini CLI OAuth provider from the command line. Includes options for using the default OAuth path and specifying a custom path, as well as a connection test. ```bash # Use default OAuth path (~/.gemini/oauth_creds.json) consult7 gemini-cli oauth: # Specify custom OAuth path consult7 gemini-cli oauth:~/my-custom-path/oauth_creds.json # Test the connection consult7 gemini-cli oauth: --test ``` -------------------------------- ### Manual Qwen OAuth Credentials JSON Structure Source: https://github.com/focusthitipan/consult7/blob/main/docs/QWEN_CODE_SETUP.md Defines the JSON structure required for manual OAuth credential setup. This file should be placed at `~/.qwen/oauth_creds.json` and contains access tokens, refresh tokens, and other authentication details. ```json { "access_token": "your_access_token", "refresh_token": "your_refresh_token", "token_type": "Bearer", "expiry_date": 1234567890000, "resource_url": "https://dashscope.aliyuncs.com/compatible-mode/v1" } ``` -------------------------------- ### Testing: Command Line Interface (CLI) Examples Source: https://github.com/focusthitipan/consult7/blob/main/README.md These bash commands demonstrate how to test the Consult7 integration with different providers using the command-line interface. Each command targets a specific provider (OpenRouter, Gemini CLI, Qwen Code, GitHub Copilot) and includes placeholder API keys or authentication tokens. ```bash # Test OpenRouter consult7 openrouter sk-or-v1-your-api-key --test ``` ```bash # Test Gemini CLI consult7 gemini-cli oauth: --test ``` ```bash # Test Qwen Code consult7 qwen-code oauth: --test ``` ```bash # Test GitHub Copilot consult7 github-copilot oauth: --test ``` -------------------------------- ### Troubleshooting: Failed to load Gemini CLI OAuth credentials Source: https://github.com/focusthitipan/consult7/blob/main/docs/GEMINI_CLI_SETUP.md Provides a solution for the 'Failed to load Gemini CLI OAuth credentials' error. The recommended fix is to re-run the 'gemini' command to re-authenticate. ```bash Error: Failed to load Gemini CLI OAuth credentials Solution: Run the `gemini` command again to re-authenticate ``` -------------------------------- ### Token Budget Calculation Example Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md An illustration of how token budgets are calculated and managed across file content and database results, ensuring the total stays within the model's context window. ```text Available tokens: 200,000 File content: 80,000 tokens Database results: 60,000 tokens Reserve for output: 40,000 tokens Status: ✅ Within budget ``` -------------------------------- ### Example Tool Configuration with Files Only Source: https://github.com/focusthitipan/consult7/blob/main/README.md This JSON configuration demonstrates the 'Files Only' mode for a tool. It requires 'files', 'query', 'model', and 'mode' parameters, specifying which files to analyze, the user's instruction, the LLM to use, and the performance mode. ```json { "files": ["/Users/john/project/src/*.py"], "query": "Explain the main architecture", "model": "google/gemini-2.5-flash", "mode": "mid" } ``` -------------------------------- ### Troubleshooting 401 Unauthorized Error Source: https://github.com/focusthitipan/consult7/blob/main/docs/QWEN_CODE_SETUP.md Explains how to resolve a 401 Unauthorized error, which typically occurs when the token is expired and refresh attempts have failed. It recommends logging out and then logging back in using the Qwen Code CLI. ```bash qwen-code auth logout qwen-code auth login ``` -------------------------------- ### Manage Multiple Consult7 GitHub Copilot Token Profiles Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md This PowerShell example shows how to use different token profiles for Consult7 GitHub Copilot by specifying custom paths for the token files. This allows for managing separate work and personal configurations. ```powershell # Work profile consult7 github-copilot oauth:/.github/work_token.json --test # Personal profile consult7 github-copilot oauth:/.github/personal_token.json --test ``` -------------------------------- ### Configure Claude Desktop for GitHub Copilot Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md This JSON snippet configures Claude Desktop to connect to the consult7 GitHub Copilot service. It specifies the command to run and its arguments, enabling integration with Copilot's capabilities. ```json { "mcpServers": { "consult7-github-copilot": { "command": "consult7", "args": ["github-copilot", "oauth:"], "env": {} } } } ``` -------------------------------- ### Consult7 Qwen Code OAuth Setup Source: https://github.com/focusthitipan/consult7/blob/main/README.md This command configures OAuth authentication for Qwen Code with Consult7. Users can specify a custom path for the credentials file if it differs from the default location. ```bash consult7 qwen-code oauth: [--test] consult7 qwen-code oauth:/custom/path.json [--test] ``` -------------------------------- ### Troubleshooting Token Expiration and Refresh Failure Source: https://github.com/focusthitipan/consult7/blob/main/docs/QWEN_CODE_SETUP.md Addresses issues related to expired tokens and failed automatic refresh attempts. It advises checking the `refresh_token` in the credentials file and re-authenticating via the Qwen Code CLI if necessary. ```text The system will automatically refresh the token. If refresh fails: 1. Check the `refresh_token` in your credentials file 2. Re-authenticate using Qwen Code CLI ``` -------------------------------- ### Gemini CLI OAuth Credentials Format Source: https://github.com/focusthitipan/consult7/blob/main/docs/GEMINI_CLI_SETUP.md Illustrates the JSON structure of the OAuth credentials file (`~/.gemini/oauth_creds.json`) generated by the Gemini CLI tool after successful authentication. This file is automatically used by Consult7. ```json { "access_token": "ya29.xxx...", "refresh_token": "1//xxx...", "token_type": "Bearer", "expiry_date": 1234567890000, "scope": "https://www.googleapis.com/auth/cloud-platform ...", "id_token": "eyJhbGc..." } ``` -------------------------------- ### Configure Gemini CLI Provider for Consult7 Source: https://github.com/focusthitipan/consult7/blob/main/README.md Instructions for setting up Consult7 to utilize the Gemini CLI, a free, OAuth-based provider for Google Gemini models. It requires prior installation and authentication of the Gemini CLI tool. ```bash npm install -g @google/generative-ai-cli gemini # Login with Google account ``` ```bash claude mcp add -s user consult7-gemini -- consult7 gemini-cli oauth: ``` ```json { "mcpServers": { "consult7-gemini": { "type": "stdio", "command": "consult7", "args": ["gemini-cli", "oauth:"] } } } ``` -------------------------------- ### Consult7 Gemini CLI OAuth Setup Source: https://github.com/focusthitipan/consult7/blob/main/README.md This command sets up OAuth authentication for Gemini CLI with Consult7. It allows specifying a custom path for the credentials file if the default location is not used. ```bash consult7 gemini-cli oauth: [--test] consult7 gemini-cli oauth:/custom/path.json [--test] ``` -------------------------------- ### Interactive GitHub Copilot Authentication Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md Initiates an interactive test for the GitHub Copilot provider. It prompts the user to authenticate via OAuth Device Flow if no token is found, then tests the connection. ```bash consult7 github-copilot oauth: --test ``` -------------------------------- ### Troubleshooting: HTTP 403 Forbidden Error Source: https://github.com/focusthitipan/consult7/blob/main/docs/GEMINI_CLI_SETUP.md Addresses the 'HTTP 403 - Access forbidden' error when using the Gemini CLI provider. It lists potential causes such as file size limits, expired tokens, or lack of Google account access, and provides corresponding solutions including testing the connection and re-authenticating. ```bash Error: HTTP 403 - Access forbidden Possible causes: 1. File is too large for context limit or contains content that Google blocks 2. OAuth token expired - run `gemini` to re-authenticate 3. Google account doesn't have access to Code Assist API Solutions: - Test with `consult7 gemini-cli oauth: --test` first (if it passes, OAuth is working) - Re-authenticate: run `gemini` and log in again - Try with smaller files or remove unnecessary content - Verify that your Google account has access to Gemini Code Assist ``` -------------------------------- ### Configure Qwen Code Provider for Consult7 Source: https://github.com/focusthitipan/consult7/blob/main/README.md Details on configuring Consult7 to work with Qwen Code, an OAuth-based provider focused on code analysis from Alibaba. This setup requires Qwen OAuth credentials and optionally a custom path for credential storage. ```bash claude mcp add -s user consult7-qwen -- consult7 qwen-code oauth: ``` ```json { "mcpServers": { "consult7-qwen": { "type": "stdio", "command": "consult7", "args": ["qwen-code", "oauth:"] } } } ``` -------------------------------- ### Setup GitHub Copilot in Claude Code Source: https://github.com/focusthitipan/consult7/blob/main/README.md This command configures Consult7's GitHub Copilot as a server within Claude Code. It registers the `consult7 github-copilot oauth:` command as a source for Claude Code to interact with. ```bash claude mcp add -s user consult7-copilot -- consult7 github-copilot oauth: ``` -------------------------------- ### PostgreSQL Result Formatting Example Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md An example of how query results from a PostgreSQL database are formatted for presentation. It includes the database type, the executed query, and the returned table data. ```text ═══════════════════════════════════════ DATABASE: PostgreSQL ═══════════════════════════════════════ Query: SELECT table_name FROM information_schema.tables; ─────────────────────────────────────── table_name ───────────────── users orders products ``` -------------------------------- ### GitHub Copilot Direct Authentication Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md Performs the OAuth Device Flow authentication for the GitHub Copilot provider without running a test. The authenticated token is saved for future use. ```bash consult7 github-copilot oauth: ``` -------------------------------- ### Python API: GitHub Copilot Code Explanation Source: https://github.com/focusthitipan/consult7/blob/main/README.md This Python code example configures the Consult7 API to work with GitHub Copilot. It includes parameters for files, query, model, mode, and provider, with specific instructions on how the API key can be omitted to use a default local path for the token. ```python result = await consultation_impl( files=["/path/to/file.py"], query="Analyze this code", model="gpt-4o", mode="mid", provider="github-copilot", api_key=None # Use default path: ~/.consult7/github-copilot_oauth_token.enc # or api_key="/custom/path/token.enc" for custom path ) ``` -------------------------------- ### MongoDB Result Formatting Example Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md Demonstrates the formatted output for a MongoDB query result, showing the database type, query, and a sample document returned. ```text ═══════════════════════════════════════ DATABASE: MongoDB ═══════════════════════════════════════ Query: db.users.findOne(); ─────────────────────────────────────── { "_id": ObjectId("..."), "name": "Alice", "email": "alice@example.com", "created_at": ISODate("2024-01-15T10:30:00Z") } ``` -------------------------------- ### Consult7 PostgreSQL Analysis Configuration and Tool Call Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md Example configuration for Claude Desktop to connect to a PostgreSQL database using Consult7, along with a corresponding MCP tool call. The tool call specifies files to analyze and PostgreSQL-specific queries. ```json { "mcpServers": { "consult7": { "type": "stdio", "command": "consult7", "args": [ "github-copilot", "oauth:", "--db-dsn", "postgresql://user:pass@localhost:5432/ecommerce" ] } } } ``` ```json { "files": ["src/**/*.py"], "db_queries": [ "SELECT table_name FROM information_schema.tables;", "SELECT * FROM pg_indexes;" ], "query": "Analyze Python code against PostgreSQL schema and indexes", "model": "gpt-4o", "mode": "think" } ``` -------------------------------- ### GitHub Copilot Authentication with Custom Token Path Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md Authenticates the GitHub Copilot provider and stores the OAuth token in a user-specified custom path. This allows for more flexible token management. ```bash consult7 github-copilot oauth:/custom/path/token.json --test ``` -------------------------------- ### Python API: Gemini CLI Code Explanation Source: https://github.com/focusthitipan/consult7/blob/main/README.md This example shows how to configure and use the Consult7 Python API with the Gemini CLI provider. It includes parameters for files, query, model, mode, and provider, with specific handling for the API key which can use a default path or a custom one. ```python result = await consultation_impl( files=["/path/to/file.py"], query="Explain this code", model="gemini-2.5-flash", mode="mid", provider="gemini-cli", api_key=None # Use default path: ~/.gemini/oauth_creds.json # or api_key="/custom/path/oauth_creds.json" for custom path ) ``` -------------------------------- ### SQLite Result Formatting Example Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md Shows the formatted output for query results retrieved from an SQLite database, including the database type, query, and table names. ```text ═══════════════════════════════════════ DATABASE: SQLite ═══════════════════════════════════════ Query: SELECT name FROM sqlite_master WHERE type='table'; ─────────────────────────────────────── name ──────── users orders products ``` -------------------------------- ### Secure DSN Storage in MCP Configuration Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md Examples of how to securely store database connection strings (DSNs) in MCP configurations, favoring storing them in configuration files or environment variables over direct inclusion in tool calls. ```bash # ✅ Good: Store DSN in MCP configuration # Claude Desktop: claude_desktop_config.json { "args": ["github-copilot", "oauth:", "--db-dsn", "postgresql://user:password@localhost:5432/db"] } # ✅ Best: Connection pooling with auth proxy { "args": ["github-copilot", "oauth:", "--db-dsn", "postgresql://user@pgbouncer:6432/db"] } # ⚠️ Alternative: Use environment variable reference (if supported by your MCP client) { "args": ["github-copilot", "oauth:", "--db-dsn", "${DB_DSN}"] } # ❌ Avoid: Passing credentials in tool calls # Don't include DSN directly in consultation requests if server has default configured ``` -------------------------------- ### Consult7 MongoDB Analysis Configuration and Tool Call Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md Demonstrates setting up a MongoDB connection with Consult7 in Claude Desktop and an associated MCP tool call. The tool call targets JavaScript files and includes example MongoDB queries for document analysis. ```json { "mcpServers": { "consult7": { "type": "stdio", "command": "consult7", "args": [ "github-copilot", "oauth:", "--db-dsn", "mongodb://user:pass@localhost:27017/myapp" ] } } } ``` ```json { "files": ["src/**/*.js"], "db_queries": [ "db.users.findOne();", "db.orders.findOne();" ], "query": "Analyze Node.js code against MongoDB document structure", "model": "gpt-4o", "mode": "think" } ``` -------------------------------- ### Consult7 SQLite Analysis Configuration and Tool Call Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md Example configuration for Claude Desktop to connect to a SQLite database using Consult7, paired with an MCP tool call. The tool call includes Rust file paths and SQLite-specific queries for schema inspection. ```json { "mcpServers": { "consult7": { "type": "stdio", "command": "consult7", "args": [ "github-copilot", "oauth:", "--db-dsn", "sqlite:///./app.db" ] } } } ``` ```json { "files": ["src/**/*.rs"], "db_queries": [ "SELECT name FROM sqlite_master WHERE type='table';", "PRAGMA table_info(users);" ], "query": "Verify Rust implementation matches SQLite schema", "model": "gpt-4o", "mode": "think" } ``` -------------------------------- ### Example Tool Configuration without DB DSN Source: https://github.com/focusthitipan/consult7/blob/main/README.md This JSON object represents a tool configuration where the database DSN is omitted because it is expected to be set in the MCP configuration. It includes file paths, database queries, a natural language query, the LLM model, and the processing mode. ```json { "files": ["/Users/john/project/src/**/*.ts"], "db_queries": ["SHOW TABLES;", "DESCRIBE users;"], "query": "Check if the User model matches the database schema", "model": "google/gemini-2.5-pro", "mode": "think" } ``` -------------------------------- ### MCP Tool Call with JSON Parameters Source: https://context7.com/focusthitipan/consult7/llms.txt Example of an MCP tool invocation using a JSON object to define all supported parameters for a consultation request. This includes specifying files to analyze, the query, model, mode, output file, database queries, DSN, and timeouts. ```json { "name": "consultation", "arguments": { "files": [ "/Users/john/project/src/*.py", "/Users/john/project/lib/*.py", "/Users/john/project/README.md" ], "query": "Analyze the architecture and identify security vulnerabilities", "model": "anthropic/claude-sonnet-4.5", "mode": "think", "output_file": "/Users/john/reports/security_audit.md", "db_queries": [ "SHOW TABLES;", "DESCRIBE users;", "SELECT COUNT(*) FROM users;" ], "db_dsn": "mysql://root:password@localhost:3306/myapp", "db_timeout": 30, "db_max_rows": 10000 } } ``` -------------------------------- ### Configure GitHub Copilot Provider for Consult7 Source: https://github.com/focusthitipan/consult7/blob/main/README.md Information on setting up Consult7 to use GitHub Copilot, an OAuth-based provider that leverages an active GitHub Copilot subscription. A one-time browser authentication is required. ```bash # Example configuration for GitHub Copilot would follow a similar pattern to other providers, likely involving 'consult7 github-copilot' command and potentially an OAuth flow. ``` -------------------------------- ### Database-Specific Security Notes for DSNs Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md Provides examples of secure connection string formats for PostgreSQL, MySQL, MongoDB, and SQLite, emphasizing the use of SSL/TLS and appropriate authentication methods. ```text # PostgreSQL: Use SSL/TLS for remote connections postgresql://user@host:5432/db?sslmode=require # MySQL: Use SSL for network traffic mysql://user@host:3306/db?tls=true # MongoDB: Use authentication and encryption mongodb://user:pass@host:27017/db?authSource=admin&ssl=true # SQLite: Ensure file permissions are restricted sqlite:///./database.db # Ensure only app can read ``` -------------------------------- ### Python API: Qwen Code Explanation Source: https://github.com/focusthitipan/consult7/blob/main/README.md This Python snippet illustrates the usage of the Consult7 API with the Qwen Code provider. It defines the files to be analyzed, the query, the selected model, the operational mode, and the provider. The API key can be set to None to utilize the default path. ```python result = await consultation_impl( files=["/path/to/file.py"], query="Review this code", model="qwen3-coder-plus", mode="fast", provider="qwen-code", api_key=None # Use default path: ~/.qwen/oauth_creds.json # or api_key="/custom/path/oauth_creds.json" for custom path ) ``` -------------------------------- ### Configure GitHub Copilot in Claude Desktop Source: https://github.com/focusthitipan/consult7/blob/main/README.md This JSON configuration adds Consult7's GitHub Copilot as an MCP server to Claude Desktop. It specifies the command and arguments required to run the GitHub Copilot service, enabling integration within the desktop application. ```json { "mcpServers": { "consult7-copilot": { "type": "stdio", "command": "consult7", "args": ["github-copilot", "oauth:"] } } } ``` -------------------------------- ### Configure OpenRouter Provider for Consult7 Source: https://github.com/focusthitipan/consult7/blob/main/README.md Demonstrates how to configure the Consult7 server to use the OpenRouter provider, which grants access to over 500 models via an API key. This configuration can be done using Claude Code or Claude Desktop. ```bash claude mcp add -s user consult7 -- consult7 openrouter your-openrouter-api-key ``` ```json { "mcpServers": { "consult7": { "type": "stdio", "command": "consult7", "args": ["openrouter", "your-openrouter-api-key"] } } } ``` -------------------------------- ### Get Model Context Info - Python Source: https://context7.com/focusthitipan/consult7/llms.txt Fetches model context length and output token limits from provider APIs. Handles API failures by returning default values. Used for dynamic file size calculations. ```python from consult7.consultation import get_model_context_info # Get OpenRouter model info model_info = await get_model_context_info( model_name="google/gemini-2.5-flash", provider="openrouter", api_key="sk-or-v1-..." ) # Returns: { # "context_length": 1048576, # 1M tokens # "max_output_tokens": 65536, # 64k tokens # "provider": "openrouter" # } # Use for dynamic file size limits from consult7.token_utils import calculate_max_file_size max_total, max_single = calculate_max_file_size( context_length=model_info["context_length"], mode="think", model_name="google/gemini-2.5-flash" ) # Returns: (8388608, 4194304) # 8MB total, 4MB per file (for 1M context) # Fallback to default if API fails model_info = await get_model_context_info( model_name="unknown/model", provider="openrouter", api_key="invalid-key" ) # Returns: { # "context_length": 131072, # Default 128k # "provider": "openrouter" # } ``` -------------------------------- ### Remove Expired GitHub Copilot OAuth Token Source: https://github.com/focusthitipan/consult7/blob/main/docs/GITHUB_COPILOT_SETUP.md This PowerShell command removes a potentially problematic or expired GitHub Copilot OAuth token file. This is a troubleshooting step to resolve authentication issues by forcing a re-authentication. ```powershell Remove-Item "$env:USERPROFILE\.consult7\github-copilot_oauth_token.enc" -Force ``` -------------------------------- ### Python API: OpenRouter Code Explanation Source: https://github.com/focusthitipan/consult7/blob/main/README.md This snippet demonstrates how to use the Consult7 Python API to interact with the OpenRouter provider for code analysis. It specifies the file to analyze, the query, the model, the mode, and the provider details including the API key. ```python from consult7.consultation import consultation_impl result = await consultation_impl( files=["/path/to/file.py"], query="Explain this code", model="google/gemini-2.5-flash", mode="mid", provider="openrouter", api_key="sk-or-v1-..." ) ``` -------------------------------- ### Token Budget Calculation Logic (Conceptual) Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md This outlines the conceptual logic for calculating available tokens for input based on the model's context length and a safety factor. It reserves a portion for output and determines the available space for input, which includes both file content and database results. ```text Available Tokens = Model Context Length × Safety Factor (0.8) Reserved for Output = Available Tokens × 0.2 Available for Input = Available Tokens × 0.8 Input Space = Files + Database Results ``` -------------------------------- ### MCP Server Configuration (JSON) Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md This JSON configuration sets up the MCP server for consult7, specifying its type, command, and arguments. It includes the database connection string (DSN) as a default argument for the consult7 command. ```json { "mcpServers": { "consult7": { "type": "stdio", "command": "consult7", "args": [ "github-copilot", "oauth:", "--db-dsn", "mysql://root:password@localhost:3306/myapp" ] } } } ``` -------------------------------- ### Configure Consult7 Database Connection for Claude Desktop Source: https://github.com/focusthitipan/consult7/blob/main/docs/HYBRID_CONSULTATION_FEATURE.md This JSON configuration is used in Claude Desktop's `claude_desktop_config.json` to set up a connection to a MySQL database via Consult7. It specifies the server type, command, and arguments including the database DSN. ```json { "mcpServers": { "consult7": { "type": "stdio", "command": "consult7", "args": [ "github-copilot", "oauth:", "--db-dsn", "mysql://root:password@localhost:3306/database" ] } } } ```