From 5e3f133a63b11a1d9731df5074d46c8a96ff94d4 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Singh Date: Thu, 1 Jan 2026 02:39:55 +0530 Subject: [PATCH] Docs, website changess --- README.md | 19 +- docs/docs/cli.md | 199 ++++++------------ docs/docs/index.md | 12 +- docs/docs/installation.md | 10 +- docs/docs/troubleshooting.md | 14 +- website/src/components/FeaturesSection.tsx | 4 +- website/src/components/HeroSection.tsx | 34 +-- .../src/components/InstallationSection.tsx | 12 +- 8 files changed, 114 insertions(+), 190 deletions(-) diff --git a/README.md b/README.md index 21488673..3a1a82cb 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ -An MCP server that indexes local code into a graph database to provide context to AI assistants. +A powerful **MCP server** and **CLI tool** that indexes local code into a graph database to provide context to AI assistants and developers. Use it as a standalone CLI for code analysis or connect it to your favorite AI IDE via MCP. ### Indexing a codebase ![Indexing using an MCP client](https://github.com/Shashankss1205/CodeGraphContext/blob/main/images/Indexing.gif) @@ -43,6 +43,7 @@ An MCP server that indexes local code into a graph database to provide context t - **Relationship Analysis:** Query for callers, callees, class hierarchies, call chains and more. - **Live Updates:** Watches local files for changes and automatically updates the graph. - **Interactive Setup:** A user-friendly command-line wizard for easy setup. +- **Dual Mode:** Works as a standalone **CLI tool** for developers and as an **MCP server** for AI agents. - **Multi-Language Support:** Full support for 11 programming languages. - **Flexible Database Backend:** Choose between Neo4j or FalkorDB Lite. @@ -81,8 +82,8 @@ CodeGraphContext supports two graph database backends: - Perfect for quick testing and development - Automatically installed when using Python 3.12 or higher -The `cgc setup` wizard helps you configure neo4j database backend while the falkordb database is -supported inherently. +The `cgc neo4j setup` wizard helps you configure neo4j database backend while the falkordb database is +supported inherently (enabled by default). ## Used By @@ -116,8 +117,8 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a ## Getting Started 1. **Install:** `pip install codegraphcontext` -2. **Setup:** `cgc setup` - This interactive command guides you through configuring your Neo4j database connection and automatically setting up your IDE. +2. **Setup:** `cgc mcp setup` + This command configures your IDE to work with CodeGraphContext. To configure a Neo4j database, use `cgc neo4j setup`.
⚙️ Troubleshooting: In case, command cgc not found @@ -155,7 +156,7 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a **Database Configuration:** * **Local Setup (Docker Recommended):** Helps you set up a local Neo4j instance using Docker. Requires Docker and Docker Compose to be installed. - * **Local Setup (Linux Binary):** For Debian-based Linux systems (like Ubuntu), `cgc setup` can automate the installation of Neo4j. Requires `sudo` privileges. + * **Local Setup (Linux Binary):** For Debian-based Linux systems (like Ubuntu), `cgc neo4j setup` can automate the installation of Neo4j. Requires `sudo` privileges. * **Hosted Setup:** Allows you to connect to an existing remote Neo4j database (e.g., Neo4j AuraDB). **IDE/CLI Configuration:** @@ -170,12 +171,12 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a * RooCode * Amazon Q Developer - Upon successful configuration, `cgc setup` will generate and place the necessary configuration files: + Upon successful configuration, `cgc mcp setup` will generate and place the necessary configuration files: * It creates an `mcp.json` file in your current directory for reference. * It stores your Neo4j credentials securely in `~/.codegraphcontext/.env`. * It updates the settings file of your chosen IDE/CLI (e.g., `.claude.json` or VS Code's `settings.json`). -3. **Start:** `cgc start` +3. **Start:** `cgc mcp start` ## Ignoring Files (`.cgcignore`) @@ -197,7 +198,7 @@ You can tell CodeGraphContext to ignore specific files and directories by creati ## MCP Client Configuration -The `cgc setup` command attempts to automatically configure your IDE/CLI. If you choose not to use the automatic setup, or if your tool is not supported, you can configure it manually. +The `cgc mcp setup` command attempts to automatically configure your IDE/CLI. If you choose not to use the automatic setup, or if your tool is not supported, you can configure it manually. Add the following server configuration to your client's settings file (e.g., VS Code's `settings.json` or `.claude.json`): diff --git a/docs/docs/cli.md b/docs/docs/cli.md index 18429624..afb15726 100644 --- a/docs/docs/cli.md +++ b/docs/docs/cli.md @@ -1,142 +1,61 @@ # CLI Reference -The CodeGraphContext CLI provides a set of commands to manage the server, index your code, and interact with the code graph. - -## `cgc setup` - -Runs the interactive setup wizard to configure the server and database connection. This helps users set up a local Docker-based Neo4j instance or connect to a remote one. - -**Usage:** -```bash -cgc setup -``` - -## `cgc start` - -Starts the CodeGraphContext MCP server, which listens for JSON-RPC requests from stdin. - -**Usage:** -```bash -cgc start -``` - -## `cgc index [PATH]` - -Indexes a directory or file by adding it to the code graph. If no path is provided, it indexes the current directory. - -**Arguments:** -* `PATH` (optional): Path to the directory or file to index. Defaults to the current directory. - -**Usage:** -```bash -cgc index /path/to/your/project -``` - -### Ignoring Files (`.cgcignore`) - -You can tell CodeGraphContext to ignore specific files and directories by creating a `.cgcignore` file in the root of your project. This file uses the same syntax as `.gitignore`. - -When you run `cgc index`, the command will look for a `.cgcignore` file in the directory being indexed and exclude any files or directories that match the patterns in the file. - -**Example `.cgcignore` file:** -``` -# Ignore build artifacts -/build/ -/dist/ - -# Ignore dependencies -/node_modules/ -/vendor/ - -# Ignore logs -*.log -``` - - -## `cgc delete ` - -Deletes a repository from the code graph. - -**Arguments:** -* `PATH` (required): Path of the repository to delete from the code graph. - -**Usage:** -```bash -cgc delete /path/to/your/project -``` - -## `cgc visualize [QUERY]` - -Generates a URL to visualize a Cypher query in the Neo4j Browser. If no query is provided, a default query will be used. - -**Arguments:** -* `QUERY` (optional): The Cypher query to visualize. - -**Usage:** -```bash -cgc visualize "MATCH (n) RETURN n" -``` - -## `cgc list_repos` - -Lists all indexed repositories. - -**Usage:** -```bash -cgc list_repos -``` - -## `cgc add_package ` - -Adds a Python package to the code graph. - -**Arguments:** -* `PACKAGE_NAME` (required): Name of the Python package to add. - -**Usage:** -```bash -cgc add_package requests -``` - -## `cgc cypher ` - -Executes a read-only Cypher query. - -**Arguments:** -* `QUERY` (required): The read-only Cypher query to execute. - -**Usage:** -```bash -cgc cypher "MATCH (n:Function) RETURN n.name" -``` - -## `cgc list_mcp_tools` - -Lists all available tools and their descriptions. - -**Usage:** -```bash -cgc list_mcp_tools -``` - -## `cgc help` - -Show the main help message and exit. - -**Usage:** -```bash -cgc help -``` - -## `cgc version` - -Show the application version. - -**Usage:** -```bash -cgc --version -``` -or -```bash -cgc version -``` \ No newline at end of file +The CodeGraphContext CLI provides a comprehensive command-line interface to manage the server, index your code, search, analyzing and interact with the code graph. + +## 1. Project Management +Use these commands to manage the repositories in your code graph. + +| Command | Arguments | Description | +| :--- | :--- | :--- | +| **`cgc index`** | `[path]`
`--force` | Adds a repository to the graph. Default path is current directory. Use `--force` to re-index from scratch.
*(Alias: `cgc i`)* | +| **`cgc list`** | None | Lists all repositories currently indexed in the database.
*(Alias: `cgc ls`)* | +| **`cgc delete`** | `[path]`
`--all` | Removes a repository from the graph. Use `--all` to wipe everything.
*(Alias: `cgc rm`)* | +| **`cgc stats`** | `[path]` | Shows indexing statistics (node counts) for the DB or a specific repo. | +| **`cgc clean`** | None | Removes orphaned nodes and cleans up the database. | +| **`cgc add-package`** | ` ` | Manually adds an external package node (e.g., `cgc add-package requests python`). | + +## 2. Code Analysis +Understand the structure, quality, and relationships of your code. + +| Command | Arguments | Description | +| :--- | :--- | :--- | +| **`cgc analyze calls`** | ``
`--file` | Shows **outgoing** calls: what functions does this function call? | +| **`cgc analyze callers`** | ``
`--file` | Shows **incoming** calls: who calls this function? | +| **`cgc analyze chain`** | ` `
`--depth` | Finds the call path between two functions. Default depth is 5. | +| **`cgc analyze deps`** | ``
`--no-external` | Inspects dependencies (imports and importers) for a module. | +| **`cgc analyze tree`** | ``
`--file` | Visualizes the Class Inheritance hierarchy for a given class. | +| **`cgc analyze complexity`**| `[path]`
`--threshold`
`--limit` | Lists functions with high Cyclomatic Complexity. Default threshold: 10. | +| **`cgc analyze dead-code`** | `--exclude` | Finds potentially unused functions (0 callers). Use `--exclude` for decorators. | + +## 3. Discovery & Search +Find code elements when you don't know the exact structure. + +| Command | Arguments | Description | +| :--- | :--- | :--- | +| **`cgc find name`** | ``
`--type` | Finds code elements (Class, Function) by their **exact** name. | +| **`cgc find pattern`** | ``
`--case-sensitive` | Finds elements using fuzzy substring matching (e.g. "User" finds "UserHelper"). | +| **`cgc find type`** | ``
`--limit` | Lists all nodes of a specific type (e.g. `function`, `class`, `module`). | + +## 4. Configuration & Setup +Manage your environment and database connections. + +| Command | Arguments | Description | +| :--- | :--- | :--- | +| **`cgc mcp setup`** | None | Configures your IDE/MCP Client. Creates `mcp.json`.
*(Alias: `cgc m`)* | +| **`cgc neo4j setup`** | None | Wizard to configure a Neo4j connection.
*(Alias: `cgc n`)* | +| **`cgc config show`** | None | Displays current configuration values. | +| **`cgc config set`** | ` ` | Sets a config value (e.g. `DEFAULT_DATABASE`). | +| **`cgc config reset`** | None | Resets configuration to defaults. | +| **`cgc config db`** | `` | Quick switch between `neo4j` and `falkordb`. | + +## 5. Utilities & Runtime +Helper commands for developers and the MCP server. + +| Command | Arguments | Description | +| :--- | :--- | :--- | +| **`cgc doctor`** | None | Runs system diagnostics (DB connection, dependencies, permissions). | +| **`cgc visualize`** | `[query]` | Generates a link to open the Neo4j Browser.
*(Alias: `cgc v`)* | +| **`cgc query`** | `` | Executes a raw Cypher query directly against the DB. | +| **`cgc mcp start`** | None | Starts the MCP Server (used by IDEs). | +| **`cgc mcp tools`** | None | Lists all available MCP tools supported by the server. | +| **`cgc start`** | None | **Deprecated**. Use `cgc mcp start` instead. | \ No newline at end of file diff --git a/docs/docs/index.md b/docs/docs/index.md index eb30a173..65803621 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -25,9 +25,9 @@ This is the official documentation for CodeGraphContext. -An MCP server that indexes local code into a graph database to provide context to AI assistants. +A powerful **CLI tool** and **MCP server** that indexes local code into a graph database to provide context to AI assistants and developers. Use it as a standalone CLI for code analysis or connect it to your favorite AI IDE via MCP. -### Indexing a codebase +### Indexing a codebase (CLI or MCP) ![Indexing using an MCP client](images/Indexing.gif) ### Using the MCP server @@ -79,8 +79,9 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a 2. **Configure Your Environment:** Run the interactive setup wizard to connect to your database and configure your IDE: ```bash - cgc setup + cgc mcp setup ``` + This ensures your IDE is configured. To configure a Neo4j database, use `cgc neo4j setup`. The wizard helps you with: - **Database Connection:** - **Docker (Recommended):** Automatically sets up a local Neo4j instance. @@ -90,11 +91,11 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a - Automatically configures tools like VS Code, Cursor, Gemini CLI, and more. - Generates the necessary `mcp.json` and `.env` files for you. -3. **Start:** `cgc start` +3. **Start:** `cgc mcp start` ## MCP Client Configuration -The `cgc setup` command attempts to automatically configure your IDE/CLI. If you choose not to use the automatic setup, or if your tool is not supported, you can configure it manually. +The `cgc mcp setup` command attempts to automatically configure your IDE/CLI. If you choose not to use the automatic setup, or if your tool is not supported, you can configure it manually. Add the following server configuration to your client's settings file (e.g., VS Code's `settings.json` or `.claude.json`): @@ -104,6 +105,7 @@ Add the following server configuration to your client's settings file (e.g., VS "CodeGraphContext": { "command": "cgc", "args": [ + "mcp", "start" ], "env": { diff --git a/docs/docs/installation.md b/docs/docs/installation.md index 90782e28..4392a24d 100644 --- a/docs/docs/installation.md +++ b/docs/docs/installation.md @@ -21,19 +21,21 @@ Install the `codegraphcontext` package directly from PyPI using pip: pip install codegraphcontext ``` -### 2. Run the Setup Wizard +### 2. Run the Setup Wizard for MCP Client Launch the interactive setup wizard to configure your Neo4j database and development environment: ```bash -cgc setup +cgc mcp setup ``` +This ensures your IDE is configured. To configure a Neo4j database, use `cgc neo4j setup`. + The wizard guides you through a series of intuitive prompts to tailor your setup. ## 🧭 "Step-by-Step Guide for the Setup Wizard" -When you run `cgc setup`, the wizard offers a thoughtful journey through configuration. Follow these steps to complete your setup with ease: +When you run `cgc neo4j setup`, the wizard offers a thoughtful journey through configuration. Follow these steps to complete your setup with ease: **1. Select Your Database Location** @@ -73,7 +75,7 @@ These files ensure smooth communication between CodeGraphContext, your Neo4j ins Once configuration is complete, launch the MCP server with: ```bash -cgc start +cgc mcp start ``` Your **CodeGraphContext** server is now active, ready to power AI-assisted graph queries. diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md index a26e0eab..75202175 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.md @@ -1,6 +1,6 @@ # CodeGraphContext Troubleshooting Guide -Use this checklist whenever `cgc setup` or `cgc start` doesn’t behave as expected. It keeps the happy path short, but includes the fallback steps when something goes wrong. +Use this checklist whenever `cgc mcp setup` or `cgc mcp start` doesn’t behave as expected. It keeps the happy path short, but includes the fallback steps when something goes wrong. ## 1. Prerequisites at a glance @@ -27,10 +27,10 @@ py -3.11 -m venv venv Launch the wizard: ```powershell -.\venv\Scripts\cgc.exe setup +.\venv\Scripts\cgc.exe neo4j setup ``` -> **Tip:** If you want the wizard to spin up a local Neo4j instance for you, make sure **Docker Desktop** is installed and running before you launch `cgc setup`. If Docker isn’t running, the setup wizard will fail when it tries to install Neo4j locally. +> **Tip:** If you want the wizard to spin up a local Neo4j instance for you, make sure **Docker Desktop** is installed and running before you launch `cgc neo4j setup`. If Docker isn’t running, the setup wizard will fail when it tries to install Neo4j locally. What happens next: @@ -47,7 +47,7 @@ Make sure the Docker container (or remote Neo4j) is still running before you sta Once the wizard completes successfully: ```powershell -.\venv\Scripts\cgc.exe start +.\venv\Scripts\cgc.exe mcp start ``` Expected output includes: @@ -77,7 +77,7 @@ If you prefer not to use the wizard or need to fix a broken configuration: "mcpServers": { "CodeGraphContext": { "command": "cgc", - "args": ["start"], + "args": ["mcp", "start"], "env": { "NEO4J_URI": "neo4j+s://YOUR-HOSTNAME:7687", "NEO4J_USERNAME": "neo4j", @@ -93,14 +93,14 @@ If you prefer not to use the wizard or need to fix a broken configuration: 3. Re-run: ```powershell - .\venv\Scripts\cgc.exe start + .\venv\Scripts\cgc.exe mcp start ``` ## 6. Common issues & fixes | Symptom | Likely Cause | Fix | | --- | --- | --- | -| `Configuration Error: Neo4j credentials must be set…` | `mcp.json`/`.env` missing or empty | Run `cgc setup` again **with Docker running**, or create the files manually (section 5). | +| `Configuration Error: Neo4j credentials must be set…` | `mcp.json`/`.env` missing or empty | Run `cgc neo4j setup` again **with Docker running**, or create the files manually (section 5). | | `AttributeError: socket.EAI_ADDRFAMILY` | Neo4j 6.x bug on Windows | Install the 5.x driver: `.\venv\Scripts\python.exe -m pip install "neo4j<6"` and retry. | | Setup wizard fails while pulling Docker image | Docker Desktop not running or Docker permissions missing | Start Docker Desktop, wait for it to report “Running”, then rerun `cgc setup`. | | Server exits immediately with no log | Neo4j instance is offline | Check Docker container status or AuraDB dashboard; restart Neo4j and call `cgc start` again. | diff --git a/website/src/components/FeaturesSection.tsx b/website/src/components/FeaturesSection.tsx index 2886ca0b..16caf65b 100644 --- a/website/src/components/FeaturesSection.tsx +++ b/website/src/components/FeaturesSection.tsx @@ -40,11 +40,11 @@ const FeaturesSection = () => { Transform your codebase into an intelligent knowledge graph that AI assistants can understand and navigate

- +
{features.map((feature, index) => (
- diff --git a/website/src/components/HeroSection.tsx b/website/src/components/HeroSection.tsx index f45e4ed4..ff84dffd 100644 --- a/website/src/components/HeroSection.tsx +++ b/website/src/components/HeroSection.tsx @@ -10,7 +10,7 @@ import { ThemeToggle } from "@/components/ThemeToggle"; const HeroSection = () => { const [stars, setStars] = useState(null); const [forks, setForks] = useState(null); - const [version, setVersion] = useState(""); + const [version, setVersion] = useState(""); useEffect(() => { async function fetchVersion() { try { @@ -54,14 +54,14 @@ const HeroSection = () => {
{/* Background Image */} -
- + {/* Gradient Overlay */}
- + {/* Content */}
@@ -69,18 +69,18 @@ const HeroSection = () => {
Version {version} • MIT License - +

CodeGraphContext

- +

- An MCP server that indexes local code into a + A powerful CLI tool & MCP server that indexes local code into a

knowledge graph for AI assistants

- + - + {/* Stats */}
@@ -111,22 +111,22 @@ const HeroSection = () => { {stars !== null ? {stars} GitHub Stars : Loading...}
-
+
{forks !== null ? {forks} Forks : Loading...}
-
+
- + {/* Floating Graph Nodes */} -
-
-
-
+
+
+
+
); }; diff --git a/website/src/components/InstallationSection.tsx b/website/src/components/InstallationSection.tsx index eaf89dae..5ca9418a 100644 --- a/website/src/components/InstallationSection.tsx +++ b/website/src/components/InstallationSection.tsx @@ -13,15 +13,15 @@ const installSteps = [ description: "Install CodeGraphContext using pip." }, { - step: "2", + step: "2", title: "Setup", - command: "cgc setup", - description: "Interactive wizard to configure your Neo4j database." + command: "cgc mcp setup", + description: "Interactive wizard to configure your IDE client." }, { step: "3", title: "Start", - command: "cgc start", + command: "cgc mcp start", description: "Launch the MCP server and begin indexing." } ]; @@ -51,7 +51,7 @@ const InstallationSection = () => { Simple installation with automated setup for your database configuration.

- +
{installSteps.map((step, index) => (
@@ -79,7 +79,7 @@ const InstallationSection = () => {
))}
- +