What Port Does the 3D Graph Visualization UI Run On?
The 3D graph visualization UI in Codebase Memory MCP runs on port 9749 by default, configurable via the --port command-line flag.
The DeusData/codebase-memory-mcp repository includes a built-in web interface for visualizing codebases as interactive 3D graphs. Understanding the default port configuration is essential for accessing the UI locally or deploying it in containerized environments where port mapping is required.
Default Port Configuration
By default, the HTTP server binds to port 9749 when the UI flag is enabled. This value is hardcoded as the default in the argument parsing logic and displayed in the application's help text.
According to the source code in src/main.c, the default port is defined alongside the command-line option parsing logic, where the help message indicates that users can specify a custom port if the default 9749 is unavailable or conflicts with other services.
Customizing the Port with Command-Line Flags
You can override the default port using the --port= flag when launching the server. This flexibility allows you to run multiple instances or avoid conflicts with existing services.
Launch the UI with the default port:
codebase-memory-mcp --ui=true
Specify a custom port (e.g., 8080):
codebase-memory-mcp --ui=true --port=8080
Once running, access the interface in your browser:
// Navigate to the UI (default port example)
window.location.href = "http://localhost:9749";
Source Code Implementation Details
The port configuration flows through two primary components: the command-line argument parser and the HTTP server initializer.
Argument Parsing in src/main.c
The default value and help documentation are defined in src/main.c. This file handles the --port flag parsing and sets the default to 9749 when no override is provided. The usage message printed by the application references this default value, ensuring users can discover the port without reading documentation.
HTTP Server Binding in src/ui/http_server.c
The actual network binding occurs in src/ui/http_server.c, which initializes the HTTP server using the port value configured via the command-line flag. If the --port flag is omitted, the server receives the default value of 9749 from the main argument parsing logic.
Summary
- The default port is 9749, defined in
src/main.cand documented in the README. - Override the port using the
--port=<number>flag when starting the server. - The HTTP server implementation in
src/ui/http_server.cbinds to the configured port at runtime. - Access the UI at
http://localhost:9749when using default settings.
Frequently Asked Questions
How do I check if port 9749 is already in use before starting the UI?
You can test port availability using standard networking tools. On Linux or macOS, run lsof -i :9749 or netstat -tuln | grep 9749. If the port is occupied, specify an alternative using --port=8080 or similar.
Can I bind the 3D graph visualization UI to port 80 or 443?
Yes, you can specify any valid port number, including privileged ports like 80 or 443. However, binding to ports below 1024 typically requires administrative privileges (root or sudo) on Unix-like systems. Use --port=80 with appropriate permissions if needed.
Where is the port configuration documented in the repository?
The default port is documented in the README.md file, which shows the default UI address as http://localhost:9749. Additionally, the src/main.c file contains the programmatic default and command-line help text that displays the available options including --port.
What happens if I specify a port that is already in use?
The application will fail to bind to the port and typically exit with an error message indicating that the address is already in use. You must either free the conflicting port or restart the server with a different --port value.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →