# Mcp Java Sdk Examples

> A collection of MCP server examples developed by various Java SDKs

- **Type:** MCP server
- **Install:** `agentstack add mcp-thought2code-mcp-java-sdk-examples`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [thought2code](https://agentstack.voostack.com/s/thought2code)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [thought2code](https://github.com/thought2code)
- **Source:** https://github.com/thought2code/mcp-java-sdk-examples

## Install

```sh
agentstack add mcp-thought2code-mcp-java-sdk-examples
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## 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)](https://modelcontextprotocol.io) 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_URL` is required
- `JDBC_USERNAME` is optional
- `JDBC_PASSWORD` is optional

Bundled sample database:

- `mcp-server-jdbc/mcp-server-jdbc-common/src/test/resources/sqlite3.db`

Build the MCP server jar first:

```bash
./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:

```bash
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:

```json
{
  "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:

```bash
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`:

```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:

```json
{
  "mcpServers": {
    "jdbc-mcp-server": {
      "command": "java",
      "args": ["-jar", ""],
      "env": {
        "JDBC_URL": "jdbc:sqlite:"
      }
    }
  }
}
```

### Cline

Open Cline MCP settings and add:

```json
{
  "mcpServers": {
    "jdbc-mcp-server": {
      "command": "java",
      "args": ["-jar", ""],
      "env": {
        "JDBC_URL": "jdbc:sqlite:"
      }
    }
  }
}
```

### VS Code

Create or update `.vscode/mcp.json`:

```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:

```json
"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](https://github.com/thought2code)
- **Source:** [thought2code/mcp-java-sdk-examples](https://github.com/thought2code/mcp-java-sdk-examples)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-thought2code-mcp-java-sdk-examples
- Seller: https://agentstack.voostack.com/s/thought2code
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
