Skip to content
Back to search

JavaFX-Calculator

A calculator developed in Java and JavaFX. This simple application was created using the AI agent Opencode that uses a MCP server.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/joaomarcosg--javafx-calculator/badge.svg)](/listings/joaomarcosg--javafx-calculator)

HTML

<a href="/listings/joaomarcosg--javafx-calculator"><img src="/api/listings/joaomarcosg--javafx-calculator/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 85 lines
  1. # JavaFX Calculator (built with Context7 MCP)
  2. This project is a small desktop calculator written in Java and JavaFX. It was
  3. created as a lab exercise to show how an AI coding agent can use the
  4. **Context7 MCP server** to look up up-to-date library documentation while
  5. building an application.
  6. The calculator itself is intentionally simple: it supports the four basic
  7. operations, decimals, percentages, sign changes, keyboard input, and a dark
  8. theme. The interesting part of the project is the workflow — every JavaFX API
  9. detail used here was checked against the official JavaFX documentation through
  10. Context7 instead of relying on memory.
  11. ## Technologies
  12. | Technology | Role |
  13. | --- | --- |
  14. | Java 21 (built and tested with JDK 25) | Language and runtime |
  15. | JavaFX 21.0.6 (LTS) | Desktop UI: `Application`, `Stage`, `Scene`, controls, layout |
  16. | Maven | Dependency management and build |
  17. | `javafx-maven-plugin` 0.0.8 | Runs the JavaFX application (`mvn javafx:run`) |
  18. | JavaFX CSS | Styling of the calculator buttons and display |
  19. | Context7 MCP server | Documentation source used by the agent |
  20. | OpenCode | Agent harness that connects to the MCP server |
  21. ## How the MCP server was used
  22. The Context7 server is configured in `opencode.json` as a remote MCP server
  23. named `context`:
  24. ```json
  25. {
  26. "mcp": {
  27. "servers": {
  28. "context": {
  29. "type": "remote",
  30. "url": "https://mcp.context7.com/mcp"
  31. }
  32. }
  33. }
  34. }
  35. ```
  36. During development the agent used two Context7 tools:
  37. 1. **`resolve-library-id`** — to find the right documentation source for
  38. JavaFX. It resolved to `/websites/openjfx_io_javadoc` (version 21).
  39. 2. **`query-docs`** — to ask focused questions about specific APIs, for
  40. example:
  41. - the structure of a JavaFX application (`Application`, `start(Stage)`,
  42. `Scene`, `Stage.show()`);
  43. - `GridPane` layout and `ColumnConstraints` for the keypad;
  44. - `Scene.setOnKeyPressed` and `KeyEvent` for keyboard support;
  45. - `Node.setStyle` and CSS styling;
  46. - Maven and `module-info.java` setup for JavaFX projects.
  47. The answers were then applied directly to the code in
  48. `calculator/src/main/java/com/example/calculator/CalculatorApp.java` and
  49. `calculator/src/main/resources/styles.css`. The MCP server is only used at
  50. development time; it is not a dependency of the calculator and is not needed
  51. to run it.
  52. ## Project layout
  53. ```
  54. context7-mcp-server/
  55. ├── opencode.json # Context7 MCP server configuration
  56. ├── README.md # This file
  57. └── calculator/
  58. ├── pom.xml # Maven build
  59. ├── README.md # Build/run details
  60. └── src/main/
  61. ├── java/com/example/calculator/CalculatorApp.java
  62. └── resources/styles.css
  63. ```
  64. ## Running the calculator
  65. ```bash
  66. cd calculator
  67. mvn javafx:run
  68. ```
  69. See [`calculator/README.md`](calculator/README.md) for build details, keyboard
  70. shortcuts, and the feature list.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.