oceanbase-mcp-server3


Nameoceanbase-mcp-server3 JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryA Model Context Protocol (MCP) server that enables secure interaction with OceanBase databases. Supports both MySQL and Oracle compatibility modes with high-performance async operations.
upload_time2025-08-19 09:16:33
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords mcp oceanbase model-context-protocol async connection-pool database mysql oracle fastmcp ai llm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OceanBase MCP Server

A Model Context Protocol (MCP) server that enables secure interaction with OceanBase databases. Supports both MySQL and Oracle compatibility modes with high-performance async operations.

## ๐Ÿš€ Features

- **MCP Protocol Support**: Built on FastMCP framework with standard MCP tools and resources
- **Multi-Database Compatibility**: Support for OceanBase (MySQL/Oracle modes) 
- **Asynchronous Architecture**: Built with `aiomysql/oracledb` for high-performance database operations
- **Connection Pooling**: Efficient connection management with configurable pool settings
- **Security Features**: Query type restrictions, automatic LIMIT enforcement, and parameter validation
- **Comprehensive Tools**: SQL execution, table structure queries, and test data generation

## ๐Ÿ“‹ Prerequisites

- Python >= 3.12
- OceanBase database instance (MySQL or Oracle mode)
- Network access to database server

## ๐Ÿ› ๏ธ Installation

### 1. Install from PyPI (Recommended)
```bash
pip install oceanbase-mcp-server3
```

### 2. Configure database connection

Edit `dbconfig.json` with your database credentials:

```json
{
    "dbPoolSize": 5,
    "dbMaxOverflow": 10,
    "dbPoolTimeout": 30,
    "dbType-Comment": "The database currently in use,such as OceanBase(Mysql/Oracle) DataBases",
    "dbList": [
        {   "dbInstanceId": "oceanbase_1",
            "dbHost": "localhost",
            "dbPort": 2881,
            "dbDatabase": "oceanbase_db",
            "dbUsername": "root",
            "dbPassword": "123456",
            "dbType": "oracle",
            "dbVersion": "V4.0.0",
            "dbActive": true
        },
        {   "dbInstanceId": "oceanbase_2",
            "dbHost": "localhost",
            "dbPort": 2881,
            "dbDatabase": "oceanbase_db",
            "dbUsername": "root",
            "dbPassword": "123456",
            "dbType": "mysql",
            "dbVersion": "V3.0.0",
            "dbActive": false
        }
    ],
    "logPath": "/path/to/logs",
    "logLevel": "info"
}
# dbType
Oceanbase Instance is in Oracle mode or Mysql mode.
# dbActive
Only database instances with dbActive set to true in the dbList configuration list are available. 
# logPath
MCP server log is stored in /path/to/logs/mcp_server.log.
# logLevel
TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL
```

### 3. Configure MCP Client

Add to your MCP client configuration file:

```json
{
  "mcpServers": {
    "oceanbase-mcp-client": {
      "command": "oceanbase-mcp-server3",
      "env": {
        "config_file": "/path/to/your/dbconfig.json"
      },
      "disabled": false
    }
  }
}
```

**Note**: Replace `/path/to/your/dbconfig.json` with the actual path to your configuration file.

### 4. Clone the repository (Development Mode)
```bash
git clone https://github.com/j00131120/mcp_database_server.git
cd mcp_database_server/oceanbase_mcp_server
# Import project into your IDE
```

### 5. Configure MCP Client for Development
```json
{
  "mcpServers": {
    "oceanbase-mcp-client": {
      "command": "/bin/uv",
      "args": ["run", "src/server.py"],
      "cwd": "/path/to/your/project",
      "env": {
        "config_file": "/path/to/your/dbconfig.json"
      },
      "disabled": false,
      "autoApprove": ["describe_table", "sql_exec", "generate_demo_data"]
    }
  }
}

# command
uv absolute path
# cwd
project absolute path
# config_file
dbconfig.json file path
```

## ๐Ÿš€ Quick Start

### Start the MCP Server
```bash
# Using the installed package
oceanbase-mcp-server3

# Using fastmcp CLI (development mode)
fastmcp run src/server.py

# Using uv (development mode)
uv run src/server.py

# Or directly with Python
python src/server.py

# Using fastmcp debug
fastmcp dev src/server.py
```

### Using with MCP Clients
The server provides the following MCP tools and resources:

#### Tools
- `sql_exec`: Execute any SQL statement
- `describe_table`: Get table structure information
- `generate_demo_data`: Generate test data for tables

#### Resources
- `database://tables`: Database table metadata
- `database://config`: Database configuration information

## ๐Ÿ“š API Reference

### SQL Execution Tool
```python
await sql_exec("SELECT * FROM users WHERE age > 18")
```

**Parameters:**
- `sql` (str): SQL statement to execute

**Returns:**
- `success` (bool): Execution status
- `result`: Query results or affected rows
- `message` (str): Status description

### Table Structure Tool
```python
await describe_table("users")
```

**Parameters:**
- `table_name` (str): Table name (supports `database.table` format)

**Returns:**
- Table structure information including columns, types, and constraints

### Test Data Generation
```python
await generate_demo_data("users", ["name", "email"], 50)
```

**Parameters:**
- `table_name` (str): Target table name
- `columns_name` (List[str]): Column names to populate
- `num` (int): Number of test records to generate

## โš™๏ธ Configuration

### Database Configuration
The `dbconfig.json` file supports multiple database instances:

```json
{
    "dbPoolSize": 5,
    "dbMaxOverflow": 10,
    "dbPoolTimeout": 30,
    "dbType-Comment": "The database currently in use,such as OceanBase(Mysql/Oracle) DataBases",
    "dbList": [
        {   "dbInstanceId": "oceanbase_1",
            "dbHost": "localhost",
            "dbPort": 3306,
            "dbDatabase": "oceanbase_db",
            "dbUsername": "root",
            "dbPassword": "123456",
            "dbType": "oracle",
            "dbVersion": "V4.0.0",
            "dbActive": true   // Only one instance should be active
        },
        {   "dbInstanceId": "oceanbase_2",
            "dbHost": "localhost",
            "dbPort": 2881,
            "dbDatabase": "oceanbase_db",
            "dbUsername": "root",
            "dbPassword": "123456",
            "dbType": "mysql",
            "dbVersion": "V3.0.0",
            "dbActive": false   // other instances should be inactive
        }
    ],
    "logPath": "/path/to/logs",
    "logLevel": "info"
}
```

### Logging Configuration
- **Log Levels**: TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL
- **Log Rotation**: 10 MB per file, 7 days retention
- **Output**: Both stderr (for MCP) and file logging

## ๐Ÿ”’ Security Features

### Query Restrictions
- **Parameterized Queries**: All SQL queries use parameter binding to prevent SQL injection
- **Transaction Management**: Automatic commit/rollback for data integrity
- **Parameter Validation**: Input validation for all parameters

### Configuration Security
- **Password Hiding**: Sensitive information is masked in responses
- **Instance Isolation**: Only active database configuration is exposed
- **Environment Override**: Secure configuration file path management

## ๐Ÿ—๏ธ Architecture

### Project Structure
```
src/
โ”œโ”€โ”€ server.py              # MCP server main entry point
โ”œโ”€โ”€ utils/                 # Utility modules
โ”‚   โ”œโ”€โ”€ db_config.py       # Database configuration management
โ”‚   โ”œโ”€โ”€ db_pool.py         # Connection pool management
โ”‚   โ”œโ”€โ”€ db_operate.py      # Database operations
โ”‚   โ”œโ”€โ”€ logger_util.py     # Logging management
โ”‚   โ””โ”€โ”€ __init__.py        # Module initialization
โ”œโ”€โ”€ resources/             # MCP resources
โ”‚   โ””โ”€โ”€ db_resources.py    # Database resources
โ””โ”€โ”€ tools/                 # MCP tools
    โ””โ”€โ”€ db_tool.py         # Database tools
```

### Key Components

#### Database Connection Pool
- **Singleton Pattern**: Ensures single pool instance
- **Async Management**: Non-blocking connection handling
- **Automatic Cleanup**: Connection release and pool management

#### Configuration Management
- **JSON-based**: Human-readable configuration format
- **Environment Override**: Flexible configuration management
- **Validation**: Required field validation and error handling

#### Logging System
- **Unified Interface**: Single logger instance across modules
- **Configurable Output**: File and console logging
- **Structured Format**: Timestamp, level, module, function, and line information

## ๐Ÿณ Docker Support

### Using Docker Compose

This project includes a comprehensive Docker Compose setup for OceanBase. See the docker-compose documentation for details.

```bash
# Start OceanBase with monitoring stack
docker-compose up -d

# Simple OceanBase setup (for development)
docker-compose -f docker-compose.simple.yml up -d
```

### OceanBase Connection
After starting Docker containers, connect using:
```bash
# MySQL mode connection
mysql -h 127.0.0.1 -P 2881 -u root -p123456

# Update your dbconfig.json to point to Docker instance
{
    "dbHost": "localhost",
    "dbPort": 2881,
    "dbDatabase": "test",
    "dbUsername": "root",
    "dbPassword": "123456",
    "dbType": "mysql"
}
```

## ๐Ÿงช Testing

### Generate Test Data
```python
# Generate 100 test records for users table
await generate_demo_data("users", ["name", "email", "phone"], 100)
```

### Test Database Connection
```python
# Test basic SQL execution
result = await sql_exec("SELECT 1 as test")
print(result)  # {'success': True, 'result': [{'test': 1}]}
```

## ๐Ÿ“Š Monitoring

### Database Status
```python
# Get database configuration (via MCP resource)
# This will show current active database instance configuration

# Get table information (via MCP resource)  
# This will show all tables with their structure and record counts

# Example output when using MCP client:
# Database: oracle V4.0.0 (or mysql V3.0.0)
# Tables: users, products, orders, etc.
```

### Connection Pool Status
- Pool size and overflow configuration
- Connection timeout settings
- Active connection count

## ๐Ÿšจ Troubleshooting

### Common Issues

#### Connection Errors
```bash
# Check OceanBase connectivity (MySQL mode)
mysql -h localhost -P 2881 -u username -p database_name

# Check OceanBase connectivity (Oracle mode)
sqlplus username/password@localhost:2881/database_name

# Verify configuration
python -c "from src.utils.db_config import load_db_config; print(load_db_config())"
```

#### Permission Issues
- Ensure database user has necessary privileges
- Check firewall and network access
- Verify database server is running

#### Configuration Errors
- Validate JSON syntax in `dbconfig.json`
- Check file permissions
- Verify environment variables

### Debug Mode
Set log level to DEBUG in configuration:
```json
{
    "logLevel": "debug"
}
```

## ๐Ÿค Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

### Development Setup
```bash
# Install dependencies with uv
uv sync

# Run with debug logging
export config_file="/path/to/your/dbconfig.json"
uv run src/server.py

# Or use fastmcp for development
fastmcp run src/server.py
```

### Code Quality Tools
```bash
# Format code
black src/
isort src/

# Lint code
flake8 src/
mypy src/

# Run tests
pytest

# Run tests with coverage
pytest --cov=src --cov-report=html

# Pre-commit hooks
pre-commit install
pre-commit run --all-files
```

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ‘ฅ Authors

- **Frank Jin** - *Initial work* - [j00131120@163.com](mailto:j00131120@163.com)

## ๐Ÿ™ Acknowledgments

- [FastMCP](https://github.com/fastmcp/fastmcp) - MCP framework
- [aiomysql](https://github.com/aio-libs/aiomysql) - Async MySQL driver
- [oracledb](https://oracle.github.io/python-oracledb/) - Oracle Database driver
- [loguru](https://github.com/Delgan/loguru) - Logging library

## ๐Ÿ“ž Support

For support and questions:
- Create an issue in the repository
- Contact: [j00131120@163.com](mailto:j00131120@163.com)

## ๐Ÿ”„ Changelog

### v1.0.3 (Current)
- Added Oracle database driver support (`oracledb`)
- Enhanced multi-database compatibility
- Improved configuration management
- Bug fixes and performance optimizations

### v1.0.1
- Enhanced type annotations and error handling
- Fixed configuration file path resolution
- Package name changed to `oceanbase-mcp-server3`

### v1.0.0
- Initial release
- MCP protocol support
- Multi-database compatibility
- Async connection pooling
- Security features implementation

## ๐Ÿ“ฆ Building and Distribution

### Build the Package
```bash
# Using uv (recommended)
uv build

# Or using traditional tools
python -m build
```

### Publish to PyPI
```bash
# Check the package
python -m twine check dist/*

# Upload to PyPI
python -m twine upload dist/*
```

### Package Information
- **Package Name**: `oceanbase-mcp-server3`
- **Entry Point**: `oceanbase-mcp-server3`
- **MCP Server Entry Point**: `main`
- **Python Version**: >= 3.12
- **License**: MIT

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "oceanbase-mcp-server3",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Frank Jin <j00131120@163.com>",
    "keywords": "mcp, oceanbase, model-context-protocol, async, connection-pool, database, mysql, oracle, fastmcp, ai, llm",
    "author": null,
    "author_email": "Frank Jin <j00131120@163.com>",
    "download_url": "https://files.pythonhosted.org/packages/30/e1/fd02f2acc0295f8f029265dfc8925fac522013d43a2091b2a967f6dcc553/oceanbase_mcp_server3-1.0.1.tar.gz",
    "platform": null,
    "description": "# OceanBase MCP Server\n\nA Model Context Protocol (MCP) server that enables secure interaction with OceanBase databases. Supports both MySQL and Oracle compatibility modes with high-performance async operations.\n\n## \ud83d\ude80 Features\n\n- **MCP Protocol Support**: Built on FastMCP framework with standard MCP tools and resources\n- **Multi-Database Compatibility**: Support for OceanBase (MySQL/Oracle modes) \n- **Asynchronous Architecture**: Built with `aiomysql/oracledb` for high-performance database operations\n- **Connection Pooling**: Efficient connection management with configurable pool settings\n- **Security Features**: Query type restrictions, automatic LIMIT enforcement, and parameter validation\n- **Comprehensive Tools**: SQL execution, table structure queries, and test data generation\n\n## \ud83d\udccb Prerequisites\n\n- Python >= 3.12\n- OceanBase database instance (MySQL or Oracle mode)\n- Network access to database server\n\n## \ud83d\udee0\ufe0f Installation\n\n### 1. Install from PyPI (Recommended)\n```bash\npip install oceanbase-mcp-server3\n```\n\n### 2. Configure database connection\n\nEdit `dbconfig.json` with your database credentials:\n\n```json\n{\n    \"dbPoolSize\": 5,\n    \"dbMaxOverflow\": 10,\n    \"dbPoolTimeout\": 30,\n    \"dbType-Comment\": \"The database currently in use,such as OceanBase(Mysql/Oracle) DataBases\",\n    \"dbList\": [\n        {   \"dbInstanceId\": \"oceanbase_1\",\n            \"dbHost\": \"localhost\",\n            \"dbPort\": 2881,\n            \"dbDatabase\": \"oceanbase_db\",\n            \"dbUsername\": \"root\",\n            \"dbPassword\": \"123456\",\n            \"dbType\": \"oracle\",\n            \"dbVersion\": \"V4.0.0\",\n            \"dbActive\": true\n        },\n        {   \"dbInstanceId\": \"oceanbase_2\",\n            \"dbHost\": \"localhost\",\n            \"dbPort\": 2881,\n            \"dbDatabase\": \"oceanbase_db\",\n            \"dbUsername\": \"root\",\n            \"dbPassword\": \"123456\",\n            \"dbType\": \"mysql\",\n            \"dbVersion\": \"V3.0.0\",\n            \"dbActive\": false\n        }\n    ],\n    \"logPath\": \"/path/to/logs\",\n    \"logLevel\": \"info\"\n}\n# dbType\nOceanbase Instance is in Oracle mode or Mysql mode.\n# dbActive\nOnly database instances with dbActive set to true in the dbList configuration list are available. \n# logPath\nMCP server log is stored in /path/to/logs/mcp_server.log.\n# logLevel\nTRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL\n```\n\n### 3. Configure MCP Client\n\nAdd to your MCP client configuration file:\n\n```json\n{\n  \"mcpServers\": {\n    \"oceanbase-mcp-client\": {\n      \"command\": \"oceanbase-mcp-server3\",\n      \"env\": {\n        \"config_file\": \"/path/to/your/dbconfig.json\"\n      },\n      \"disabled\": false\n    }\n  }\n}\n```\n\n**Note**: Replace `/path/to/your/dbconfig.json` with the actual path to your configuration file.\n\n### 4. Clone the repository (Development Mode)\n```bash\ngit clone https://github.com/j00131120/mcp_database_server.git\ncd mcp_database_server/oceanbase_mcp_server\n# Import project into your IDE\n```\n\n### 5. Configure MCP Client for Development\n```json\n{\n  \"mcpServers\": {\n    \"oceanbase-mcp-client\": {\n      \"command\": \"/bin/uv\",\n      \"args\": [\"run\", \"src/server.py\"],\n      \"cwd\": \"/path/to/your/project\",\n      \"env\": {\n        \"config_file\": \"/path/to/your/dbconfig.json\"\n      },\n      \"disabled\": false,\n      \"autoApprove\": [\"describe_table\", \"sql_exec\", \"generate_demo_data\"]\n    }\n  }\n}\n\n# command\nuv absolute path\n# cwd\nproject absolute path\n# config_file\ndbconfig.json file path\n```\n\n## \ud83d\ude80 Quick Start\n\n### Start the MCP Server\n```bash\n# Using the installed package\noceanbase-mcp-server3\n\n# Using fastmcp CLI (development mode)\nfastmcp run src/server.py\n\n# Using uv (development mode)\nuv run src/server.py\n\n# Or directly with Python\npython src/server.py\n\n# Using fastmcp debug\nfastmcp dev src/server.py\n```\n\n### Using with MCP Clients\nThe server provides the following MCP tools and resources:\n\n#### Tools\n- `sql_exec`: Execute any SQL statement\n- `describe_table`: Get table structure information\n- `generate_demo_data`: Generate test data for tables\n\n#### Resources\n- `database://tables`: Database table metadata\n- `database://config`: Database configuration information\n\n## \ud83d\udcda API Reference\n\n### SQL Execution Tool\n```python\nawait sql_exec(\"SELECT * FROM users WHERE age > 18\")\n```\n\n**Parameters:**\n- `sql` (str): SQL statement to execute\n\n**Returns:**\n- `success` (bool): Execution status\n- `result`: Query results or affected rows\n- `message` (str): Status description\n\n### Table Structure Tool\n```python\nawait describe_table(\"users\")\n```\n\n**Parameters:**\n- `table_name` (str): Table name (supports `database.table` format)\n\n**Returns:**\n- Table structure information including columns, types, and constraints\n\n### Test Data Generation\n```python\nawait generate_demo_data(\"users\", [\"name\", \"email\"], 50)\n```\n\n**Parameters:**\n- `table_name` (str): Target table name\n- `columns_name` (List[str]): Column names to populate\n- `num` (int): Number of test records to generate\n\n## \u2699\ufe0f Configuration\n\n### Database Configuration\nThe `dbconfig.json` file supports multiple database instances:\n\n```json\n{\n    \"dbPoolSize\": 5,\n    \"dbMaxOverflow\": 10,\n    \"dbPoolTimeout\": 30,\n    \"dbType-Comment\": \"The database currently in use,such as OceanBase(Mysql/Oracle) DataBases\",\n    \"dbList\": [\n        {   \"dbInstanceId\": \"oceanbase_1\",\n            \"dbHost\": \"localhost\",\n            \"dbPort\": 3306,\n            \"dbDatabase\": \"oceanbase_db\",\n            \"dbUsername\": \"root\",\n            \"dbPassword\": \"123456\",\n            \"dbType\": \"oracle\",\n            \"dbVersion\": \"V4.0.0\",\n            \"dbActive\": true   // Only one instance should be active\n        },\n        {   \"dbInstanceId\": \"oceanbase_2\",\n            \"dbHost\": \"localhost\",\n            \"dbPort\": 2881,\n            \"dbDatabase\": \"oceanbase_db\",\n            \"dbUsername\": \"root\",\n            \"dbPassword\": \"123456\",\n            \"dbType\": \"mysql\",\n            \"dbVersion\": \"V3.0.0\",\n            \"dbActive\": false   // other instances should be inactive\n        }\n    ],\n    \"logPath\": \"/path/to/logs\",\n    \"logLevel\": \"info\"\n}\n```\n\n### Logging Configuration\n- **Log Levels**: TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL\n- **Log Rotation**: 10 MB per file, 7 days retention\n- **Output**: Both stderr (for MCP) and file logging\n\n## \ud83d\udd12 Security Features\n\n### Query Restrictions\n- **Parameterized Queries**: All SQL queries use parameter binding to prevent SQL injection\n- **Transaction Management**: Automatic commit/rollback for data integrity\n- **Parameter Validation**: Input validation for all parameters\n\n### Configuration Security\n- **Password Hiding**: Sensitive information is masked in responses\n- **Instance Isolation**: Only active database configuration is exposed\n- **Environment Override**: Secure configuration file path management\n\n## \ud83c\udfd7\ufe0f Architecture\n\n### Project Structure\n```\nsrc/\n\u251c\u2500\u2500 server.py              # MCP server main entry point\n\u251c\u2500\u2500 utils/                 # Utility modules\n\u2502   \u251c\u2500\u2500 db_config.py       # Database configuration management\n\u2502   \u251c\u2500\u2500 db_pool.py         # Connection pool management\n\u2502   \u251c\u2500\u2500 db_operate.py      # Database operations\n\u2502   \u251c\u2500\u2500 logger_util.py     # Logging management\n\u2502   \u2514\u2500\u2500 __init__.py        # Module initialization\n\u251c\u2500\u2500 resources/             # MCP resources\n\u2502   \u2514\u2500\u2500 db_resources.py    # Database resources\n\u2514\u2500\u2500 tools/                 # MCP tools\n    \u2514\u2500\u2500 db_tool.py         # Database tools\n```\n\n### Key Components\n\n#### Database Connection Pool\n- **Singleton Pattern**: Ensures single pool instance\n- **Async Management**: Non-blocking connection handling\n- **Automatic Cleanup**: Connection release and pool management\n\n#### Configuration Management\n- **JSON-based**: Human-readable configuration format\n- **Environment Override**: Flexible configuration management\n- **Validation**: Required field validation and error handling\n\n#### Logging System\n- **Unified Interface**: Single logger instance across modules\n- **Configurable Output**: File and console logging\n- **Structured Format**: Timestamp, level, module, function, and line information\n\n## \ud83d\udc33 Docker Support\n\n### Using Docker Compose\n\nThis project includes a comprehensive Docker Compose setup for OceanBase. See the docker-compose documentation for details.\n\n```bash\n# Start OceanBase with monitoring stack\ndocker-compose up -d\n\n# Simple OceanBase setup (for development)\ndocker-compose -f docker-compose.simple.yml up -d\n```\n\n### OceanBase Connection\nAfter starting Docker containers, connect using:\n```bash\n# MySQL mode connection\nmysql -h 127.0.0.1 -P 2881 -u root -p123456\n\n# Update your dbconfig.json to point to Docker instance\n{\n    \"dbHost\": \"localhost\",\n    \"dbPort\": 2881,\n    \"dbDatabase\": \"test\",\n    \"dbUsername\": \"root\",\n    \"dbPassword\": \"123456\",\n    \"dbType\": \"mysql\"\n}\n```\n\n## \ud83e\uddea Testing\n\n### Generate Test Data\n```python\n# Generate 100 test records for users table\nawait generate_demo_data(\"users\", [\"name\", \"email\", \"phone\"], 100)\n```\n\n### Test Database Connection\n```python\n# Test basic SQL execution\nresult = await sql_exec(\"SELECT 1 as test\")\nprint(result)  # {'success': True, 'result': [{'test': 1}]}\n```\n\n## \ud83d\udcca Monitoring\n\n### Database Status\n```python\n# Get database configuration (via MCP resource)\n# This will show current active database instance configuration\n\n# Get table information (via MCP resource)  \n# This will show all tables with their structure and record counts\n\n# Example output when using MCP client:\n# Database: oracle V4.0.0 (or mysql V3.0.0)\n# Tables: users, products, orders, etc.\n```\n\n### Connection Pool Status\n- Pool size and overflow configuration\n- Connection timeout settings\n- Active connection count\n\n## \ud83d\udea8 Troubleshooting\n\n### Common Issues\n\n#### Connection Errors\n```bash\n# Check OceanBase connectivity (MySQL mode)\nmysql -h localhost -P 2881 -u username -p database_name\n\n# Check OceanBase connectivity (Oracle mode)\nsqlplus username/password@localhost:2881/database_name\n\n# Verify configuration\npython -c \"from src.utils.db_config import load_db_config; print(load_db_config())\"\n```\n\n#### Permission Issues\n- Ensure database user has necessary privileges\n- Check firewall and network access\n- Verify database server is running\n\n#### Configuration Errors\n- Validate JSON syntax in `dbconfig.json`\n- Check file permissions\n- Verify environment variables\n\n### Debug Mode\nSet log level to DEBUG in configuration:\n```json\n{\n    \"logLevel\": \"debug\"\n}\n```\n\n## \ud83e\udd1d Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n### Development Setup\n```bash\n# Install dependencies with uv\nuv sync\n\n# Run with debug logging\nexport config_file=\"/path/to/your/dbconfig.json\"\nuv run src/server.py\n\n# Or use fastmcp for development\nfastmcp run src/server.py\n```\n\n### Code Quality Tools\n```bash\n# Format code\nblack src/\nisort src/\n\n# Lint code\nflake8 src/\nmypy src/\n\n# Run tests\npytest\n\n# Run tests with coverage\npytest --cov=src --cov-report=html\n\n# Pre-commit hooks\npre-commit install\npre-commit run --all-files\n```\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\udc65 Authors\n\n- **Frank Jin** - *Initial work* - [j00131120@163.com](mailto:j00131120@163.com)\n\n## \ud83d\ude4f Acknowledgments\n\n- [FastMCP](https://github.com/fastmcp/fastmcp) - MCP framework\n- [aiomysql](https://github.com/aio-libs/aiomysql) - Async MySQL driver\n- [oracledb](https://oracle.github.io/python-oracledb/) - Oracle Database driver\n- [loguru](https://github.com/Delgan/loguru) - Logging library\n\n## \ud83d\udcde Support\n\nFor support and questions:\n- Create an issue in the repository\n- Contact: [j00131120@163.com](mailto:j00131120@163.com)\n\n## \ud83d\udd04 Changelog\n\n### v1.0.3 (Current)\n- Added Oracle database driver support (`oracledb`)\n- Enhanced multi-database compatibility\n- Improved configuration management\n- Bug fixes and performance optimizations\n\n### v1.0.1\n- Enhanced type annotations and error handling\n- Fixed configuration file path resolution\n- Package name changed to `oceanbase-mcp-server3`\n\n### v1.0.0\n- Initial release\n- MCP protocol support\n- Multi-database compatibility\n- Async connection pooling\n- Security features implementation\n\n## \ud83d\udce6 Building and Distribution\n\n### Build the Package\n```bash\n# Using uv (recommended)\nuv build\n\n# Or using traditional tools\npython -m build\n```\n\n### Publish to PyPI\n```bash\n# Check the package\npython -m twine check dist/*\n\n# Upload to PyPI\npython -m twine upload dist/*\n```\n\n### Package Information\n- **Package Name**: `oceanbase-mcp-server3`\n- **Entry Point**: `oceanbase-mcp-server3`\n- **MCP Server Entry Point**: `main`\n- **Python Version**: >= 3.12\n- **License**: MIT\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Model Context Protocol (MCP) server that enables secure interaction with OceanBase databases. Supports both MySQL and Oracle compatibility modes with high-performance async operations.",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/j00131120/mcp_database_server/issues",
        "Changelog": "https://github.com/j00131120/mcp_database_server/blob/main/oceanbase_mcp_server/CHANGELOG.md",
        "Docker Images": "https://github.com/j00131120/mcp_database_server/tree/main/oceanbase_mcp_server#docker-support",
        "Documentation": "https://github.com/j00131120/mcp_database_server/blob/main/oceanbase_mcp_server/README.md",
        "Documentation (\u4e2d\u6587)": "https://github.com/j00131120/mcp_database_server/blob/main/oceanbase_mcp_server/README-zh.md",
        "Homepage": "https://github.com/j00131120/mcp_database_server/tree/main/oceanbase_mcp_server",
        "Repository": "https://github.com/j00131120/mcp_database_server.git",
        "Source Code": "https://github.com/j00131120/mcp_database_server/tree/main/oceanbase_mcp_server"
    },
    "split_keywords": [
        "mcp",
        " oceanbase",
        " model-context-protocol",
        " async",
        " connection-pool",
        " database",
        " mysql",
        " oracle",
        " fastmcp",
        " ai",
        " llm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4bac77e00331a507ff9d4122ad6598873746cb0ee3af4a302d18644d013be1ad",
                "md5": "77a94acedc1676ec53ba17a29e690670",
                "sha256": "44f639b518edcd7711534bb36c44a1979c576a6d4eae542dcef79880264f68cb"
            },
            "downloads": -1,
            "filename": "oceanbase_mcp_server3-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "77a94acedc1676ec53ba17a29e690670",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 19923,
            "upload_time": "2025-08-19T09:16:32",
            "upload_time_iso_8601": "2025-08-19T09:16:32.140566Z",
            "url": "https://files.pythonhosted.org/packages/4b/ac/77e00331a507ff9d4122ad6598873746cb0ee3af4a302d18644d013be1ad/oceanbase_mcp_server3-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "30e1fd02f2acc0295f8f029265dfc8925fac522013d43a2091b2a967f6dcc553",
                "md5": "c54a59f84235cebee3e2c3454bf0804e",
                "sha256": "6bb7d461e7a8cd8fa528d46c817fe8eed29897623c9e260e028479e814f7095a"
            },
            "downloads": -1,
            "filename": "oceanbase_mcp_server3-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c54a59f84235cebee3e2c3454bf0804e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 17967,
            "upload_time": "2025-08-19T09:16:33",
            "upload_time_iso_8601": "2025-08-19T09:16:33.382548Z",
            "url": "https://files.pythonhosted.org/packages/30/e1/fd02f2acc0295f8f029265dfc8925fac522013d43a2091b2a967f6dcc553/oceanbase_mcp_server3-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 09:16:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "j00131120",
    "github_project": "mcp_database_server",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "oceanbase-mcp-server3"
}
        
Elapsed time: 0.94375s