← Back to install guide

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.

Why MCP?
  • 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 wrds skill 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
Important: Never use someone else's credentials. Each researcher has a unique WRDS login. Do not commit passwords to git or paste them in shared chats.

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

VariableRequiredDefaultPurpose
WRDS_USERNAMEYesYour WRDS login
WRDS_PASSWORDYesYour WRDS password
WRDS_LOCAL_PORTNo49600Local port the daemon listens on
WRDS_TUNNEL_PORTNoSet to 49600 in MCP config
WRDS_DUO_RESPONSENopushDuo: 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

1
Morningsource ~/.wrds-mcp.env then bash tunnel_up.sh (approve Duo once)
2
Work — Ask your agent for Compustat, CRSP, etc. Install the wrds skill for query filters.
3
Eveningbash tunnel_down.sh
Order matters: Start the tunnel before your first MCP query. If you see "nothing is listening on WRDS_TUNNEL_PORT", run tunnel_up.sh again.

MCP tools available

ToolUse for
wrds_list_librariesBrowse WRDS schemas
wrds_list_tablesTables in a library
wrds_describe_tableColumn names and types
wrds_sample_dataPreview rows
wrds_run_sqlRead-only SQL
wrds_download_dataExport CSV / Parquet / JSON
wrds_get_crsp_returnsCRSP returns helper
wrds_get_compustatCompustat helper
wrds_merge_crsp_compustatCCM merge helper

Troubleshooting

ProblemFix
WRDS_USERNAME and WRDS_PASSWORD must be exportedExport both or source ~/.wrds-mcp.env before tunnel_up.sh
authentication failedCheck username/password; confirm WRDS account is active
Duo not approved in timeRe-run tunnel_up.sh and approve within ~30s
connection refused on port 49600Run tunnel_up.sh; check tunnel_status.sh
Port already in usetunnel_down.sh, then tunnel_up.sh
Bad query resultsUse the wrds skill Compustat / CRSP filter checklist

Daemon logs: ~/.wrds-tunnel/daemon.log