Agent skill

Langchain4j MCP Server Patterns

by giuseppe-trisciuoglio in giuseppe-trisciuoglio/developer-kit

Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services.

MITAuto-check: notesAgent Workflows

Install Langchain4j MCP Server Patterns

skills CLI
$ npx skills add giuseppe-trisciuoglio/developer-kit --skill langchain4j-mcp-server-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install giuseppe-trisciuoglio/developer-kit langchain4j-mcp-server-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/giuseppe-trisciuoglio/developer-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/developer-kit-java/skills/langchain4j-mcp-server-patterns .claude/skills/langchain4j-mcp-server-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
langchain4j-mcp-server-patterns
GitHub stars
357
Token cost
~1.6k tokens
SKILL.md length
616 words
Files
4 (incl. references, assets)
Skills in repo
115
Repo updated
First seen
Licence
MIT

At a glance

Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services.

  • Works in 6 steps: Design the MCP surface before writing code → Implement providers with narrow… → Choose the transport intentionally → …
  • Building a Java MCP server
  • SKILL.md covers Overview, When to Use, Instructions and Examples, plus 4 more sections
  • Runs Java scripts from its folder; calls java

What it does

Langchain4j MCP Server Patterns is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services. Use when building a Java MCP server, implementing tool calling in Java, connecting LangChain4j to external MCP servers, or securing tool exposure for agent workflows.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files and assets (for example `references/api-reference.md` and `references/examples.md`).

It sits in Agent Workflows, covering MCP servers. It works with Model Context Protocol and Java. The repository describes itself as: Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI. The licence is MIT.

When your agent uses it

  • Building a Java MCP server
  • Implementing tool calling in Java
  • Connecting LangChain4j to external MCP servers
  • Securing tool exposure for agent workflows

Example prompts

  • “Use the langchain4j-mcp-server-patterns skill to provide LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java…”
  • “/langchain4j-mcp-server-patterns”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash, Glob, Grep, WebFetch

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Design the MCP surface before writing code
  2. Implement providers with narrow responsibilities
  3. Choose the transport intentionally
  4. Bridge MCP into LangChain4j carefully
  5. Add resilience and security controls
  6. Validate the full workflow

What it can do on your machine

Read from SKILL.md and the folder at commit fe73fb3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash
    • Glob
    • Grep
    • WebFetch

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Java), which the agent can run.

    Shell commands in SKILL.md call:

    • java

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Langchain4j MCP Server Patterns loads about 1.6k tokens when it runs, and up to ~9k if it reads all its reference files. Until then it costs about 97 tokens; SKILL.md has 616 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from giuseppe-trisciuoglio/developer-kit at commit fe73fb3, republished under its MIT licence (© giuseppe-trisciuoglio). 616 words, ~1,582 tokens.

Download SKILL.mdSave it as .claude/skills/langchain4j-mcp-server-patterns/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
langchain4j-mcp-server-patterns
description
Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services. Use when building a Java MCP server, implementing tool calling in Java, connecting LangChain4j to external MCP servers, or securing tool exposure for agent workflows.
allowed-tools
Read, Write, Edit, Bash, Glob, Grep, WebFetch

LangChain4j MCP Server Implementation Patterns

Overview

Use this skill to design and implement Model Context Protocol (MCP) integrations with LangChain4j.

The main concerns are:

  • defining a clean tool, resource, and prompt surface
  • choosing the right transport and bootstrap model
  • filtering unsafe capabilities before exposing them to agents or applications

Keep SKILL.md focused on the implementation flow. Use the bundled references for expanded examples and API-level detail.

When to Use

Use this skill when:

  • building a Java MCP server that exposes tools, resources, or prompts
  • integrating LangChain4j with one or more external MCP servers
  • wiring MCP support into a Spring Boot application
  • filtering available tools by tenant, user role, or runtime context
  • adding observability, resilience, and safe failure handling around MCP interactions
  • reviewing an MCP integration for prompt-injection and side-effect risks

Typical trigger phrases include langchain4j mcp, java mcp server, mcp tool provider, spring boot mcp, and connect langchain4j to mcp.

Instructions

1. Design the MCP surface before writing code

Decide what the server should expose:

  • tools for actions with clear inputs and side effects
  • resources for read-only or structured data access
  • prompts only when a reusable template adds real value

Keep names stable, descriptions concrete, and schemas small enough for a client or model to understand quickly.

2. Implement providers with narrow responsibilities

Use separate classes for each concern:

  • tool provider for executable functions
  • resource provider for discoverable and readable data
  • prompt provider for reusable prompt templates

Validate arguments before execution and return clear error messages for invalid input or unavailable dependencies.

3. Choose the transport intentionally

Use:

  • stdio for local integrations, CLI tools, and sidecar processes
  • HTTP or SSE for remote or shared services

Pin external server versions and document how the process is started, authenticated, and monitored.

4. Bridge MCP into LangChain4j carefully

When consuming MCP servers from LangChain4j:

  • initialize clients during application startup
  • cache tool lists only when stale metadata is acceptable
  • filter tools by trust level, environment, or user permissions
  • fail closed for dangerous tools rather than exposing everything by default
5. Add resilience and security controls

At minimum:

  • bound execution time for external calls
  • log server and tool identity for each failure
  • sanitize content returned by external resources before using it downstream
  • isolate privileged tools behind allowlists, qualifiers, or role checks
Show full SKILL.md (240 more words)Show less
6. Validate the full workflow

Before shipping:

  • verify tool discovery and invocation with a real MCP client
  • test disconnected or slow server behavior
  • confirm that tool filtering matches the intended authorization model
  • check that prompts and resources do not leak secrets or unsafe instructions

Examples

Example 1: Minimal tool provider and stdio server bootstrap
java
class WeatherToolProvider implements ToolProvider {

    @Override
    public List<ToolSpecification> listTools() {
        return List.of(
            ToolSpecification.builder()
                .name("get_weather")
                .description("Return the current weather for a city")
                .inputSchema(Map.of(
                    "type", "object",
                    "properties", Map.of(
                        "city", Map.of("type", "string")
                    ),
                    "required", List.of("city")
                ))
                .build()
        );
    }

    @Override
    public String executeTool(String name, String arguments) {
        return weatherService.lookup(arguments);
    }
}

MCPServer server = MCPServer.builder()
    .server(new StdioServer.Builder())
    .addToolProvider(new WeatherToolProvider())
    .build();

server.start();

Use this pattern for local tool execution or a sidecar process started by another application.

Example 2: Expose MCP tools to a LangChain4j AI service with filtering
java
McpToolProvider toolProvider = McpToolProvider.builder()
    .mcpClients(mcpClients)
    .failIfOneServerFails(false)
    .filter((client, tool) -> !tool.name().startsWith("admin_"))
    .build();

Assistant assistant = AiServices.builder(Assistant.class)
    .chatModel(chatModel)
    .toolProvider(toolProvider)
    .build();

Use this pattern when you want LangChain4j to consume external MCP servers while still enforcing trust boundaries.

Best Practices

  • Keep each tool focused, deterministic, and well-described.
  • Prefer explicit schemas over free-form string arguments.
  • Separate read-only resources from tools with side effects.
  • Filter or disable privileged tools by default.
  • Pin external MCP server packages or container versions.
  • Capture metrics for connection failures, invocation latency, and tool error rates.
  • Store longer protocol details and framework-specific wiring in references/ instead of expanding SKILL.md indefinitely.

Constraints and Warnings

  • External MCP servers are untrusted integration boundaries and may expose malicious or misleading content.
  • Do not forward raw resource content directly into autonomous tool execution without validation.
  • Some LangChain4j and MCP APIs evolve quickly; adapt class names and builders to the versions already used in the project.
  • Long-running or stateful tools need explicit timeout, cancellation, and cleanup behavior.
  • Stdio-based servers require process lifecycle management and robust logging.

References

  • references/examples.md
  • references/api-reference.md
  • prompt-engineering
  • spring-ai
  • clean-architecture

© giuseppe-trisciuoglio, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references, assets) in plugins/developer-kit-java/skills/langchain4j-mcp-server-patterns of giuseppe-trisciuoglio/developer-kit.

  • SKILL.md
  • assets/mcp-server-template.java
  • references/api-reference.md
  • references/examples.md

Open the folder on GitHubat commit fe73fb3

Compare with similar skills

Langchain4j MCP Server Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Langchain4j MCP Server Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Langchain4j MCP Server Patterns this skillgiuseppe-trisciuoglio/developer-kit357—~1.6kAutomated safety check: NotesMIT
Verify Multilang Supportjohnhuang316/code-index-mcp1k—~908Automated safety check: PassMIT
Amplicode InstallAmplicode/spring-skills128—~2.6kAutomated safety check: PassNone
Creator Tools CLIMojang/minecraft-creator-tools161—~1.1kAutomated safety check: PassCustom licence
Eclipse Editgradusnikov/eclipse-chatgpt-plugin172—~1.1kAutomated safety check: PassMIT
Edt MCP ArchitectureDitriXNew/EDT-MCP296—~1.2kAutomated safety check: PassAGPL-3.0

Similar skills

  • Verify Multilang Support

    johnhuang316/code-index-mcp

    A skill your agent uses when validating code-index-mcp language strategies, tree-sitter symbol extraction, calledby or import baselines, or sample projects under test/sample-projects after parser…

    1k GitHub stars~908 tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • Amplicode Install

    Amplicode/spring-skills

    Installs the Amplicode IntelliJ plugin into IntelliJ IDEA (Ultimate/Community) and GigaIDE on the user's machine.

    128 GitHub stars~2.6k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Creator Tools CLI

    Mojang/minecraft-creator-tools

    Run the Minecraft Creator Tools command line (mct, the @minecraft/creator-tools npm package) for Minecraft Bedrock Edition add-ons.

    161 GitHub stars~1.1k tokensUpdated 4 days ago
    Agent WorkflowsAuto-check passed
  • Eclipse Edit

    gradusnikov/eclipse-chatgpt-plugin

    Edit files in Eclipse projects using MCP tools. An agent skill from gradusnikov/eclipse-chatgpt-plugin.

    172 GitHub stars~1.1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Edt MCP Architecture

    DitriXNew/EDT-MCP

    Map of the EDT-MCP plugin's target architecture — where the shared helpers live, the layering rules, and the canonical way to do project/metadata/code resolution.

    296 GitHub stars~1.2k tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed
  • Dto Creator

    Amplicode/spring-skills

    Creates a DTO (Data Transfer Object) class for an entity. An agent skill from Amplicode/spring-skills.

    128 GitHub stars~7.5k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed

More from giuseppe-trisciuoglio/developer-kit

All 115 skills in this repo
  • Nestjs Drizzle Crud Generator

    giuseppe-trisciuoglio/developer-kit

    Generates complete CRUD modules for NestJS applications with Drizzle ORM.

    357 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Actuator

    giuseppe-trisciuoglio/developer-kit

    Provides patterns to configure Spring Boot Actuator for production-grade monitoring, health probes, secured management endpoints, and Micrometer metrics across JVM services.

    357 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Crud Patterns

    giuseppe-trisciuoglio/developer-kit

    Provides and generates complete CRUD workflows for Spring Boot 3 services.

    357 GitHub stars~2.5k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Security JWT

    giuseppe-trisciuoglio/developer-kit

    Provides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based…

    357 GitHub stars~3.9k tokensUpdated 1 mo ago
    Auto-check: notes
  • AWS CLI Beast

    giuseppe-trisciuoglio/developer-kit

    Provides advanced AWS CLI patterns for managing EC2, Lambda, S3, DynamoDB, RDS, VPC, IAM, and CloudWatch.

    357 GitHub stars~1.7k tokensUpdated 1 mo ago
    Auto-check: notes
  • PR Review Comments

    giuseppe-trisciuoglio/developer-kit

    Posts review findings from a JSON file as inline comments on a GitHub Pull Request, attaching each comment to its file and line.

    357 GitHub stars~1k tokensUpdated 1 mo ago
    Auto-check: notes

Categories

Questions about Langchain4j MCP Server Patterns

What does Langchain4j MCP Server Patterns do?

Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services. Langchain4j MCP Server Patterns is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services.

When should I use Langchain4j MCP Server Patterns?

Langchain4j MCP Server Patterns fits situations like: building a Java MCP server; implementing tool calling in Java; connecting LangChain4j to external MCP servers; securing tool exposure for agent workflows.

How do I install Langchain4j MCP Server Patterns in Claude Code?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill langchain4j-mcp-server-patterns -a claude-code`. Or copy the skill folder (plugins/developer-kit-java/skills/langchain4j-mcp-server-patterns in giuseppe-trisciuoglio/developer-kit) into .claude/skills/langchain4j-mcp-server-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Langchain4j MCP Server Patterns in Codex?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill langchain4j-mcp-server-patterns -a codex`. Or copy the skill folder (plugins/developer-kit-java/skills/langchain4j-mcp-server-patterns in giuseppe-trisciuoglio/developer-kit) into .agents/skills/langchain4j-mcp-server-patterns in your project. Codex loads it when a task matches its description.

Can I use Langchain4j MCP Server Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add giuseppe-trisciuoglio/developer-kit --skill langchain4j-mcp-server-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/langchain4j-mcp-server-patterns, .gemini/skills/langchain4j-mcp-server-patterns, .github/skills/langchain4j-mcp-server-patterns and .opencode/skills/langchain4j-mcp-server-patterns in your project.

What does Langchain4j MCP Server Patterns need to run?

Going by SKILL.md and its folder, Langchain4j MCP Server Patterns needs Java for the scripts in its folder and the command-line tools its instructions call (java). Its frontmatter pre-approves these tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch.

Does Langchain4j MCP Server Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Langchain4j MCP Server Patterns safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Langchain4j MCP Server Patterns use?

Langchain4j MCP Server Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Langchain4j MCP Server Patterns use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.4k tokens, read only when the agent opens those files.

What are the alternatives to Langchain4j MCP Server Patterns?

Skills that share tags, products or a category with Langchain4j MCP Server Patterns: Verify Multilang Support (johnhuang316/code-index-mcp, 1k stars), Amplicode Install (Amplicode/spring-skills, 128 stars), Creator Tools CLI (Mojang/minecraft-creator-tools, 161 stars) and Eclipse Edit (gradusnikov/eclipse-chatgpt-plugin, 172 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Langchain4j MCP Server Patterns?

giuseppe-trisciuoglio (a GitHub user) maintains it in giuseppe-trisciuoglio/developer-kit, which has 357 GitHub stars. The repository holds 115 skills in this directory. The repository was last updated on September 10, 2026.

Source: giuseppe-trisciuoglio/developer-kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.