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
3. Configure CONNX DSN (see Configuration section below)
49
-
4. Configure Claude Desktop MCP connection
46
+
If you are new to Python, the safest approach is to create a virtual environment in the project folder and use that Python for everything in this README.
- Windows PowerShell: `.\.venv\Scripts\Activate.ps1`
56
+
- Windows Command Prompt: `.\.venv\Scripts\activate.bat`
57
+
- macOS/Linux: `source .venv/bin/activate`
58
+
4. Upgrade `pip` and install dependencies:
59
+
-`python -m pip install --upgrade pip`
60
+
-`pip install -r requirements.txt`
61
+
5. Create your local config file:
62
+
- Windows: `Copy-Item .env.example .env`
63
+
- macOS/Linux: `cp .env.example .env`
64
+
6. Edit `.env` and set your CONNX values (see Configuration below).
65
+
7. Run the smoke test to confirm Python and CONNX can connect before configuring Claude Desktop.
66
+
8. Configure Claude Desktop MCP connection.
67
+
68
+
If you already have Python 3.11 installed, you can use that instead of 3.12 in the commands above.
69
+
70
+
## Visual Studio Code
71
+
72
+
If you are using Visual Studio Code, these steps usually make the setup smoother:
73
+
74
+
1. Open the project folder in VS Code:
75
+
-`File -> Open Folder...`
76
+
- Select `CONNX_MCP_Sample`
77
+
2. Install the Microsoft Python extension if VS Code prompts you.
78
+
3. Select the interpreter from this project’s virtual environment:
79
+
- Open the Command Palette with `Ctrl+Shift+P`
80
+
- Run `Python: Select Interpreter`
81
+
- Choose `.venv\Scripts\python.exe` on Windows or `.venv/bin/python` on macOS/Linux
82
+
4. Open a new terminal in VS Code:
83
+
-`Terminal -> New Terminal`
84
+
- If the virtual environment is not already active, activate it with the same command shown in the Installation section
85
+
5. Run a quick smoke test from the VS Code terminal:
86
+
- Windows: `python .\scripts\smoke.py`
87
+
- macOS/Linux: `python ./scripts/smoke.py`
88
+
89
+
Helpful tips:
90
+
91
+
- If VS Code shows import errors even after dependencies are installed, the wrong interpreter is usually selected.
92
+
- If the integrated terminal uses a different Python than the editor, re-run `Python: Select Interpreter` and then open a fresh terminal window.
93
+
- You can edit `.env` directly in VS Code; just be careful not to commit real credentials.
50
94
51
95
## Configuration
52
96
53
97
### Environment Variables
54
98
55
-
Create a `.env` file in the project root:
99
+
Create a `.env` file in the project root. The easiest way is to copy `.env.example` and then fill in your real values:
56
100
57
101
```dotenv
58
102
CONNX_DSN=your_connx_dsn_name
59
103
CONNX_USER=your_username
60
-
CONNX_PASSWORD=your_password
104
+
CONNX_PASS=your_password
61
105
CONNX_TIMEOUT=30
106
+
CONNX_MAX_ROWS=1000
62
107
```
63
108
64
109
### Connection String Format
65
110
66
-
Alternatively, configure in `connx_server.py`:
111
+
Most users do not need to edit `connx_server.py`. The server reads the environment variables above and builds the connection string internally like this:
67
112
68
113
```python
69
114
connection_string = (
70
115
f"DSN={CONNX_DSN};"
71
116
f"UID={CONNX_USER};"
72
-
f"PWD={CONNX_PASSWORD};"
117
+
f"PWD={CONNX_PASS};"
73
118
)
74
119
```
75
120
@@ -373,16 +418,19 @@ The tools follow a pattern of providing both low-level SQL access (`query_connx`
373
418
374
419
This project uses pytest for unit testing. Tests mock database interactions to run without a real CONNX setup.
375
420
376
-
- Install test deps: `pip install pytest pytest-mock pytest-asyncio`
421
+
- Make sure your virtual environment is activated first.
422
+
- Install test deps: `pip install -r requirements-dev.txt`
- Run Python smoke test: `python .\scripts\smoke.py`
424
+
- Command line smoke test: `python -c "from dotenv import load_dotenv; load_dotenv(); from connx_server import get_connx_connection; c=get_connx_connection(); print('OK'); c.close()"`
425
+
- Run Python smoke test:
426
+
- Windows: `python .\scripts\smoke.py`
427
+
- macOS/Linux: `python ./scripts/smoke.py`
380
428
381
429
Coverage includes connection handling, query/update execution, sanitization, and MCP tools/resources.
382
430
383
431
# Optional: Install the MCP inspector
384
432
385
-
The MCP Inspector is a tool for testing and debugging MCP servers.
433
+
The MCP Inspector is a tool for testing and debugging MCP servers. It requires Node.js because it is launched with `npx`.
386
434
387
435
```bash
388
436
# Install npx inspector
@@ -468,20 +516,22 @@ Full path example: `C:\Users\YourUsername\AppData\Roaming\Claude\claude_desktop_
468
516
469
517
#### 2. Edit the Configuration File
470
518
471
-
Open `claude_desktop_config.json` in a text editor and add the CONNX MCP server configuration:
519
+
Open `claude_desktop_config.json` in a text editor and add the CONNX MCP server configuration.
520
+
521
+
For teammates with limited Python experience, the most reliable option is to point Claude Desktop to the Python inside this repo's virtual environment instead of a system-wide `python` command.
0 commit comments