John Barrios · wrds-mcp
WRDS MCP setup
This is an MCP server (mcp/wrds-mcp/) — not a skill. It connects Cursor or Claude to WRDS using your credentials. Pair with the wrds skill for query conventions.
Query Compustat, CRSP, Form 4, and other WRDS libraries from Cursor or Claude. You need your own WRDS account — username and password from Wharton — plus a one-time Duo approval per work session.
- Live data in chat — browse schemas, run SQL, export CSV without leaving the agent
- Structured tools — fewer wrong table names or hand-rolled connection code
- Skills + MCP — the
wrdsskill sets conventions; MCP runs the query
Prerequisites
- Active WRDS subscription
- Your personal WRDS username and password (assigned when your account is approved)
- Duo MFA enrolled on your WRDS account
- Python 3.10 or newer
Step 1 — Install the MCP server
After cloning Barrios Skills, install the bundled server into a dedicated virtual environment:
cd barrios-skills/mcp/wrds-mcp
python3 -m venv ~/.wrds-mcp-env
source ~/.wrds-mcp-env/bin/activate
pip install -e .
which wrds-mcp
# should print: ~/.wrds-mcp-env/bin/wrds-mcp
Step 2 — Set your WRDS credentials
WRDS usernames often look like jsmith_yale or firstname_lastname. Use the username and password from your WRDS welcome email.
Option A — Private env file (recommended)
cp mcp/wrds-mcp/.env.example ~/.wrds-mcp.env
# Edit the file — replace placeholders with YOUR username and password
chmod 600 ~/.wrds-mcp.env
source ~/.wrds-mcp.env
Your ~/.wrds-mcp.env should contain:
WRDS_USERNAME=your_wrds_username
WRDS_PASSWORD=your_wrds_password
WRDS_TUNNEL_PORT=49600
Option B — Export in the shell
export WRDS_USERNAME="your_wrds_username"
export WRDS_PASSWORD="your_wrds_password"
Option C — MCP config only
You can pass credentials only in the Cursor or Claude MCP registration (Step 4). The tunnel scripts still need WRDS_USERNAME and WRDS_PASSWORD exported when you run tunnel_up.sh.
Step 3 — Start the persistent tunnel
WRDS requires Duo MFA. The tunnel daemon opens one SSH session — you approve Duo on your phone once, then every MCP query reuses that connection.
source ~/.wrds-mcp.env # or export credentials
cd barrios-skills/mcp/wrds-mcp/tunnel
bash tunnel_up.sh
# Approve the Duo Push within ~30 seconds
# -> "tunnel up on 127.0.0.1:49600"
Verify the tunnel:
bash tunnel_status.sh
When you are done for the day:
bash tunnel_down.sh
Logs and PID files live in ~/.wrds-tunnel/.
| Variable | Required | Default | Purpose |
|---|---|---|---|
WRDS_USERNAME | Yes | — | Your WRDS login |
WRDS_PASSWORD | Yes | — | Your WRDS password |
WRDS_LOCAL_PORT | No | 49600 | Local port the daemon listens on |
WRDS_TUNNEL_PORT | No | — | Set to 49600 in MCP config |
WRDS_DUO_RESPONSE | No | push | Duo: push, phone, or passcode |
Step 4 — Register in Cursor or Claude
Set WRDS_TUNNEL_PORT=49600 so the MCP uses your local tunnel instead of opening a new SSH session (and triggering Duo again).
Claude Code
claude mcp add wrds-mcp ~/.wrds-mcp-env/bin/wrds-mcp \
-s user \
--env WRDS_USERNAME=your_wrds_username \
--env WRDS_PASSWORD=your_wrds_password \
--env WRDS_TUNNEL_PORT=49600
Replace your_wrds_username and your_wrds_password with your account. Check: claude mcp get wrds-mcp.
Cursor
Edit ~/.cursor/mcp.json (use your home directory path):
{
"mcpServers": {
"wrds-mcp": {
"command": "/Users/YOUR_USER/.wrds-mcp-env/bin/wrds-mcp",
"args": [],
"env": {
"WRDS_USERNAME": "your_wrds_username",
"WRDS_PASSWORD": "your_wrds_password",
"WRDS_TUNNEL_PORT": "49600"
}
}
}
}
Restart Cursor after saving.
Step 5 — Daily workflow
source ~/.wrds-mcp.env then bash tunnel_up.sh (approve Duo once)bash tunnel_down.shtunnel_up.sh again.
MCP tools available
| Tool | Use for |
|---|---|
wrds_list_libraries | Browse WRDS schemas |
wrds_list_tables | Tables in a library |
wrds_describe_table | Column names and types |
wrds_sample_data | Preview rows |
wrds_run_sql | Read-only SQL |
wrds_download_data | Export CSV / Parquet / JSON |
wrds_get_crsp_returns | CRSP returns helper |
wrds_get_compustat | Compustat helper |
wrds_merge_crsp_compustat | CCM merge helper |
Troubleshooting
| Problem | Fix |
|---|---|
WRDS_USERNAME and WRDS_PASSWORD must be exported | Export both or source ~/.wrds-mcp.env before tunnel_up.sh |
authentication failed | Check username/password; confirm WRDS account is active |
| Duo not approved in time | Re-run tunnel_up.sh and approve within ~30s |
connection refused on port 49600 | Run tunnel_up.sh; check tunnel_status.sh |
| Port already in use | tunnel_down.sh, then tunnel_up.sh |
| Bad query results | Use the wrds skill Compustat / CRSP filter checklist |
Daemon logs: ~/.wrds-tunnel/daemon.log