iflow-mcp_kandrwmrtn-cplusplus_mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ # Virtual environment
2
+ mcp_env/
3
+
4
+ # MCP cache contents (but keep the folder)
5
+ .mcp_cache/*
6
+ !.mcp_cache/.gitkeep
7
+
8
+ # Local tool state
9
+ .claude/
10
+ .mcp.json
11
+
12
+ # Python build artifacts
13
+ __pycache__/
14
+ *.py[cod]
15
+
16
+ # Downloaded libclang binaries
17
+ lib/**/libclang*
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chickenrikke
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: iflow-mcp_kandrwmrtn-cplusplus_mcp
3
+ Version: 0.1.0
4
+ Summary: An MCP server for analyzing C++ codebases using libclang
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.9
7
+ Requires-Dist: libclang>=16.0.0
8
+ Requires-Dist: mcp>=1.0.0
9
+ Description-Content-Type: text/markdown
10
+
11
+ # C++ MCP Server
12
+
13
+ An MCP (Model Context Protocol) server for analyzing C++ codebases using libclang.
14
+
15
+ ## Why Use This?
16
+
17
+ Instead of having Claude grep through your C++ codebase trying to understand the structure, this server provides semantic understanding of your code. Claude can instantly find classes, functions, and their relationships without getting lost in thousands of files. It understands C++ syntax, inheritance hierarchies, and call graphs - giving Claude the ability to navigate your codebase like an IDE would.
18
+
19
+ ## Features
20
+
21
+ Context-efficient C++ code analysis:
22
+ - **search_classes** - Find classes by name pattern
23
+ - **search_functions** - Find functions by name pattern
24
+ - **get_class_info** - Get detailed class information (methods, members, inheritance)
25
+ - **get_function_signature** - Get function signatures and parameters
26
+ - **find_in_file** - Search symbols within specific files
27
+ - **get_class_hierarchy** - Get complete inheritance hierarchy for a class
28
+ - **get_derived_classes** - Find all classes that inherit from a base class
29
+ - **find_callers** - Find all functions that call a specific function
30
+ - **find_callees** - Find all functions called by a specific function
31
+ - **get_call_path** - Find call paths from one function to another
32
+
33
+ ## Prerequisites
34
+
35
+ - Python 3.9 or higher
36
+ - pip (Python package manager)
37
+ - Git (for cloning the repository)
38
+ - LLVM's libclang (the setup scripts will attempt to download a portable build)
39
+
40
+ ## Setup
41
+
42
+ 1. Clone the repository:
43
+ ```bash
44
+ git clone <repository-url>
45
+ cd CPlusPlus-MCP-Server
46
+ ```
47
+
48
+ 2. Run the setup script for your platform (this creates a virtual environment, installs dependencies, and fetches libclang if possible):
49
+ - **Windows**
50
+ ```bash
51
+ server_setup.bat
52
+ ```
53
+ - **Linux/macOS**
54
+ ```bash
55
+ ./server_setup.sh
56
+ ```
57
+
58
+ 3. Test the installation (recommended):
59
+ ```bash
60
+ # Activate the virtual environment first
61
+ mcp_env\Scripts\activate
62
+
63
+ # Run the installation test
64
+ python scripts\test_installation.py
65
+ ```
66
+
67
+ This will verify that all components are properly installed and working. The test script lives at `scripts/test_installation.py`.
68
+
69
+ ## Configuring Claude Code
70
+
71
+ To use this MCP server with Claude Code, you need to add it to your Claude configuration file.
72
+
73
+ 1. Find and open your Claude configuration file. Common locations include:
74
+ ```
75
+ C:\Users\<YourUsername>\.claude.json
76
+ C:\Users\<YourUsername>\AppData\Roaming\Claude\.claude.json
77
+ %APPDATA%\Claude\.claude.json
78
+ ```
79
+
80
+ The exact location may vary depending on your Claude installation.
81
+
82
+ 2. Add the C++ MCP server to the `mcpServers` section:
83
+ ```json
84
+ {
85
+ "mcpServers": {
86
+ "cpp-analyzer": {
87
+ "command": "python",
88
+ "args": [
89
+ "-m",
90
+ "mcp_server.cpp_mcp_server"
91
+ ],
92
+ "cwd": "YOUR_INSTALLATION_PATH_HERE",
93
+ "env": {
94
+ "PYTHONPATH": "YOUR_INSTALLATION_PATH_HERE"
95
+ }
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ **IMPORTANT:** Replace `YOUR_INSTALLATION_PATH_HERE` with the actual path where you cloned this repository.
102
+
103
+ 3. Restart Claude Desktop for the changes to take effect.
104
+
105
+ ## Configuring Codex CLI
106
+
107
+ To use this MCP server inside the OpenAI Codex CLI:
108
+
109
+ 1. Make sure the virtual environment is created (see setup above).
110
+ 2. Create a `.mcp.json` file in the project you open with Codex. The CLI reads this file to discover MCP servers.
111
+ 3. Add an entry that points to the Python module inside the virtual environment. Replace `YOUR_REPO_PATH` with the absolute path to this repository.
112
+
113
+ ```json
114
+ {
115
+ "mcpServers": {
116
+ "cpp-analyzer": {
117
+ "type": "stdio",
118
+ "command": "YOUR_REPO_PATH/mcp_env/bin/python",
119
+ "args": [
120
+ "-m",
121
+ "mcp_server.cpp_mcp_server"
122
+ ],
123
+ "env": {
124
+ "PYTHONPATH": "YOUR_REPO_PATH"
125
+ }
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ On Windows change `command` to `YOUR_REPO_PATH\\mcp_env\\Scripts\\python.exe`.
132
+
133
+ 4. Restart the Codex CLI (or run `codex reload`) so it picks up the new server definition.
134
+ 5. Inside Codex, use the MCP palette or prompt instructions (for example, "use the cpp-analyzer tool to set the project directory to ...") to start indexing your C++ project.
135
+
136
+ If you keep the `.mcp.json` file inside this repository you can also add a `"cwd": "YOUR_REPO_PATH"` entry so Codex launches the server from the correct directory.
137
+
138
+ ## Usage with Claude
139
+
140
+ Once configured, you can use the C++ analyzer in your conversations with Claude:
141
+
142
+ 1. First, ask Claude to set your project directory using the MCP tool:
143
+ ```
144
+ "Use the cpp-analyzer tool to set the project directory to C:\path\to\your\cpp\project"
145
+ ```
146
+
147
+ **Note:** The initial indexing might take a long time for very large projects (several minutes for codebases with thousands of files). The server will cache the results for faster subsequent queries.
148
+
149
+ 2. Then you can ask questions like:
150
+ - "Find all classes containing 'Actor'"
151
+ - "Show me the Component class details"
152
+ - "What's the signature of BeginPlay function?"
153
+ - "Search for physics-related functions"
154
+ - "Show me the inheritance hierarchy for GameObject"
155
+ - "Find all functions that call Update()"
156
+ - "What functions does Render() call?"
157
+
158
+ ## Architecture
159
+
160
+ - Uses libclang for accurate C++ parsing
161
+ - Caches parsed AST for improved performance
162
+ - Supports incremental analysis and project-wide search
163
+ - Provides detailed symbol information including:
164
+ - Function signatures with parameter types and names
165
+ - Class members, methods, and inheritance
166
+ - Call graph analysis for understanding code flow
167
+ - File locations for easy navigation
168
+
169
+ ## Configuration Options
170
+
171
+ The server behavior can be configured via `cpp-analyzer-config.json`:
172
+
173
+ ```json
174
+ {
175
+ "exclude_directories": [".git", ".svn", "node_modules", "build", "Build"],
176
+ "exclude_patterns": ["*.generated.h", "*.generated.cpp", "*_test.cpp"],
177
+ "dependency_directories": ["vcpkg_installed", "third_party", "external"],
178
+ "include_dependencies": true,
179
+ "max_file_size_mb": 10
180
+ }
181
+ ```
182
+
183
+ - **exclude_directories**: Directories to skip during project scanning
184
+ - **exclude_patterns**: File patterns to exclude from analysis
185
+ - **dependency_directories**: Directories containing third-party dependencies
186
+ - **include_dependencies**: Whether to analyze files in dependency directories
187
+ - **max_file_size_mb**: Maximum file size to analyze (larger files are skipped)
188
+
189
+ ## Troubleshooting
190
+
191
+ ### Common Issues
192
+
193
+ 1. **"libclang not found" error**
194
+ - Run `server_setup.bat` (Windows) or `./server_setup.sh` (Linux/macOS) to let the project download libclang automatically
195
+ - If automatic download fails, manually download libclang:
196
+ 1. Go to: https://github.com/llvm/llvm-project/releases
197
+ 2. Download the appropriate file for your system:
198
+ - **Windows**: `clang+llvm-*-x86_64-pc-windows-msvc.tar.xz`
199
+ - **macOS**: `clang+llvm-*-x86_64-apple-darwin.tar.xz`
200
+ - **Linux**: `clang+llvm-*-x86_64-linux-gnu-ubuntu-*.tar.xz`
201
+ 3. Extract and copy the libclang library to the appropriate location:
202
+ - **Windows**: Copy `bin\libclang.dll` to `lib\windows\libclang.dll`
203
+ - **macOS**: Copy `lib\libclang.dylib` to `lib\macos\libclang.dylib`
204
+ - **Linux**: Copy `lib\libclang.so.*` to `lib\linux\libclang.so`
205
+
206
+ 2. **Server fails to start**
207
+ - Check that Python 3.9+ is installed: `python --version`
208
+ - Verify all dependencies are installed: `pip install -r requirements.txt`
209
+ - Run the installation test to identify issues:
210
+ ```bash
211
+ mcp_env\Scripts\activate
212
+ python -m mcp_server.test_installation
213
+ ```
214
+
215
+ 3. **Claude doesn't recognize the server**
216
+ - Ensure the paths in `.claude.json` are absolute paths
217
+ - Restart Claude Desktop after modifying the configuration
218
+
219
+ 4. **Claude uses grep/glob instead of the C++ analyzer**
220
+ - Be explicit in prompts: Say "use the cpp-analyzer to..." when asking about C++ code
221
+ - Add instructions to your project's `CLAUDE.md` file telling Claude to prefer the cpp-analyzer for C++ symbol searches
222
+ - The cpp-analyzer is much faster than grep for finding classes, functions, and understanding code structure
@@ -0,0 +1,212 @@
1
+ # C++ MCP Server
2
+
3
+ An MCP (Model Context Protocol) server for analyzing C++ codebases using libclang.
4
+
5
+ ## Why Use This?
6
+
7
+ Instead of having Claude grep through your C++ codebase trying to understand the structure, this server provides semantic understanding of your code. Claude can instantly find classes, functions, and their relationships without getting lost in thousands of files. It understands C++ syntax, inheritance hierarchies, and call graphs - giving Claude the ability to navigate your codebase like an IDE would.
8
+
9
+ ## Features
10
+
11
+ Context-efficient C++ code analysis:
12
+ - **search_classes** - Find classes by name pattern
13
+ - **search_functions** - Find functions by name pattern
14
+ - **get_class_info** - Get detailed class information (methods, members, inheritance)
15
+ - **get_function_signature** - Get function signatures and parameters
16
+ - **find_in_file** - Search symbols within specific files
17
+ - **get_class_hierarchy** - Get complete inheritance hierarchy for a class
18
+ - **get_derived_classes** - Find all classes that inherit from a base class
19
+ - **find_callers** - Find all functions that call a specific function
20
+ - **find_callees** - Find all functions called by a specific function
21
+ - **get_call_path** - Find call paths from one function to another
22
+
23
+ ## Prerequisites
24
+
25
+ - Python 3.9 or higher
26
+ - pip (Python package manager)
27
+ - Git (for cloning the repository)
28
+ - LLVM's libclang (the setup scripts will attempt to download a portable build)
29
+
30
+ ## Setup
31
+
32
+ 1. Clone the repository:
33
+ ```bash
34
+ git clone <repository-url>
35
+ cd CPlusPlus-MCP-Server
36
+ ```
37
+
38
+ 2. Run the setup script for your platform (this creates a virtual environment, installs dependencies, and fetches libclang if possible):
39
+ - **Windows**
40
+ ```bash
41
+ server_setup.bat
42
+ ```
43
+ - **Linux/macOS**
44
+ ```bash
45
+ ./server_setup.sh
46
+ ```
47
+
48
+ 3. Test the installation (recommended):
49
+ ```bash
50
+ # Activate the virtual environment first
51
+ mcp_env\Scripts\activate
52
+
53
+ # Run the installation test
54
+ python scripts\test_installation.py
55
+ ```
56
+
57
+ This will verify that all components are properly installed and working. The test script lives at `scripts/test_installation.py`.
58
+
59
+ ## Configuring Claude Code
60
+
61
+ To use this MCP server with Claude Code, you need to add it to your Claude configuration file.
62
+
63
+ 1. Find and open your Claude configuration file. Common locations include:
64
+ ```
65
+ C:\Users\<YourUsername>\.claude.json
66
+ C:\Users\<YourUsername>\AppData\Roaming\Claude\.claude.json
67
+ %APPDATA%\Claude\.claude.json
68
+ ```
69
+
70
+ The exact location may vary depending on your Claude installation.
71
+
72
+ 2. Add the C++ MCP server to the `mcpServers` section:
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "cpp-analyzer": {
77
+ "command": "python",
78
+ "args": [
79
+ "-m",
80
+ "mcp_server.cpp_mcp_server"
81
+ ],
82
+ "cwd": "YOUR_INSTALLATION_PATH_HERE",
83
+ "env": {
84
+ "PYTHONPATH": "YOUR_INSTALLATION_PATH_HERE"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ **IMPORTANT:** Replace `YOUR_INSTALLATION_PATH_HERE` with the actual path where you cloned this repository.
92
+
93
+ 3. Restart Claude Desktop for the changes to take effect.
94
+
95
+ ## Configuring Codex CLI
96
+
97
+ To use this MCP server inside the OpenAI Codex CLI:
98
+
99
+ 1. Make sure the virtual environment is created (see setup above).
100
+ 2. Create a `.mcp.json` file in the project you open with Codex. The CLI reads this file to discover MCP servers.
101
+ 3. Add an entry that points to the Python module inside the virtual environment. Replace `YOUR_REPO_PATH` with the absolute path to this repository.
102
+
103
+ ```json
104
+ {
105
+ "mcpServers": {
106
+ "cpp-analyzer": {
107
+ "type": "stdio",
108
+ "command": "YOUR_REPO_PATH/mcp_env/bin/python",
109
+ "args": [
110
+ "-m",
111
+ "mcp_server.cpp_mcp_server"
112
+ ],
113
+ "env": {
114
+ "PYTHONPATH": "YOUR_REPO_PATH"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ On Windows change `command` to `YOUR_REPO_PATH\\mcp_env\\Scripts\\python.exe`.
122
+
123
+ 4. Restart the Codex CLI (or run `codex reload`) so it picks up the new server definition.
124
+ 5. Inside Codex, use the MCP palette or prompt instructions (for example, "use the cpp-analyzer tool to set the project directory to ...") to start indexing your C++ project.
125
+
126
+ If you keep the `.mcp.json` file inside this repository you can also add a `"cwd": "YOUR_REPO_PATH"` entry so Codex launches the server from the correct directory.
127
+
128
+ ## Usage with Claude
129
+
130
+ Once configured, you can use the C++ analyzer in your conversations with Claude:
131
+
132
+ 1. First, ask Claude to set your project directory using the MCP tool:
133
+ ```
134
+ "Use the cpp-analyzer tool to set the project directory to C:\path\to\your\cpp\project"
135
+ ```
136
+
137
+ **Note:** The initial indexing might take a long time for very large projects (several minutes for codebases with thousands of files). The server will cache the results for faster subsequent queries.
138
+
139
+ 2. Then you can ask questions like:
140
+ - "Find all classes containing 'Actor'"
141
+ - "Show me the Component class details"
142
+ - "What's the signature of BeginPlay function?"
143
+ - "Search for physics-related functions"
144
+ - "Show me the inheritance hierarchy for GameObject"
145
+ - "Find all functions that call Update()"
146
+ - "What functions does Render() call?"
147
+
148
+ ## Architecture
149
+
150
+ - Uses libclang for accurate C++ parsing
151
+ - Caches parsed AST for improved performance
152
+ - Supports incremental analysis and project-wide search
153
+ - Provides detailed symbol information including:
154
+ - Function signatures with parameter types and names
155
+ - Class members, methods, and inheritance
156
+ - Call graph analysis for understanding code flow
157
+ - File locations for easy navigation
158
+
159
+ ## Configuration Options
160
+
161
+ The server behavior can be configured via `cpp-analyzer-config.json`:
162
+
163
+ ```json
164
+ {
165
+ "exclude_directories": [".git", ".svn", "node_modules", "build", "Build"],
166
+ "exclude_patterns": ["*.generated.h", "*.generated.cpp", "*_test.cpp"],
167
+ "dependency_directories": ["vcpkg_installed", "third_party", "external"],
168
+ "include_dependencies": true,
169
+ "max_file_size_mb": 10
170
+ }
171
+ ```
172
+
173
+ - **exclude_directories**: Directories to skip during project scanning
174
+ - **exclude_patterns**: File patterns to exclude from analysis
175
+ - **dependency_directories**: Directories containing third-party dependencies
176
+ - **include_dependencies**: Whether to analyze files in dependency directories
177
+ - **max_file_size_mb**: Maximum file size to analyze (larger files are skipped)
178
+
179
+ ## Troubleshooting
180
+
181
+ ### Common Issues
182
+
183
+ 1. **"libclang not found" error**
184
+ - Run `server_setup.bat` (Windows) or `./server_setup.sh` (Linux/macOS) to let the project download libclang automatically
185
+ - If automatic download fails, manually download libclang:
186
+ 1. Go to: https://github.com/llvm/llvm-project/releases
187
+ 2. Download the appropriate file for your system:
188
+ - **Windows**: `clang+llvm-*-x86_64-pc-windows-msvc.tar.xz`
189
+ - **macOS**: `clang+llvm-*-x86_64-apple-darwin.tar.xz`
190
+ - **Linux**: `clang+llvm-*-x86_64-linux-gnu-ubuntu-*.tar.xz`
191
+ 3. Extract and copy the libclang library to the appropriate location:
192
+ - **Windows**: Copy `bin\libclang.dll` to `lib\windows\libclang.dll`
193
+ - **macOS**: Copy `lib\libclang.dylib` to `lib\macos\libclang.dylib`
194
+ - **Linux**: Copy `lib\libclang.so.*` to `lib\linux\libclang.so`
195
+
196
+ 2. **Server fails to start**
197
+ - Check that Python 3.9+ is installed: `python --version`
198
+ - Verify all dependencies are installed: `pip install -r requirements.txt`
199
+ - Run the installation test to identify issues:
200
+ ```bash
201
+ mcp_env\Scripts\activate
202
+ python -m mcp_server.test_installation
203
+ ```
204
+
205
+ 3. **Claude doesn't recognize the server**
206
+ - Ensure the paths in `.claude.json` are absolute paths
207
+ - Restart Claude Desktop after modifying the configuration
208
+
209
+ 4. **Claude uses grep/glob instead of the C++ analyzer**
210
+ - Be explicit in prompts: Say "use the cpp-analyzer to..." when asking about C++ code
211
+ - Add instructions to your project's `CLAUDE.md` file telling Claude to prefer the cpp-analyzer for C++ symbol searches
212
+ - The cpp-analyzer is much faster than grep for finding classes, functions, and understanding code structure
@@ -0,0 +1 @@
1
+ libtinfo.so.5.9
@@ -0,0 +1 @@
1
+ libtinfo.so.5.9
@@ -0,0 +1 @@
1
+ # MCP Server Package