Skip to content
Back to search

32_MCP

Model Context Protocol MCP server

Safety scan

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

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/diaskevin--32-mcp/badge.svg)](/listings/diaskevin--32-mcp)

HTML

<a href="/listings/diaskevin--32-mcp"><img src="/api/listings/diaskevin--32-mcp/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 · 303 lines
  1. # 31_MCP
  2. Model Context Protocol MCP server
  3. Testing a Model Context Protocol (MCP) server or client requires validating both low-level protocol mechanics and end-to-end LLM behavior.
  4. Unlike traditional APIs, MCP testing covers:
  5. transport handshakes
  6. capability discovery
  7. tool schemas
  8. argument accuracy
  9. model tool-selection quality
  10. There is a consensus on Reddit's r/mcp that combining visual inspectors for manual debugging with automated unit tests, LLM evals, and ongoing regression fixtures gives the most reliable coverage as servers and models evolve.
  11. Core Testing Layers
  12. • Protocol & Transport Checks: Verify handshake behavior, stdio or HTTP/SSE transport connections, capability discovery, and OAuth/auth boundaries.
  13. • Tool & Handler Unit Tests: Test individual tool execution logic, input validation, edge cases, and error responses directly.
  14. • LLM & Multi-Turn Evals: Test whether models pick the right tool, pass valid arguments, handle multi-step flows, and avoid context overload when multiple servers are attached.
  15. • Security & Regression Audits: Check for unauthenticated manifest access, over-broad permissions, prompt injection risks, and schema or response drift after updates.
  16. Popular Tools & Workflows
  17. • MCP Inspector (@modelcontextprotocol/inspector): Run npx @modelcontextprotocol/inspector locally to inspect capabilities, test tool calls interactively, and debug auth flows.
  18. • Browser & Client Playgrounds: Use MCP Playground Online to test URL-reachable servers, mock servers, and client configs in the browser, or MCPJam for local testing, debugging, and evaluations across multiple AI clients.
  19. • Automated Eval & CI Suites: Use frameworks like mcp-evals, DeepEval, or CLI runners in CI/CD to score tool selection, argument accuracy, and regression fixtures automatically.
  20. MCP (SELENIUM / JAVA)
  21. Using MCP with Java and Selenium typically means connecting an AI coding agent (such as Claude Desktop, Cursor, or VS Code Copilot) to a Selenium MCP server so the agent can drive a live browser, inspect the DOM, and generate or self-heal Java test suites (JUnit 5 or TestNG).
  22. 1. Core Setup
  23. • Install Prerequisites: Ensure you have Java JDK 17+, Maven or Gradle, Node.js 18+ (to run the MCP server via npx), and a local browser (Chrome/Firefox).
  24. • Configure the Selenium MCP Server: Add the community @angiejones/mcp-selenium server to your AI client's MCP configuration file (claude_desktop_config.json or .vscode/mcp.json):json
  25. {
  26. "mcpServers": {
  27. "selenium": {
  28. "command": "npx",
  29. "args": ["-y", "@angiejones/mcp-selenium@latest"]
  30. }
  31. }
  32. }
  33. Use code with caution.
  34. • Add Java Dependencies (pom.xml): Ensure your Java project includes selenium-java (4.x) and your preferred runner (junit-jupiter or testng). Selenium Manager automatically resolves browser drivers at runtime.
  35. 2. Key Workflows for Java QA
  36. • Live DOM Discovery & POM Generation: Prompt your AI agent to open a URL via MCP, inspect the live accessibility tree or DOM elements, and generate a Java Page Object Model (@FindBy classes) paired with JUnit 5 or TestNG assertions.
  37. • Self-Healing Broken Locators: When a Java test fails due to a UI change, have the agent launch the page via the MCP server, locate the updated CSS/XPath selector on the live page, and refactor your .java source file.
  38. • Interactive Exploratory Testing: Give plain-English instructions (e.g., "Open Chrome, log in as a test user, complete checkout, and verify the confirmation message") to validate flows before writing permanent Java regression code.
  39. 3. Best Practices & Caveats
  40. • Review Explicit Waits: AI-generated Selenium code often relies on basic locators; verify that WebDriverWait and ExpectedConditions are properly added to prevent flaky runs.
  41. • Testing a Custom Java MCP Server: If you are instead building your own MCP server in Java (using the official MCP Java SDK or Spring AI) that wraps Selenium tools, test it with @modelcontextprotocol/inspector over stdio or HTTP/SSE alongside standard JUnit 5 integration tests.
  42. Are you looking to:
  43. • Use an existing Selenium MCP server to generate/maintain Java tests (with JUnit 5 or TestNG)?
  44. • Build and test your own custom MCP server in Java that exposes Selenium WebDriver tools?
  45. Let me know which path you're taking and I can share a complete starter template.
  46. GitHub Copilot in IntelliJ IDEA functions as a full coding agent with:
  47. local multi-file editing
  48. terminal execution
  49. cloud delegation
  50. MCP support. Get started here:
  51. ⁠JetBrains Copilot Agent Documentation: Configure GitHub Copilot agent modes, permissions, and custom MCP servers in IntelliJ.
  52. How It Works in IntelliJ
  53. You can access Copilot's agentic features either through the GitHub Copilot JetBrains plugin or natively inside JetBrains AI Assistant / Air.
  54. • Local Agent & Autopilot Modes: Unlike simple autocomplete or Q&A ("Ask" mode), Agent and Autopilot modes can autonomously plan tasks, edit multiple Java files, run Maven/Gradle terminal commands, read compiler or test errors, and iterate until fixes pass.
  55. • MCP Server Support: Copilot in IntelliJ natively supports the Model Context Protocol (mcp.json or via Settings → Tools → AI Assistant → Model Context Protocol). This lets you attach a Selenium MCP server directly inside IntelliJ so Copilot can drive a browser and write or fix your Java tests.
  56. • Cloud Coding Agent Delegation: From IntelliJ, you can also delegate asynchronous background tasks to GitHub's cloud coding agent (e.g., via @GitHub Copilot coding agent), which works independently in a cloud environment and opens a draft Pull Request on GitHub.
  57. Quick Setup for MCP in IntelliJ
  58. 1. Install/Update: Ensure you have the latest GitHub Copilot plugin or an updated IntelliJ IDEA (2026.2+) with AI Assistant enabled.
  59. 2. Add Your MCP Server: Open the GitHub Copilot icon in the status bar → Edit Settings → Model Context Protocol → Configure (or configure under Settings → Tools → AI Assistant → Model Context Protocol) and add your mcp.json server entry.
  60. 3. Switch to Agent Mode: In the Copilot Chat panel, switch the dropdown from Ask to Agent (or Autopilot) and enable your MCP server tools in the tool picker.
  61. Would you like the exact mcp.json configuration to connect a Selenium MCP server inside IntelliJ, or tips on configuring permissions so Copilot can run Maven/Gradle test commands automatically?
  62. What does this do: Node.js 18+
  63. Node.js 18+ provides the JavaScript runtime environment and npx command needed to download and run the Selenium MCP server locally on your machine. Even though your test code is in Java, most community MCP servers (including @angiejones/mcp-selenium) are built with TypeScript/JavaScript and require Node.js to execute.
  64. Why You Need It
  65. • Runs the MCP Server (npx): When IntelliJ starts the Selenium MCP server, it runs npx -y @angiejones/mcp-selenium@latest in the background. npx (bundled with Node.js) automatically downloads and runs the server without manual installation.
  66. • Bridges IntelliJ and the Browser: The Node.js process acts as the translator—it receives tool calls from GitHub Copilot (like "click login button") and executes the actual browser commands via WebDriver.
  67. • Modern Compatibility (18+): Version 18 or higher is required because modern MCP packages rely on built-in Node features (like native fetch and updated ES modules) introduced in Node 18+.
  68. How to Check or Install
  69. • Check if you already have it: Open IntelliJ's terminal and run node -v. If it outputs v18.x.x or higher (such as Node 20 or 22 LTS), you are ready to go.
  70. • Install if missing: Download the LTS (Long Term Support) installer from nodejs.org or install via your package manager (brew install node on macOS, winget install OpenJS.NodeJS.LTS on Windows).
  71. You can build a pure-Java Selenium MCP server using the official MCP Java SDK (io.modelcontextprotocol.sdk:mcp) and test it directly with JUnit 5—no Node.js required.
  72. 1. Maven Dependencies (pom.xml)
  73. Add the official MCP Java SDK, Selenium Java, and JUnit 5 to your Maven project:
  74. xml
  75. <dependencies>
  76. <!-- Official MCP Java SDK (includes STDIO transport & Jackson) -->
  77. <dependency>
  78. <groupId>io.modelcontextprotocol.sdk</groupId>
  79. <artifactId>mcp</artifactId>
  80. <version>2.2.0</version>
  81. </dependency>
  82. <!-- Selenium WebDriver -->
  83. <dependency>
  84. <groupId>org.seleniumhq.selenium</groupId>
  85. <artifactId>selenium-java</artifactId>
  86. <version>4.27.0</version>
  87. </dependency>
  88. <!-- JUnit 5 -->
  89. <dependency>
  90. <groupId>org.junit.jupiter</groupId>
  91. <artifactId>junit-jupiter</artifactId>
  92. <version>5.11.4</version>
  93. <scope>test</scope>
  94. </dependency>
  95. </dependencies>
  96. 2. Build the Java Selenium MCP Server (SeleniumMcpServer.java)
  97. This server exposes Selenium browser actions (like open_url and get_title) over STDIO so GitHub Copilot in IntelliJ can launch and talk to it directly:
  98. java
  99. package com.example.mcp;
  100. import io.modelcontextprotocol.server.McpServer;
  101. import io.modelcontextprotocol.server.McpServerFeatures;
  102. import io.modelcontextprotocol.server.McpSyncServer;
  103. import io.modelcontextprotocol.server.transport.StdioServerTransportProvider;
  104. import io.modelcontextprotocol.spec.McpSchema.*;
  105. import org.openqa.selenium.WebDriver;
  106. import org.openqa.selenium.chrome.ChromeDriver;
  107. import org.openqa.selenium.chrome.ChromeOptions;
  108. import java.util.List;
  109. import java.util.Map;
  110. public class SeleniumMcpServer {
  111. private static WebDriver driver;
  112. public static WebDriver getDriver() {
  113. if (driver == null) {
  114. ChromeOptions options = new ChromeOptions();
  115. options.addArguments("--headless=new"); // Remove if you want to watch the browser
  116. driver = new ChromeDriver(options);
  117. }
  118. return driver;
  119. }
  120. public static McpSyncServer createServer(StdioServerTransportProvider transport) {
  121. McpSyncServer server = McpServer.sync(transport)
  122. .serverInfo("java-selenium-mcp", "1.0.0")
  123. .capabilities(ServerCapabilities.builder().tools(true).build())
  124. .build();
  125. // Tool 1: Navigate to URL
  126. String openUrlSchema = """
  127. {
  128. "type": "object",
  129. "properties": {
  130. "url": { "type": "string", "description": "Full URL to open" }
  131. },
  132. "required": ["url"]
  133. }
  134. """;
  135. server.addTool(new McpServerFeatures.SyncToolSpecification(
  136. new Tool("open_url", "Open a URL in Chrome via Selenium", openUrlSchema),
  137. (exchange, args) -> {
  138. String url = (String) args.get("url");
  139. getDriver().get(url);
  140. return new CallToolResult(
  141. List.of(new TextContent("Navigated to: " + getDriver().getCurrentUrl())),
  142. false
  143. );
  144. }
  145. ));
  146. // Tool 2: Get Page Title
  147. String emptySchema = """
  148. { "type": "object", "properties": {} }
  149. """;
  150. server.addTool(new McpServerFeatures.SyncToolSpecification(
  151. new Tool("get_title", "Get the current page title", emptySchema),
  152. (exchange, args) -> new CallToolResult(
  153. List.of(new TextContent(getDriver().getTitle())),
  154. false
  155. )
  156. ));
  157. return server;
  158. }
  159. public static void main(String[] args) {
  160. StdioServerTransportProvider transport = new StdioServerTransportProvider();
  161. createServer(transport);
  162. Runtime.getRuntime().addShutdownHook(new Thread(() -> {
  163. if (driver != null) driver.quit();
  164. }));
  165. }
  166. }
  167. Use code with caution.
  168. 3. Test Your MCP Server with JUnit 5 (SeleniumMcpServerTest.java)
  169. You can test your MCP server end-to-end in JUnit 5 by wiring an McpSyncClient to your server process over STDIO, listing the registered tools, and calling them just like an AI agent would:
  170. java
  171. package com.example.mcp;
  172. import io.modelcontextprotocol.client.McpClient;
  173. import io.modelcontextprotocol.client.McpSyncClient;
  174. import io.modelcontextprotocol.client.transport.ServerParameters;
  175. import io.modelcontextprotocol.client.transport.StdioClientTransport;
  176. import io.modelcontextprotocol.spec.McpSchema.*;
  177. import org.junit.jupiter.api.*;
  178. import java.time.Duration;
  179. import java.util.Map;
  180. import static org.junit.jupiter.api.Assertions.*;
  181. class SeleniumMcpServerTest {
  182. private static McpSyncClient client;
  183. @BeforeAll
  184. static void startMcpServer() {
  185. String javaBin = System.getProperty("java.home") + "/bin/java";
  186. String classpath = System.getProperty("java.class.path");
  187. ServerParameters params = ServerParameters.builder(javaBin)
  188. .args("-cp", classpath, "com.example.mcp.SeleniumMcpServer")
  189. .build();
  190. client = McpClient.sync(new StdioClientTransport(params))
  191. .requestTimeout(Duration.ofSeconds(30))
  192. .build();
  193. client.initialize();
  194. }
  195. @AfterAll
  196. static void stopMcpServer() {
  197. if (client != null) {
  198. client.closeGracefully();
  199. }
  200. }
  201. @Test
  202. void shouldListSeleniumTools() {
  203. ListToolsResult toolsResult = client.listTools();
  204. assertTrue(toolsResult.tools().stream().anyMatch(t -> t.name().equals("open_url")));
  205. assertTrue(toolsResult.tools().stream().anyMatch(t -> t.name().equals("get_title")));
  206. }
  207. @Test
  208. void shouldNavigateAndReadPageTitle() {
  209. CallToolResult navResult = client.callTool(
  210. new CallToolRequest("open_url", Map.of("url", "https://example.com"))
  211. );
  212. assertFalse(navResult.isError());
  213. CallToolResult titleResult = client.callTool(
  214. new CallToolRequest("get_title", Map.of())
  215. );
  216. TextContent content = (TextContent) titleResult.content().get(0);
  217. assertEquals("Example Domain", content.text());
  218. }
  219. }
  220. Use code with caution.
  221. 4. Connect Your Java MCP Server to GitHub Copilot in IntelliJ
  222. 1. Package your project into a runnable JAR (e.g., mvn clean package using maven-shade-plugin so all dependencies are bundled).
  223. 2. In IntelliJ, open Settings → Tools → AI Assistant → Model Context Protocol (or your Copilot mcp.json) and register your JAR:json
  224. {
  225. "mcpServers": {
  226. "java-selenium": {
  227. "command": "java",
  228. "args": ["-jar", "/absolute/path/to/your-selenium-mcp-server.jar"]
  229. }
  230. }
  231. }
  232. Use code with caution.
  233. 3. Important Caveat: Never write debug System.out.println(...) statements in your MCP server code—STDIO transport uses standard output exclusively for JSON-RPC messages, so stray console prints will break the connection. Always log to System.err or an SLF4J file appender.
  234. Would you like me to share:
  235. • Additional Selenium tool handlers (such as click_element, type_text, and get_dom_snapshot)?
  236. • The maven-shade-plugin snippet for pom.xml so you can build the runnable JAR for IntelliJ?
  237. • Would you like to check which OS you're using so I can give you the exact command to install Node.js and verify npx works with IntelliJ?

Ratings and comments

Sign in to rate this skill.

Sign in

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