Metadata-Version: 2.4
Name: mcp-schema-fetch
Version: 0.1.0
Summary: MCP server for database schema discovery across PostgreSQL, MySQL, SQL Server, and Salesforce
Project-URL: Homepage, https://github.com/nickpeterson92/mcp-schema-fetch
Project-URL: Repository, https://github.com/nickpeterson92/mcp-schema-fetch
Author: Nick Peterson
License-Expression: MIT
Keywords: database,mcp,mysql,postgresql,salesforce,schema,sqlserver
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: aiomysql>=0.2
Requires-Dist: aioodbc>=0.5
Requires-Dist: asyncpg>=0.29
Requires-Dist: mcp>=1.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: simple-salesforce>=1.12
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# mcp-schema-fetch

MCP server for database schema discovery across PostgreSQL, MySQL, SQL Server, and Salesforce.

## Installation

```bash
pip install mcp-schema-fetch
```

All database drivers (PostgreSQL, MySQL, SQL Server, Salesforce) are included.

## Usage with Claude Desktop

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "schema-fetch": {
      "command": "mcp-schema-fetch",
      "args": ["--config", "/path/to/db_registry.yaml"]
    }
  }
}
```

Or use `uvx` to run without installing:

```json
{
  "mcpServers": {
    "schema-fetch": {
      "command": "uvx",
      "args": ["mcp-schema-fetch", "--config", "/path/to/db_registry.yaml"]
    }
  }
}
```

## Configuration

Create a `db_registry.yaml` file:

```yaml
databases:
  my_postgres:
    type: postgresql
    host: ${PG_HOST:-localhost}
    port: 5432
    database: mydb
    username: ${PG_USER}
    password: ${PG_PASSWORD}
    schema: public

  salesforce:
    type: salesforce
    host: "login.salesforce.com"
    port: 443
    database: "production"
    username: ${SF_USER}
    password: ${SF_PASSWORD}
    security_token: ${SF_TOKEN}
```

Environment variables in `${VAR}` or `${VAR:-default}` format are automatically resolved.

## Setup

### Config File Discovery

The server looks for `db_registry.yaml` in this order:

1. `--config` / `-c` CLI argument
2. `MCP_SCHEMA_FETCH_CONFIG` environment variable
3. `./config/db_registry.yaml` (current directory)
4. `~/.config/mcp-schema-fetch/db_registry.yaml` (user config)


## Tools

The recommended workflow is: `list_databases` -> `list_tables` -> `get_table_schema`.

### list_databases

List all configured database connections.

```
Returns: { databases: [{ name, type }], count }
```

### list_tables

List all tables in a database. For Salesforce, returns queryable SObjects.

```
Args: db_name
Returns: { database, tables: [string], count }
```

### get_table_schema

Fetch column schema for a database table. Column types are normalized across vendors (e.g., `VARCHAR`, `NVARCHAR`, `TEXT` all become `varchar`).

```
Args: db_name, table_name
Returns: { database, table, schema, columns: [{ name, type, nullable }], column_count }
```

## Development

```bash
git clone https://github.com/nickpeterson92/mcp-schema-fetch
cd mcp-schema-fetch
pip install -e ".[all,dev]"
pytest
```
