SDKs
Java Integration
Use Hive from JVM services with Java HttpClient.
Requirements: Java 11+
Dependencies
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.0</version>
</dependency>
Quick Start
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Map;
public class HiveExample {
private static final String BASE_URL = "https://mcp.hiveintelligence.xyz";
public static void main(String[] args) throws Exception {
String apiKey = System.getenv("HIVE_API_KEY");
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> payload = Map.of(
"tool", "get_price",
"args", Map.of("ids", "bitcoin", "vs_currencies", "usd")
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(BASE_URL + "/api/v1/execute"))
.header("Content-Type", "application/json")
.header("x-api-key", apiKey)
.POST(HttpRequest.BodyPublishers.ofString(mapper.writeValueAsString(payload)))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
Reusable Client
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.Map;
public class HiveClient {
private final String baseUrl;
private final String apiKey;
private final HttpClient httpClient;
private final ObjectMapper objectMapper;
public HiveClient(String apiKey) {
this.baseUrl = "https://mcp.hiveintelligence.xyz";
this.apiKey = apiKey;
this.httpClient = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(30))
.build();
this.objectMapper = new ObjectMapper();
}
public Map<String, Object> execute(String tool, Map<String, Object> args) throws Exception {
Map<String, Object> payload = Map.of(
"tool", tool,
"args", args
);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(baseUrl + "/api/v1/execute"))
.header("Content-Type", "application/json")
.header("x-api-key", apiKey)
.POST(HttpRequest.BodyPublishers.ofString(objectMapper.writeValueAsString(payload)))
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) {
throw new RuntimeException("Hive request failed: " + response.body());
}
return objectMapper.readValue(response.body(), Map.class);
}
}
Discovery
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://mcp.hiveintelligence.xyz/api/v1/tools?limit=50"))
.header("x-api-key", System.getenv("HIVE_API_KEY"))
.GET()
.build();
Example Calls
HiveClient client = new HiveClient(System.getenv("HIVE_API_KEY"));
Map<String, Object> market = client.execute("get_coins_market_data", Map.of(
"vs_currency", "usd",
"order", "market_cap_desc",
"per_page", 5
));
Map<String, Object> wallet = client.execute("moralis_get_wallet_net_worth", Map.of(
"address", "0x1234...",
"chain", "eth"
));
Map<String, Object> prediction = client.execute("codex_prediction_markets", Map.of(
"networkId", 1
));
Notes
- The current REST payload keys are
toolandargs. - Use
GET /api/v1/toolsfor live schemas and tool discovery. - Older
toolName/argumentsexamples are legacy.