{"type":"mcp_client","name":"mcpx4j","description":"MCPX4J is a Java client library for MCP.RUN, enabling developers to easily integrate and invoke installed tools using a simple API with features like installation caching and customizable JSON decoding.","category":"Developer Tools","language":"Java","stars":28,"forks":1,"owner":"dylibso","github_url":"https://github.com/dylibso/mcpx4j","homepage":"https://docs.mcp.run/","setup":"## Setup\n\n1.  Add the following dependency to your `pom.xml`:\n\n```xml\n<dependencies>\n    <dependency>\n       <groupId>com.dylibso.mcpx4j</groupId>\n        <artifactId>mcpx4j</artifactId>\n        <version>${mcpx4j.version}</version>\n    </dependency>\n</dependencies>\n```\n\n2.  Create a new `Mcpx` instance with your API key using `Mcpx.forApiKey(apiKey).build()`. \n\n3.  Optionally, provide an alternative base URL for the mcp.run service using `.withBaseUrl(jsonDecoder)`. \n\n4.  Optionally, customize the JSON decoder using `.withBaseUrl(\"https://localhost:8080\")`. Add Jackson Databind or Jakarta JSON-P dependencies if you want to use them.\n\n```xml\n    <dependency>\n        <groupId>com.fasterxml.jackson.core</groupId>\n        <artifactId>jackson-databind</artifactId>\n        <version>${jackson-databind.version}</version>\n    </dependency>\n\n    <!-- Eclipse Parsson is an implementation of the Jakarta JSON-P API  -->\n    <dependency>\n        <groupId>org.eclipse.parsson</groupId>\n        <artifactId>parsson</artifactId>\n        <version>${parsson.version}</version>\n    </dependency>\n```\n\n5.  Optionally, customize the HTTP client using `.withHttpClientAdapter(httpClientAdapter)`. You can use `JdkHttpClientAdapter` or `HttpUrlConnectionClientAdapter`.\n\n```java\nvar mcpx = Mcpx.forApiKey(apiKey)\n    .withHttpClientAdapter(new JdkHttpClientAdapter())\n    .withHttpClientAdapter(new HttpUrlConnectionClientAdapter()) // alternatively\n    ...\n    .build();\n```\n\n6.  Optionally, provide predefined options for the Servlet implementation using `.withServletOptions(McpxServletOptions.builder()...build())`.","tools":"## Available Tools\n\n1.  **Mcpx Instance Creation** (Create a new Mcpx instance with your API key.)\n2.  **Refresh Installations** (Keeps a cache of installations and can be refreshed.)\n3.  **Base URL Configuration** (Provide an alternative base URL for the mcp.run service.)\n4.  **JSON Decoder Customization** (Customize the JSON decoder, supporting Jackson and Jakarta JSON-P.)\n5.  **HTTP Client Customization** (Customize the HTTP client, supporting JdkHttpClientAdapter and HttpUrlConnectionClientAdapter.)\n6.  **Servlet Options** (Provide predefined options for the Servlet implementation, including ChicoryHttpConfig, ChicoryLogger, and AoT compilation.)\n","faq":null,"created_at":"2025-01-07T15:33:03+00:00","updated_at":"2025-03-27T15:10:17+00:00","source_url":"https://model-context-protocol.com/clients/java-client-library-ai-tools-integration","related_articles":[]}