Commit Graph

9 Commits

Author SHA1 Message Date
Eunbin Son cc074e6173
fix: Add dockerTlsVerify builder method and deprecate misspelled dockerTslVerify (#5575)
## Issue
Closes #5573

## Change
`DockerMcpTransport.Builder` exposed the TLS-verify setter only as the
misspelled `dockerTslVerify(Boolean)` (`Tsl` instead of `Tls`). The
backing field and parameter already use the correct `dockerTlsVerify`.

This adds the correctly spelled `dockerTlsVerify(Boolean)` builder
method and keeps the old `dockerTslVerify(Boolean)` as a `@Deprecated`
alias that delegates to it, so existing callers keep compiling — no
breaking change.

```java
public DockerMcpTransport.Builder dockerTlsVerify(Boolean dockerTlsVerify) {
    this.dockerTlsVerify = dockerTlsVerify;
    return this;
}

/** @deprecated misspelled method name, use {@link #dockerTlsVerify(Boolean)} instead. */
@Deprecated
public DockerMcpTransport.Builder dockerTslVerify(Boolean dockerTlsVerify) {
    return dockerTlsVerify(dockerTlsVerify);
}
```

Added two unit tests in `DockerMcpTransportTest` that build a transport
through each method and verify the `dockerTlsVerify` field is set.

## General checklist
- [X] There are no breaking changes (API, behaviour) <!-- old method
kept as deprecated alias -->
- [X] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases <!-- N/A — a
builder setter has no invalid-input branch to assert; both tests are
positive -->
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green <!--
langchain4j-mcp-docker unit tests: 5 green (DockerMcpTransportTest 4,
DockerResultCallbackTest 1); DockerMcpTransportIT requires Docker, not
run -->
- [ ] I have manually run all the unit and integration tests in the core
and main modules, and they are all green <!-- N/A — change is isolated
to langchain4j-mcp-docker -->
- [ ] I have added/updated the documentation <!-- wait until approved
-->
- [ ] I have added an example in the examples repo <!-- N/A — not a big
feature -->
- [ ] I have added/updated Spring Boot starter(s) <!-- N/A -->

<!-- Checklist for new maven module — N/A, omitted. -->
<!-- Checklist for new/changed embedding store — N/A, omitted. -->
2026-06-25 08:57:55 +02:00
Malay Dewangan 61e4d391a4
fix(mcp-docker): apply SSLConfig to ApacheDockerHttpClient (#5127)
- closes #5126
2026-05-07 10:39:29 +02:00
DragonFSKY 8387089a31
MCP: label stderr logs as STDERR (#5031)
## Issue
Closes #4873

## Change
- Label MCP stdio and Docker stderr output as `[STDERR]` instead of
`[ERROR]`.
- Preserve the existing DEBUG log level and stdout/stderr transport
behavior.
- Add regression tests for the stdio stderr handler and Docker STDERR
frames.

This follows the maintainer discussion in
https://github.com/langchain4j/langchain4j/issues/4873#issuecomment-4212291920.

Verification:
- `./mvnw -pl langchain4j-mcp,langchain4j-mcp-docker -am test`
- `git diff --check origin/main..HEAD`

## General checklist
- [X] There are no breaking changes (API, behaviour)
- [X] I have added unit and/or integration tests for my change
- [X] The tests cover both positive and negative cases
- [ ] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)

## Checklist for adding new maven module
- [ ] I have added my new module in the root `pom.xml` and
`langchain4j-bom/pom.xml`

## Checklist for adding new embedding store integration
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends
from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreRemovalIT` that
extends from `EmbeddingStoreWithRemovalIT`

## Checklist for changing existing embedding store integration
- [ ] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j
2026-04-29 14:25:35 +02:00
Jan Martiska a530dcd07d
Injecting context into header providers & support for MCP listeners (#4467)
This introduces a concept of `McpCallContext` that contains information
about the context around an invocation to an MCP server. This context is
injected into the newly added MCP header providers.

Building on top of that, I added support for MCP listeners that can be
invoked before and after calls to MCP servers. They also inject a
`McpCallContext`.

Further building on top of that, I've been working on Micrometer metrics
support for MCP clients, this will live in the Quarkus extension and
will be based on top of MCP listeners. I am drafting that, I'd like to
get feedback on this part first before continuing the metrics thing
because it builds on top of it.

Closes #4241
2026-01-29 16:12:36 +01:00
Qice Sun 42d8e636f6
refactor(mcp): extract protocol types and shared stdio JSON-RPC IO handler (#4371)
## Issue
Related to #4330

## Change
This PR extracts MCP protocol DTOs and a small shared stdio JSON-RPC IO
helper to enable moving the stdio MCP server implementation into
`langchain4j-community` without duplicating protocol/transport code.

Key changes:
- Extract MCP protocol DTOs into `dev.langchain4j.mcp.protocol`
- Rename the base JSON-RPC message type from `McpClientMessage` to
`McpJsonRpcMessage`
- Extract a reusable line-based stdio JSON-RPC reader/writer:
`dev.langchain4j.mcp.transport.stdio.JsonRpcIoHandler`
- Add server-facing response DTOs used by MCP (`McpInitializeResult`,
`McpListToolsResult`, `McpCallToolResult`, `McpErrorResponse`, etc.)
- Add unit tests for protocol serialization and IO handler robustness
(positive + negative cases)

Potential impact:
- Protocol DTOs are annotated with `@Internal`. However, downstream code
that directly imports these DTOs or implements a custom `McpTransport`
may need to update imports due to the package refactor and the
`McpClientMessage` -> `McpJsonRpcMessage` rename.

Follow-ups (draft):
- langchain4j/langchain4j-community#527
- langchain4j/langchain4j-examples#181

## How to test
1. Checkout this PR.
2. Run: `mvn -pl langchain4j-mcp -am -Pspotless test`
3. (Optional) Run: `mvn -pl langchain4j-core,langchain4j -am -Pspotless
test`

## General checklist
- [ ] There are no breaking changes (API, behaviour)
- [X] I have added unit and/or integration tests for my change
- [X] The tests cover both positive and negative cases
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the core
and main modules, and they are all green
- [ ] I have added/updated the documentation
- [ ] I have added an example in the examples repo (only for "big"
features)
- [ ] I have added/updated Spring Boot starter(s) (if applicable)

## Checklist for adding new maven module
- [ ] N/A

## Checklist for adding/changing embedding store integration
- [ ] N/A
2026-01-07 17:41:19 +01:00
Jan Martiska 450ffb6be7
MCP WebSocket transport (#4032) 2025-11-17 15:25:35 +01:00
Loïc Mathieu c26d196545
Allow configuring the logger for logging MCP events (#3803)
## Issue
No issue.

## Change
Like what was done for language model provides, allow configuring the
logger used to log MCP server events.


## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes (API, behaviour)
- [ ] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [ ] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)


## Checklist for adding new maven module
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added my new module in the root `pom.xml` and
`langchain4j-bom/pom.xml`


## Checklist for adding new embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends
from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreRemovalIT` that
extends from `EmbeddingStoreWithRemovalIT`

## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j
2025-10-07 17:02:58 +02:00
Dmytro Liubarskyi cce0b3f4de fixed flaky ITs 2025-10-07 13:14:57 +02:00
Loïc Mathieu 24f71d16d9
Docker MCP transport (#3513)
PR raised to open discussion for the implementation, it's only a
prototype for now.

## Issue
<!-- Please specify the ID of the issue this PR is addressing. For
example: "Closes #1234" or "Fixes #1234" -->
Closes #3493

## Change
<!-- Please describe the changes you made. -->


## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [x] I have added unit and/or integration tests for my change
- [ ] The tests cover both positive and negative cases
- [ ] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [x] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)


## Checklist for adding new maven module
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] I have added my new module in the root `pom.xml` and
`langchain4j-bom/pom.xml`


## Checklist for adding new embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends
from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreRemovalIT` that
extends from `EmbeddingStoreWithRemovalIT`

## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j

---------

Co-authored-by: Dmytro Liubarskyi <ljubarskij@gmail.com>
2025-09-30 14:44:07 +02:00