Skip to main content
Glama
queryviz-mcp
by bayramc
README.md
# queryviz-mcp

SAP table intelligence for AI coding assistants. Search SAP tables, get correct joins (MANDT included), generate production-grade SQL/ABAP, and check S/4HANA migration status, all from Claude Code, Cursor, VS Code, or any MCP client.

Powered by [QueryViz](https://queryviz.io). Free to use.

## Quick start

**Claude Code**

```bash
claude mcp add queryviz -- npx -y queryviz-mcp@latest
```

**Cursor, VS Code, Windsurf, or any MCP client.** Add this to your MCP configuration:

```json
{
  "mcpServers": {
    "queryviz": {
      "command": "npx",
      "args": ["-y", "queryviz-mcp@latest"]
    }
  }
}
```

Requires Node.js 20 or later.

## Tools

| Tool | What it does | Try asking |
|---|---|---|
| `search_sap_tables` | Find tables (and S/4HANA CDS views) by business concept or name | "Where are purchase orders stored in SAP?" |
| `get_table_details` | Fields, keys, relationships with ready-made join conditions, related templates | "What's in EKKO?" |
| `get_join_path` | The correct join between two tables: ON condition with MANDT, INNER vs LEFT, cardinality, gotchas. Finds one-hop paths. | "How do EKKO and EKBE join?" |
| `get_s4_migration` | ECC → S/4HANA status: replaced, merged, unchanged; replacement table and key differences | "What replaced BSEG in S/4HANA?" |
| `explain_query_scenario` | Match a reporting need to a query template; explains tables, join chain, gotchas, and parameters | "I need a vendor aging report" |
| `generate_query` | Generate SQL or ABAP from a template, with MANDT handling, deletion filters, and inline comments | "Generate the open purchase orders query for company code 1000" |

QueryViz is a knowledge server. It doesn't connect to your SAP system and never sees your data: it returns table knowledge and query text.

## What's free, and what needs an account

| | Without a key | With an API key |
|---|---|---|
| Search, table details, join paths, S/4HANA migration, scenario explanations | ✓ | ✓ |
| `generate_query`: the open purchase orders template | ✓ | ✓ |
| `generate_query`: every other template | | ✓ during your 14-day trial, then with a subscription |
| Query generation rate limit | 10 per minute, per network | 30 per minute, per key |

The key links the MCP server to your QueryViz account, so template access is the same as on the website. The trial is free and needs no card.

## API key

Create a free account and a key at [queryviz.io/account](https://queryviz.io/account), then do one of the following:

```bash
# Save it once (writes ~/.queryviz/config.json)
npx queryviz-mcp setup

# Or pass it to Claude Code
claude mcp add queryviz -e QUERYVIZ_API_KEY=qv_your_key -- npx -y queryviz-mcp@latest
```

Or add `"env": { "QUERYVIZ_API_KEY": "qv_your_key" }` to the JSON config above.

The server resolves the key in this order: the `--api-key` flag, then the `QUERYVIZ_API_KEY` environment variable, then `~/.queryviz/config.json`.

## Configuration

| Variable | Purpose |
|---|---|
| `QUERYVIZ_API_KEY` | API key (optional) |
| `QUERYVIZ_API_URL` | Override the API base URL, for example `http://localhost:8000/api` for local development |

## Development

```bash
npm install
npm test          # unit and in-process MCP tests (no network)
npm run smoke     # build, spawn the server over stdio, call every tool against the live API
npm run build
```

To try a local build in Claude Code:

```bash
claude mcp add queryviz-dev -- node /absolute/path/to/mcp-server/dist/index.js
```

## About QueryViz

[QueryViz](https://queryviz.io) helps SAP consultants, developers, and data engineers find the SAP data they need and get the query to fetch it. The web app adds a visual query builder, a full template library, an interactive table map, and an S/4HANA migration reference.

## Source and license

MIT licensed. Source, issues and corrections: [github.com/bayramc/queryviz-mcp](https://github.com/bayramc/queryviz-mcp). If a join key, a cardinality or an S/4HANA mapping is wrong for your system, open an issue.