Skip to content

Added MySQL Support #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Chanakya-TS
Copy link

Add MySQL Database Support

Motivation and Context

Added complete MySQL database support to the MCP Registry, providing an alternative to MongoDB for storing and managing registry data. This implementation follows the same interface as the existing database implementations.

How Has This Been Tested?

  • Implemented MySQL database interface with all required methods:
    • List for retrieving servers with pagination
    • GetByID for fetching individual server details
    • Publish for adding new server entries
    • ImportSeed for bulk data import
  • Added comprehensive test suite covering:
    • Basic CRUD operations
    • Version validation
    • Pagination
    • Error handling
    • Seed data import
  • Created MySQL schema with appropriate table structure
  • Added Docker Compose configuration for MySQL service with:
    • Health checks
    • Volume mounts for data persistence
    • Initial schema loading
    • Environment variable configuration
  • Verified functionality using test scripts:
    • test_endpoints.sh: Tests all API endpoints including:
      • Health check
      • Server listing with pagination
      • Server retrieval by ID
    • test_publish.sh: Tests server publishing with:
      • GitHub token authentication
      • Payload validation
      • Response format verification
      • UUID generation
  • Tested with Docker Compose setup
  • Verified API endpoints work correctly with MySQL backend

Breaking Changes

No breaking changes. The MySQL implementation follows the same interface as existing database implementations.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Key components added:

  1. mysql.go: Core MySQL implementation with all database operations
  2. mysql_test.go: Comprehensive test suite
  3. mysql_schema.sql: Database schema definition
  4. docker-compose.mysql.yml: Docker Compose configuration with:
    • MySQL 8.0 service with health checks
    • Registry service configured to use MySQL
    • Volume mounts for data persistence
    • Environment variable configuration
    • Initial schema loading from mysql_schema.sql

The implementation provides:

  • Full compatibility with existing registry features
  • Proper error handling and validation
  • Efficient data storage and retrieval
  • Support for pagination and filtering
  • Transaction support for data integrity
  • Easy deployment with Docker Compose
  • Verified functionality through comprehensive test scripts

Signed-off-by: Chanakya Thirumala Setty <[email protected]>
@connor4312
Copy link
Collaborator

This was previous discussed in #122

@tadasant
Copy link
Contributor

@Chanakya-TS I'm going to close this as something we don't plan to implement. I don't see a reason for us to support more than one datastore (currently MongoDB, perhaps soon transitioned to Postgres, at which point I would expect Mongo-related code to be sunset). If you have more opinions on this I'd encourage adding to the discussion on #19

@tadasant tadasant closed this Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants