Skip to content

Commit 491027c

Browse files
committed
Docs: Add .mcp.json setup instructions and reference .env.example for configuration templates
1 parent fb8cda6 commit 491027c

File tree

1 file changed

+38
-15
lines changed

1 file changed

+38
-15
lines changed

README.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,52 @@ This project integrates Graphistry's powerful GPU-accelerated graph visualizatio
1818
**This MCP server requires a free Graphistry account to use visualization features.**
1919

2020
1. Sign up for a free account at [hub.graphistry.com](https://hub.graphistry.com)
21-
2. Set your credentials as environment variables before starting the server:
21+
2. Set your credentials as environment variables or in a `.env` file before starting the server:
2222
```bash
2323
export GRAPHISTRY_USERNAME=your_username
2424
export GRAPHISTRY_PASSWORD=your_password
25+
# or create a .env file with:
26+
# GRAPHISTRY_USERNAME=your_username
27+
# GRAPHISTRY_PASSWORD=your_password
2528
```
29+
See `.env.example` for a template.
2630

27-
Without these credentials, visualization features will not work.
31+
## MCP Configuration (.mcp.json)
2832

29-
## Installation
33+
To use this project with Cursor or other MCP-compatible tools, you need a `.mcp.json` file in your project root. A template is provided as `.mcp.json.example`.
34+
35+
**Setup:**
36+
37+
```bash
38+
cp .mcp.json.example .mcp.json
39+
```
3040

31-
### Quick Installation with uv/uvx
41+
Edit `.mcp.json` to:
42+
- Set the correct paths for your environment (e.g., project root, Python executable, server script)
43+
- Set your Graphistry credentials (or use environment variables/.env)
44+
- Choose between HTTP and stdio modes:
45+
- `graphistry-http`: Connects via HTTP (set the `url` to match your server's port)
46+
- `graphistry`: Connects via stdio (set the `command`, `args`, and `env` as needed)
3247

33-
This project uses [uv](https://astral.sh/uv) for dependency management, which provides fast and reliable Python package installations.
48+
**Note:**
49+
- `.mcp.json.example` contains both HTTP and stdio configurations. Enable/disable as needed by setting the `disabled` field.
50+
- See `.env.example` for environment variable setup.
51+
52+
## Installation
53+
54+
### Recommended Installation (Python venv + pip)
3455

3556
```bash
3657
# Clone the repository
3758
git clone https://github.com/graphistry/graphistry-mcp.git
3859
cd graphistry-mcp
3960

40-
# Install uv if you don't have it
41-
curl -LsSf https://astral.sh/uv/install.sh | sh
42-
4361
# Set up virtual environment and install dependencies
44-
uv venv .venv
62+
python3 -m venv .venv
4563
source .venv/bin/activate
46-
uvx pip install -e ".[dev]"
64+
pip install -e ".[dev]"
4765

48-
# Set up your Graphistry credentials (obtained from hub.graphistry.com)
49-
export GRAPHISTRY_USERNAME=your_username
50-
export GRAPHISTRY_PASSWORD=your_password
66+
# Set up your Graphistry credentials (see above)
5167
```
5268

5369
Or use the setup script:
@@ -67,10 +83,16 @@ source .venv/bin/activate
6783
# Start the server (stdio mode)
6884
python run_graphistry_mcp.py
6985

70-
# Or use the start script for HTTP or stdio mode
86+
# Or use the start script for HTTP or stdio mode (recommended, sources .env securely)
7187
./start-graphistry-mcp.sh --http 8080
7288
```
7389

90+
### Security & Credential Handling
91+
92+
- The server loads credentials from environment variables or `.env` using [python-dotenv](https://pypi.org/project/python-dotenv/), so you can safely use a `.env` file for local development.
93+
- **Credentials are never printed in logs.** Only whether they are set is shown (e.g., `GRAPHISTRY_PASSWORD is set: True`).
94+
- The `start-graphistry-mcp.sh` script sources `.env` and is the most robust and secure way to launch the server.
95+
7496
### Adding to Cursor (or other LLM tools)
7597

7698
- Add the MCP server to your `.cursor/mcp.json` or equivalent config:
@@ -121,7 +143,8 @@ The main tool, `visualize_graph`, now accepts a single `graph_data` dictionary.
121143

122144
### What We Learned / Caveats & Gotchas
123145

124-
- **Environment Variables:** Always ensure `GRAPHISTRY_USERNAME` and `GRAPHISTRY_PASSWORD` are set in the environment where the server runs. Debug prints can help verify this.
146+
- **Environment Variables & .env:** Always ensure `GRAPHISTRY_USERNAME` and `GRAPHISTRY_PASSWORD` are set in the environment or `.env` file. The server loads `.env` automatically using `python-dotenv`.
147+
- **No Credential Leaks:** Debug prints and logs never show your actual credentials—only whether they are set.
125148
- **Virtual Environment:** Use the venv's Python directly or activate the environment before running the server. This avoids dependency and path issues.
126149
- **LLM Tool Schemas:** LLMs and tool bridges work best with single-argument (dict) APIs. Avoid multi-argument signatures for tools you want to expose to LLMs.
127150
- **Cursor Integration:** When adding to Cursor, use the full path to the venv's Python and ensure all environment variables are set in the config.

0 commit comments

Comments
 (0)