Skip to main content
Glama
README.md2.49 kB
# Lunar Example Consumer App (Java) This application is designed to demonstrate the use of Lunar Interceptor within a Java environment. Ensure you have Lunar Proxy running and properly configured to intercept and analyze the HTTP traffic generated by this app. The Cat Fact API is provided by https://catfact.ninja/fact and is subject to its availability and rate limiting. ## Prerequisites Before running the app, ensure you have Java installed on your computer. This app is designed to be compatible with Java 8 and newer versions. ## Installation ### Download Required JAR Files To run this application, you will need the OkHttp, Okio, and Kotlin Standard Library JARs. Use the following commands to download them: ```bash curl -L -o okhttp-3.14.9.jar https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp/3.14.9/okhttp-3.14.9.jar curl -L -o okio-2.8.0.jar https://repo1.maven.org/maven2/com/squareup/okio/okio/2.8.0/okio-2.8.0.jar curl -L -o kotlin-stdlib-1.9.23.jar https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.23/kotlin-stdlib-1.9.23.jar ``` ### Lunar Java Interceptor Installation To install the Lunar Interceptor, download lunarInterceptor.jar using: ```bash wget -O lunarInterceptor.jar https://s01.oss.sonatype.org/content/repositories/releases/dev/lunar/interceptor/lunar-interceptor/0.1.1/lunar-interceptor-0.1.1.jar ``` ## Configuration Configure the Lunar Proxy by setting the LUNAR_PROXY_HOST environment variable to the host or IP and the port it is listening on: ```bash export LUNAR_PROXY_HOST="localhost:8000" ``` Note: Adjust localhost:8000 as necessary to match your Lunar Proxy setup. The value assigned to `LUNAR_PROXY_HOST` should only include the hostname and port, without the `HTTP` prefix. For example, use `localhost:8000` and not `http://localhost:8000`. ## Compilation Compile the Java application with the following command, replacing <path-to-jar-files> with the directory where you downloaded the JAR files: ```bash javac -cp ".:<path-to-jar-files>/okhttp-3.14.9.jar:<path-to-jar-files>/okio-2.8.0.jar:<path-to-jar-files>/kotlin-stdlib-1.9.23.jar" Main.java ``` ## Run Your App Run the compiled application using the -javaagent flag for the Lunar Interceptor and including all necessary JARs in the classpath: ```bash java -javaagent:<path-to-jar-files>/lunarInterceptor.jar -cp ".:<path-to-jar-files>/okhttp-3.14.9.jar:<path-to-jar-files>/okio-2.8.0.jar:<path-to-jar-files>/kotlin-stdlib-1.9.23.jar" Main ```

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheLunarCompany/lunar'

If you have feedback or need assistance with the MCP directory API, please join our Discord server