database-mcp-server/
├── pom.xml # Maven project configuration
├── README.md # Project documentation
├── test-mcp-protocol.py # MCP Protocol Test script
├── test-mcp-server.py # MCP Server Test script
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── skanga/
│ │ │ ├── DatabaseMcpServer.java # Main server class
│ │ │ ├── DatabaseConfig.java # Configuration
│ │ │ ├── DatabaseService.java # Database operations
│ │ │ ├── DatabaseResource.java # Resource representation
│ │ │ └── QueryResult.java # Query results
│ │ └── resources/
│ │ └── application.properties # Configuration file (optional)
│ └── test/
│ └── java/
│ └── com/
│ └── skanga/
│ └── (test files)
└── target/ # Build output (created by Maven)
└── dbchat-4.2.1.jar # Executable JAR
- Implements MCP protocol (JSON-RPC over stdio)
- Handles all MCP methods: initialize, tools/list, tools/call, resources/list, resources/read
- Manages request/response processing
- Error handling and logging
- JDBC connection pool & connenction management
- SQL query execution with result formatting
- Database metadata discovery (tables, views, schemas)
- Resource content generation
- Multi-database support through JDBC drivers
- Database connection parameters
- Timeout and pooling settings
- Database type detection
- Environment variable support
- Represents database objects as MCP resources
- URI-based resource identification
- Metadata and content management
- Structured query results
- Column metadata and row data
- Execution timing information
- Formatted output support