{"id":26127735,"url":"https://github.com/dylibso/mcpx4j","last_synced_at":"2025-10-17T01:07:18.462Z","repository":{"id":271859026,"uuid":"913387163","full_name":"dylibso/mcpx4j","owner":"dylibso","description":"Java client library for https://mcp.run - call portable and secure tools for your AI Agents and Apps","archived":false,"fork":false,"pushed_at":"2025-03-19T16:22:45.000Z","size":40958,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-27T08:11:38.007Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.mcp.run/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dylibso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-07T15:33:03.000Z","updated_at":"2025-03-27T02:52:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e5ba6fb-6e5f-4a42-b5d2-e0a25c5c7284","html_url":"https://github.com/dylibso/mcpx4j","commit_stats":null,"previous_names":["dylibso/mcpx4j"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fmcpx4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fmcpx4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fmcpx4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fmcpx4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylibso","download_url":"https://codeload.github.com/dylibso/mcpx4j/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750872,"owners_count":21155797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-10T18:36:18.836Z","updated_at":"2025-10-17T01:07:13.444Z","avatar_url":"https://github.com/dylibso.png","language":"Java","funding_links":[],"categories":["📚 Projects (2474 total)"],"sub_categories":["MCP Clients"],"readme":"# MCPX4J\n\nThe MCP.RUN client library for Java!\n\n\n## Installation\n\n```xml\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n       \u003cgroupId\u003ecom.dylibso.mcpx4j\u003c/groupId\u003e\n        \u003cartifactId\u003emcpx4j\u003c/artifactId\u003e\n        \u003cversion\u003e${mcpx4j.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## Quick Start\n\nCreate a new `Mcpx` instance with your API key and start invoking your installed tools.\n\n```java\nimport com.github.dylibso.mcpx4j.Mcpx;\n\nMcpx mcpx = Mcpx.forApiKey(apiKey).build();\nmcpx.refreshInstallations();\nvar servlet = mcpx.get(\"my-servlet-id\");\nvar tool = servlet.get(\"my-tool-id\");\nvar bytes = servlet.call(\"\"\"\n{\n    \"method\": \"tools/call\",\n    \"params\": {\n        \"name\": \"my-tool-id\",\n        \"arguments\": {\n            ...\n        }  \n    }\n}\n\"\"\");\n```\n\nDetailed examples are available in the [examples](examples) directory.\n\n\n## Plugin Updates\n\n`Mcpx` keeps a cache of installations. You can refresh the cache by calling `refreshInstallations()`.\nThe internal store is thread-safe, so you can schedule a refresh in a separate thread.\n\n```java\nvar scheduler = Executors.newSingleThreadScheduledExecutor();\nscheduler.scheduleAtFixedRate(mcpx::refreshInstallations, 0, 5, TimeUnit.MINUTES);\n```\n\n## Configuration\n\nIt is possible to provide an alternative base URL for the mcp.run service\n(defaults to `https://www.mcp.run`).\n\n```java\nvar mcpx = Mcpx.forApiKey(apiKey)\n    .withBaseUrl(jsonDecoder)\n    ...\n    .build();\n\n```\n\nThe `Mcpx` builder allows to customize the JSON decoder and the HTTP client.\n\n### JSON Decoder\n\n```java\nvar mcpx = Mcpx.forApiKey(apiKey)\n    .withBaseUrl(\"https://localhost:8080\")\n    ...\n    .build();\n```\n\nThe default JSON decoder is `JacksonDecoder`, using [Jackson Databind][jackson]. We also provide an alternative\nimplementation based on [Jakarta JSON-P][jakarta-jsonp].\n\nBoth dependencies are optional, so you should make sure to include them in your project if you want to use them.\n\n```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.fasterxml.jackson.core\u003c/groupId\u003e\n        \u003cartifactId\u003ejackson-databind\u003c/artifactId\u003e\n        \u003cversion\u003e${jackson-databind.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n\n    \u003c!-- Eclipse Parsson is an implementation of the Jakarta JSON-P API  --\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.eclipse.parsson\u003c/groupId\u003e\n        \u003cartifactId\u003eparsson\u003c/artifactId\u003e\n        \u003cversion\u003e${parsson.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\n[jackson]: https://github.com/FasterXML/jackson\n[jdk-http]: https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html\n[jakarta-jsonp]: https://github.com/jakartaee/jsonp-api\n\n### HTTP Client\n\n```java\nvar mcpx = Mcpx.forApiKey(apiKey)\n    .withHttpClientAdapter(httpClientAdapter)\n    ...\n    .build();\n```\n\n\nThe default HTTP client is `JdkHttpClientAdapter`, using the [JDK HTTP client][jdk-http],\nthere is also a lighter-weight implementation using an `HttpURLConnection`, called `HttpUrlConnectionClientAdapter`.\n\n```java\nvar mcpx = Mcpx.forApiKey(apiKey)\n    .withHttpClientAdapter(new JdkHttpClientAdapter())\n    .withHttpClientAdapter(new HttpUrlConnectionClientAdapter()) // alternatively\n    ...\n    .build();\n```\n\nThe `HttpClientAdapter` interface is currently borrowed from the [Chicory Extism SDK][chicory-sdk].\nThis might change in the future.\n\n\n### Servlet Options\n\nIt is also possible to provide predefined options for the Servlet implementation: these\nconfig options are propagated to the [Chicory Extism SDK][chicory-sdk] upon creation of\neach Servlet.\n\n```java\nvar mcpx = Mcpx.forApiKey(apiKey)\n    .withServletOptions(McpxServletOptions.builder()\n        .withChicoryHttpConfig(...)\n        .withChicoryLogger(...)\n        .withAoT() \n        .build())\n    .build();\n```\n\n- `ChicoryHttpConfig` controls the HTTP client and Json decoder used by the Chicory SDK:\n  usually these should match the ones used by the MCPX4J client.\n- `ChicoryLogger` is a logger implementation for the Chicory SDK.\n- `AoT` enables the Ahead-of-Time compilation for the Chicory SDK.\n\n\n[chicory-sdk]: https://github.com/extism/chicory-sdk\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylibso%2Fmcpx4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylibso%2Fmcpx4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylibso%2Fmcpx4j/lists"}