Install
$ agentstack add mcp-thought2code-mcp-java-sdk-examples ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
MCP Java SDK Examples
A collection of MCP examples developed with Java SDKs.
Requirements
- Java 17 or later
- Maven 3.9.16 or the included Maven Wrapper
What is MCP?
The Model Context Protocol (MCP) lets servers expose data and functionality to LLM applications in a standardized way. MCP servers can expose resources, tools, prompts, and more.
Examples
- [JDBC Server](mcp-server-jdbc) - Exposes JDBC database metadata through an MCP resource
JDBC Server
The JDBC example includes an annotated-sdk implementation backed by a JDBC connection. The packaged server starts in STDIO mode by default.
Implemented resource:
db://schema- Returns database product/version plus table and column metadata as JSON
JDBC configuration for the MCP server process:
JDBC_URLis requiredJDBC_USERNAMEis optionalJDBC_PASSWORDis optional
Bundled sample database:
mcp-server-jdbc/mcp-server-jdbc-common/src/test/resources/sqlite3.db
Build the MCP server jar first:
./mvnw -pl mcp-server-jdbc/mcp-server-jdbc-annotated-sdk -am package
On Windows PowerShell, use .\mvnw.cmd instead of ./mvnw.
The jar is created at:
mcp-server-jdbc/mcp-server-jdbc-annotated-sdk/target/mcp-server-jdbc-annotated-sdk.jar
Use these paths in the examples below:
- `` - absolute path to this repository
- `
-/mcp-server-jdbc/mcp-server-jdbc-annotated-sdk/target/mcp-server-jdbc-annotated-sdk.jar` - `
-/mcp-server-jdbc/mcp-server-jdbc-common/src/test/resources/sqlite3.db`
For Windows paths in JSON/TOML, prefer forward slashes, for example C:/Users/me/code/mcp-java-sdk-examples/....
MCP Inspector
Start Inspector with the JDBC server as a STDIO server:
npx @modelcontextprotocol/inspector -e JDBC_URL=jdbc:sqlite: -- java -jar
Open the Inspector URL printed in the terminal, then browse the db://schema resource.
Claude Desktop
Add the server to Claude Desktop MCP settings:
{
"mcpServers": {
"jdbc-mcp-server": {
"command": "java",
"args": ["-jar", ""],
"env": {
"JDBC_URL": "jdbc:sqlite:"
}
}
}
}
Restart Claude Desktop, then browse the db://schema resource from the MCP tools/resources panel.
Codex
Add the server with the Codex CLI:
codex mcp add jdbc-mcp-server --env JDBC_URL=jdbc:sqlite: -- java -jar
Or add it to ~/.codex/config.toml or a trusted project .codex/config.toml:
[mcp_servers.jdbc-mcp-server]
command = "java"
args = ["-jar", ""]
[mcp_servers.jdbc-mcp-server.env]
JDBC_URL = "jdbc:sqlite:"
Cursor
Add this server in Cursor MCP settings:
{
"mcpServers": {
"jdbc-mcp-server": {
"command": "java",
"args": ["-jar", ""],
"env": {
"JDBC_URL": "jdbc:sqlite:"
}
}
}
}
Cline
Open Cline MCP settings and add:
{
"mcpServers": {
"jdbc-mcp-server": {
"command": "java",
"args": ["-jar", ""],
"env": {
"JDBC_URL": "jdbc:sqlite:"
}
}
}
}
VS Code
Create or update .vscode/mcp.json:
{
"servers": {
"jdbc-mcp-server": {
"type": "stdio",
"command": "java",
"args": ["-jar", ""],
"env": {
"JDBC_URL": "jdbc:sqlite:"
}
}
}
}
For databases that require credentials, add them to the MCP server environment:
"env": {
"JDBC_URL": "jdbc:postgresql://localhost:5432/example",
"JDBC_USERNAME": "user",
"JDBC_PASSWORD": "password"
}
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: thought2code
- Source: thought2code/mcp-java-sdk-examples
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.