You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**This MCP server requires a free Graphistry account to use visualization features.**
19
19
20
20
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:
22
22
```bash
23
23
export GRAPHISTRY_USERNAME=your_username
24
24
export GRAPHISTRY_PASSWORD=your_password
25
+
# or create a .env file with:
26
+
# GRAPHISTRY_USERNAME=your_username
27
+
# GRAPHISTRY_PASSWORD=your_password
25
28
```
29
+
See `.env.example` for a template.
26
30
27
-
Without these credentials, visualization features will not work.
31
+
## MCP Configuration (.mcp.json)
28
32
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
+
```
30
40
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)
32
47
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.
# Set up virtual environment and install dependencies
44
-
uv venv .venv
62
+
python3 -m venv .venv
45
63
source .venv/bin/activate
46
-
uvx pip install -e ".[dev]"
64
+
pip install -e ".[dev]"
47
65
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)
51
67
```
52
68
53
69
Or use the setup script:
@@ -67,10 +83,16 @@ source .venv/bin/activate
67
83
# Start the server (stdio mode)
68
84
python run_graphistry_mcp.py
69
85
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)
71
87
./start-graphistry-mcp.sh --http 8080
72
88
```
73
89
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
+
74
96
### Adding to Cursor (or other LLM tools)
75
97
76
98
- 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.
121
143
122
144
### What We Learned / Caveats & Gotchas
123
145
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.
125
148
-**Virtual Environment:** Use the venv's Python directly or activate the environment before running the server. This avoids dependency and path issues.
126
149
-**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.
127
150
-**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