Summary
The Java MCP SQL Server successfully connects to the database and all tools are functional, but Cursor IDE shows a protocol validation error during initialization with a red error indicator. The error occurs during the MCP handshake but the server recovers and continues to work normally.
Environment
- OS: Windows 10 (Build 19045)
- Java Version: openjdk version "21.0.4" 2024-07-16 LTS
- MCP Server Version: 1.0.0
- JAR Location:
C:\java-mcp-sql-server-1.0.0.jar
- Database: Oracle
- Cursor IDE: 2.2.43
Configuration
{
"java-mcp-sql-server": {
"command": "java",
"args": ["-jar", "C:\\java-mcp-sql-server-1.0.0.jar"],
"env": {
"JMCP_JDBC_URL": "jdbc:oracle:thin:@//your-server:1521/your-database",
"JMCP_DB_USERNAME": "YOUR_USERNAME",
"JMCP_DB_PASSWORD": "YOUR_PASSWORD",
"JMCP_MODE": "stdio",
"JMCP_QUERY_SELECT_ONLY": "false"
}
}
}
Error Details
Server Startup (Successful)
23:47:21.222 [main] INFO com.dgdev91.mcpsql.SqlMcpServer - Starting SQL MCP Server...
23:47:21.481 [main] INFO com.dgdev91.mcpsql.service.DatabaseService - Oracle driver loaded successfully
23:47:23.111 [main] INFO com.dgdev91.mcpsql.service.DatabaseService - Successfully connected to database: ORACLE
23:47:23.242 [main] INFO com.dgdev91.mcpsql.SqlMcpServer - Database connection successful. Type: ORACLE, Query SELECT only: false
Protocol Validation Error
Cursor IDE reports a Zod validation error during initialization:
{
"code": "invalid_union",
"unionErrors": [
{
"issues": [
{
"code": "invalid_union",
"unionErrors": [
{
"issues": [
{
"code": "invalid_type",
"expected": "string",
"received": "null",
"path": ["id"],
"message": "Expected string, received null"
}
],
"name": "ZodError"
},
{
"issues": [
{
"code": "invalid_type",
"expected": "number",
"received": "null",
"path": ["id"],
"message": "Expected number, received null"
}
],
"name": "ZodError"
}
],
"path": ["id"],
"message": "Invalid input"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": ["method"],
"message": "Required"
},
{
"code": "unrecognized_keys",
"keys": ["error"],
"path": [],
"message": "Unrecognized key(s) in object: 'error'"
}
],
"name": "ZodError"
}
],
"path": [],
"message": "Invalid input"
}
Recovery (Successful)
After the error, the server recovers:
23:47:24.394 [info] Handling ListOfferings action, server stored: true
23:47:24.402 [info] listOfferings: Found 5 tools
23:47:24.402 [info] Found 5 tools, 0 prompts, and 0 resources
Expected Behavior
The MCP server should initialize without protocol validation errors. All messages sent during initialization should conform to the MCP protocol specification.
Actual Behavior
- Server starts successfully ✅
- Database connection established ✅
- Tools are available and functional ✅
- Protocol validation error during initialization ❌
- Red error indicator in Cursor IDE ❌
Impact
- Severity: Low (cosmetic issue)
- Functionality: All tools work correctly after initialization
- User Experience: Red error indicator is misleading and concerning
Steps to Reproduce
- Configure
mcp.json with java-mcp-sql-server
- Restart Cursor IDE
- Check MCP server logs in Cursor
- Observe protocol validation error during initialization
- Verify tools are still functional (they are)
Additional Notes
- The error appears to be related to a message sent during initialization that contains an
"error" key with a null id
- The server appears to send a non-standard message format that doesn't match MCP protocol expectations
- This might be related to error handling or logging during the initialization phase
- All 5 tools (
list_schemas, list_tables, get_table_structure, query_table, execute_query) work correctly after initialization
Note: This issue was identified while using the server with Oracle database, but it may affect other database types as well.
Summary
The Java MCP SQL Server successfully connects to the database and all tools are functional, but Cursor IDE shows a protocol validation error during initialization with a red error indicator. The error occurs during the MCP handshake but the server recovers and continues to work normally.
Environment
C:\java-mcp-sql-server-1.0.0.jarConfiguration
{ "java-mcp-sql-server": { "command": "java", "args": ["-jar", "C:\\java-mcp-sql-server-1.0.0.jar"], "env": { "JMCP_JDBC_URL": "jdbc:oracle:thin:@//your-server:1521/your-database", "JMCP_DB_USERNAME": "YOUR_USERNAME", "JMCP_DB_PASSWORD": "YOUR_PASSWORD", "JMCP_MODE": "stdio", "JMCP_QUERY_SELECT_ONLY": "false" } } }Error Details
Server Startup (Successful)
Protocol Validation Error
Cursor IDE reports a Zod validation error during initialization:
{ "code": "invalid_union", "unionErrors": [ { "issues": [ { "code": "invalid_union", "unionErrors": [ { "issues": [ { "code": "invalid_type", "expected": "string", "received": "null", "path": ["id"], "message": "Expected string, received null" } ], "name": "ZodError" }, { "issues": [ { "code": "invalid_type", "expected": "number", "received": "null", "path": ["id"], "message": "Expected number, received null" } ], "name": "ZodError" } ], "path": ["id"], "message": "Invalid input" }, { "code": "invalid_type", "expected": "string", "received": "undefined", "path": ["method"], "message": "Required" }, { "code": "unrecognized_keys", "keys": ["error"], "path": [], "message": "Unrecognized key(s) in object: 'error'" } ], "name": "ZodError" } ], "path": [], "message": "Invalid input" }Recovery (Successful)
After the error, the server recovers:
Expected Behavior
The MCP server should initialize without protocol validation errors. All messages sent during initialization should conform to the MCP protocol specification.
Actual Behavior
Impact
Steps to Reproduce
mcp.jsonwith java-mcp-sql-serverAdditional Notes
"error"key with anullidlist_schemas,list_tables,get_table_structure,query_table,execute_query) work correctly after initializationNote: This issue was identified while using the server with Oracle database, but it may affect other database types as well.