Skip to content

Commit 808f8f4

Browse files
committed
Improve README onboarding and VS Code setup guidance
1 parent dba04df commit 808f8f4

1 file changed

Lines changed: 76 additions & 21 deletions

File tree

README.md

Lines changed: 76 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Contact Demos Economacos (demos.economacos (at) softwareag.com) for any question
3434

3535
## Prerequisites
3636

37-
- Python 3.8 or higher (tested with Python 3.11/3.12)
37+
- Python 3.11 or 3.12
3838
- CONNX ODBC driver installed and configured
3939
- For Windows: CONNX ODBC Driver.
4040
- For Linux: unixODBC with CONNX driver
@@ -43,33 +43,78 @@ Contact Demos Economacos (demos.economacos (at) softwareag.com) for any question
4343

4444
## Installation
4545

46-
1. Clone the repo: `git clone https://github.com/SoftwareAG/CONNX_MCP_Sample.git`
47-
2. Install dependencies: `pip install -r requirements.txt`
48-
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.
47+
48+
1. Clone the repo and move into it:
49+
- `git clone https://github.com/SoftwareAG/CONNX_MCP_Sample.git`
50+
- `cd CONNX_MCP_Sample`
51+
2. Create a virtual environment:
52+
- Windows: `py -3.12 -m venv .venv`
53+
- macOS/Linux: `python3.12 -m venv .venv`
54+
3. Activate the virtual environment:
55+
- 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.
5094

5195
## Configuration
5296

5397
### Environment Variables
5498

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:
56100

57101
```dotenv
58102
CONNX_DSN=your_connx_dsn_name
59103
CONNX_USER=your_username
60-
CONNX_PASSWORD=your_password
104+
CONNX_PASS=your_password
61105
CONNX_TIMEOUT=30
106+
CONNX_MAX_ROWS=1000
62107
```
63108

64109
### Connection String Format
65110

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:
67112

68113
```python
69114
connection_string = (
70115
f"DSN={CONNX_DSN};"
71116
f"UID={CONNX_USER};"
72-
f"PWD={CONNX_PASSWORD};"
117+
f"PWD={CONNX_PASS};"
73118
)
74119
```
75120

@@ -373,16 +418,19 @@ The tools follow a pattern of providing both low-level SQL access (`query_connx`
373418

374419
This project uses pytest for unit testing. Tests mock database interactions to run without a real CONNX setup.
375420

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`
377423
- Run tests: `pytest tests/`
378-
- Commandline 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()"`
379-
- 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`
380428

381429
Coverage includes connection handling, query/update execution, sanitization, and MCP tools/resources.
382430

383431
# Optional: Install the MCP inspector
384432

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`.
386434

387435
```bash
388436
# Install npx inspector
@@ -468,20 +516,22 @@ Full path example: `C:\Users\YourUsername\AppData\Roaming\Claude\claude_desktop_
468516

469517
#### 2. Edit the Configuration File
470518

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.
472522

473523
```json
474524
{
475525
"mcpServers": {
476526
"connx-database-server": {
477-
"command": "python",
527+
"command": "C:\\path\\to\\CONNX_MCP_Sample\\.venv\\Scripts\\python.exe",
478528
"args": [
479-
"C:\\path\\to\\connx_server.py"
529+
"C:\\path\\to\\CONNX_MCP_Sample\\connx_server.py"
480530
],
481531
"env": {
482532
"CONNX_DSN": "your_dsn_name",
483533
"CONNX_USER": "your_username",
484-
"CONNX_PASSWORD": "your_password"
534+
"CONNX_PASS": "your_password"
485535
}
486536
}
487537
}
@@ -491,6 +541,7 @@ Open `claude_desktop_config.json` in a text editor and add the CONNX MCP server
491541
**Important Notes:**
492542

493543
- Use absolute paths for the Python script
544+
- Prefer the virtual-environment Python shown above; it avoids "module not found" issues when multiple Python versions are installed
494545
- On Windows, use double backslashes (`\\`) in paths or forward slashes (`/`)
495546
- Environment variables can be set directly in the config or loaded from a `.env` file
496547
- If you already have other MCP servers configured, add the `connx-database-server` entry to the existing `mcpServers` object
@@ -503,12 +554,12 @@ If you have multiple MCP servers:
503554
{
504555
"mcpServers": {
505556
"connx-database-server": {
506-
"command": "python",
557+
"command": "C:\\projects\\connx-mcp-server\\.venv\\Scripts\\python.exe",
507558
"args": ["C:\\projects\\connx-mcp-server\\connx_server.py"],
508559
"env": {
509560
"CONNX_DSN": "PROD_DB",
510561
"CONNX_USER": "app_user",
511-
"CONNX_PASSWORD": "secure_password"
562+
"CONNX_PASS": "secure_password"
512563
}
513564
},
514565
"filesystem": {
@@ -532,7 +583,9 @@ If you're using a virtual environment for your Python dependencies:
532583
"command": "C:\\path\\to\\venv\\Scripts\\python.exe",
533584
"args": ["C:\\path\\to\\connx_server.py"],
534585
"env": {
535-
"CONNX_DSN": "your_dsn_name"
586+
"CONNX_DSN": "your_dsn_name",
587+
"CONNX_USER": "your_username",
588+
"CONNX_PASS": "your_password"
536589
}
537590
}
538591
}
@@ -548,7 +601,9 @@ If you're using a virtual environment for your Python dependencies:
548601
"command": "/path/to/venv/bin/python",
549602
"args": ["/path/to/connx_server.py"],
550603
"env": {
551-
"CONNX_DSN": "your_dsn_name"
604+
"CONNX_DSN": "your_dsn_name",
605+
"CONNX_USER": "your_username",
606+
"CONNX_PASS": "your_password"
552607
}
553608
}
554609
}

0 commit comments

Comments
 (0)