Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Support running test cases in offline environments

Open
#636 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
docker, java

Research direction

Start with testToolCallSuccess in AbstractStatelessIntegrationTest.java and inspect the related tests under mcp-test and src/test for external HTTP endpoints. Run the Maven test lifecycle with -o after required Docker images are available. Done means the test suite passes in an offline environment without contacting external endpoints.

Written by the indexing model from the issue text.

Description

enhancement P3 tests

Description:

Several test cases in mcp-test and other src/test rely on external HTTP endpoints, which cause test failures in offline CI/CD environments.

For example, test case testToolCallSuccess of AbstractStatelessIntegrationTest.java throws an AssertionError if a GET request to raw.githubusercontent.com/modelcontextprotocol/java-sdk/refs/heads/main/README.md has null or empty response.

Goal:

  • Support running maven test lifecycle for offline environments.
  • Specifically, all test cases shall pass when -o option is appended to mvn test command, provided that all required docker images have already been imported (the default container pull policy will allow this to work offline).

Proposed changes:

Instead of sending GET request using an HTTP client, use a mock client that reads README.md from local file.

HttpClient mockClient = mock(HttpClient.class);
HttpResponse<String> mockResponse = mock(HttpResponse.class);

// Relative path of README.md depending on project directory
when(mockResponse.body()).thenReturn(Files.readString(Path.of("../README.md").toAbsolutePath()));
when(mockResponse.statusCode()).thenReturn(200);
when(mockClient.send(any(HttpRequest.class), any(HttpResponse.BodyHandler.class))).thenReturn(mockResponse);

Environment:

  • MCP Java SDK: current main branch
  • JDK: 21
  • OS: Linux
Dominant language
Java
Stars
3.7k
Forks
1.1k
Avg merge
1d 15h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/java-sdk

All issues in modelcontextprotocol/java-sdk

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.