serve command starts a local HTTP server that provides:
- REST API for the web UI to query indexed repositories
- MCP-over-HTTP endpoints for remote AI tool access
- Multi-repository support (all indexed repos available)
Usage
Options
Port number to bind the server to.Flag:
-p, --port <port>Bind address. Use
0.0.0.0 to allow remote connections (e.g., from mobile devices or other machines on your network).Flag: --host <host>Examples
Start Server (Default)
http://127.0.0.1:4747 (localhost only).
Custom Port
http://127.0.0.1:8080.
Allow Remote Access
http://<your-ip>:4747 from any device on the network.
Output
Using with Web UI
-
Start the server:
-
Open the web UI:
- Navigate to gitnexus.vercel.app
- The UI auto-detects the local server at
http://localhost:4747
-
Select repository:
- All indexed repositories are available in the sidebar
- Click to switch between repos
-
Query the graph:
- Use the AI chat interface
- Tools automatically route through the local server
- No re-uploading or re-indexing required
API Endpoints
The server exposes REST and MCP-over-HTTP endpoints.Repository Management
Graph Queries
MCP-over-HTTP
The server implements the MCP StreamableHTTP transport.Multi-Repository Support
The server serves all indexed repositories from the global registry (~/.gitnexus/registry.json).
Switching Repositories
Most endpoints accept arepo parameter:
Default Repository
If only one repository is indexed, therepo parameter is optional.
Security
Localhost Only (Default)
By default, the server binds to127.0.0.1 and is only accessible from your machine.
CORS Policy
CORS is restricted to:http://localhost:*http://127.0.0.1:*https://gitnexus.vercel.app(official web UI)
Remote Access
If you bind to0.0.0.0 for remote access:
- Use a firewall to restrict access to trusted IPs
- Use HTTPS via reverse proxy (e.g., nginx, Caddy)
- Consider authentication middleware
Performance
The server loads repositories on-demand and caches graph connections.Memory Usage
| Repositories | Memory |
|---|---|
| 1-2 repos | 200-500 MB |
| 3-5 repos | 500 MB - 1 GB |
| 10+ repos | 1-2 GB |
Concurrent Queries
The server handles concurrent requests efficiently using connection pooling.Use Cases
Local Backend for Web UI
The primary use case — connect the browser-based UI to your local graph databases without re-indexing. Advantages:- No upload/download
- Multi-repo support
- Instant updates (re-run
gitnexus analyzeto refresh) - AI chat with local context
Remote MCP Access
Use the server as an MCP endpoint for remote AI tools. Example: Mobile AI App- Start server with
--host 0.0.0.0 - Connect mobile app to
http://<your-ip>:4747/mcp - Query your codebase from anywhere on your network
CI/CD Integration
Run the server in CI to provide graph context to AI-powered code review tools.Stopping the Server
PressCtrl+C to gracefully shut down.
Troubleshooting
Port Already in Use
No Repositories Found
Web UI Can’t Connect
Ensure the server is running and accessible:See Also
- gitnexus analyze — Index repositories
- gitnexus list — View indexed repositories
- Web UI Overview — Learn about the web interface