Metadata-Version: 2.4
Name: apitest-mcp
Version: 0.1.1
Summary: MCP server for testing Oracle-to-PostgreSQL API migrations
Author: venky_vishwas
Keywords: api-testing,claude,mcp,migration,postgresql
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: mcp[cli]
Requires-Dist: psycopg2-binary
Requires-Dist: python-dotenv
Description-Content-Type: text/markdown

# apitest-mcp

MCP server for testing Oracle → PostgreSQL API migrations.

Give it an API URL — it scans your repo for DB credentials, reads the handler code, fetches valid test data from PG, calls the API, and validates the DB state.

Works with **Claude Code** and **Antigravity**.

---

## Install

```bash
pip install apitest-mcp
```

Or from source:

```bash
git clone https://github.com/your-org/apitest-mcp
cd apitest-mcp
pip install -e .
```

---

## Setup

Copy `.env.example` to `.env` and fill in your values:

```bash
cp .env.example .env
```

```env
REPO_PATH=/path/to/your/repo
EMP_ID=your_emp_id
AK=your_jwt_token
```

- `REPO_PATH` — absolute path to the repo being tested (PHP or Go)
- `EMP_ID` — your employee ID for API auth
- `AK` — your JWT token for API auth

---

## Register in Claude Code

```bash
claude mcp add apitest-mcp -- python /path/to/apitest-mcp/server.py
```

Or add to `~/.claude/claude.json`:

```json
{
  "mcpServers": {
    "apitest-mcp": {
      "command": "python",
      "args": ["/path/to/apitest-mcp/server.py"],
      "env": {
        "REPO_PATH": "/path/to/your/repo",
        "EMP_ID": "your_emp_id",
        "AK": "your_jwt_token"
      }
    }
  }
}
```

## Register in Antigravity

```json
{
  "mcp_servers": [
    {
      "name": "apitest-mcp",
      "command": "python",
      "args": ["/path/to/apitest-mcp/server.py"],
      "env": {
        "REPO_PATH": "/path/to/your/repo",
        "EMP_ID": "your_emp_id",
        "AK": "your_jwt_token"
      }
    }
  ]
}
```

---

## Usage

Once registered, just tell Claude:

```
Test this API: POST http://localhost:8080/erp/preovp/preovpdata
```

Claude will:
1. Scan repo → find PG credentials
2. Read handler code → understand params + tables
3. Query PG → fetch valid test data
4. Call the API → capture response
5. Validate DB state → report PASS / FAIL

---

## Tools exposed

| Tool | Description |
|------|-------------|
| `scan_repo_config` | Scan repo to find PG connection details |
| `read_api_code` | Find and return handler code for an API URL |
| `query_pg` | Run a SELECT query on the discovered PG database |
| `call_api` | Call an API endpoint with auth injected automatically |
| `validate_db` | Run a SELECT and optionally assert expected field values |
