Skip to main content
Glama
Sanjeed-Ferhan

MCP DWH Server

README.md
# MCP DWH Server

Remote MCP server that provides read-only access to the Akij DWH (Data Warehouse) SQL Server database. Anyone can connect to this server to query manufacturing OEE data, SBU lists, and run ad-hoc SQL queries.

## Tools Available

| Tool | Description |
|------|-------------|
| `sql_query` | Execute read-only SELECT queries against the DWH |
| `get_database_info` | List databases, tables, and configuration |
| `get_oee_data` | Get OEE data aggregated by SBU and date |
| `get_sbu_list` | List all SBUs with codes and names |

## Local Development

```bash
cd mcp-dwh-server
npm install
node index.js
```

Server runs on `http://localhost:3000/mcp`

## Deploy to Vercel

1. Install Vercel CLI: `npm i -g vercel`
2. Run: `vercel` in this directory
3. Set environment variables in Vercel dashboard:
   - `MSSQL_SERVER` = `203.202.241.211`
   - `MSSQL_PORT` = `1433`
   - `MSSQL_USER` = `mcp_user`
   - `MSSQL_PASSWORD` = (your password)
   - `MSSQL_DATABASE` = `DWH`
   - `MSSQL_ENCRYPT` = `false`
   - `MSSQL_TRUST_SERVER_CERTIFICATE` = `true`

## Connect from OpenCode

Add to your `opencode.json`:

```json
{
  "mcp": {
    "dwh-server": {
      "type": "remote",
      "url": "https://your-app.vercel.app/mcp"
    }
  }
}
```

## Connect from any MCP client

Use the StreamableHTTP transport URL:
```
https://your-app.vercel.app/mcp
```

## Security Notes

- Only SELECT queries are allowed (no INSERT/UPDATE/DELETE/DDL)
- Database credentials are stored as environment variables
- CORS is enabled for cross-origin access
- Consider adding authentication for production use