GSoC2026/Borgy: MCP App tools experiment#1700
Open
AbdelrahmanELBORGY wants to merge 1 commit into
Open
Conversation
a06b552 to
b5aef17
Compare
…bviews for API execution and history
b5aef17 to
bb969ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description - API Dash MCP App
This PR contains the MCP server and basic MCP app UI for API Dash.
It allows AI assistants inside editors like VS Code (e.g., Claude Code, Roo Code) to interact directly with the API Dash core engine, execute API requests, and view rich, interactive UIs directly within the editor.
Visual view
1. VS Code MCP Server Setup
flutter build windows --release(ormacos/linux) in the root directory to generate the required native build files before starting the server.To connect this engine to your VS Code AI assistant (like Roo Code or Cline), you must create a
.vscodefolder in the root of your workspace, and then create anmcp.jsonfile inside it to register the server.Add the following configuration to your new
.vscode/mcp.jsonfile, making sure to replace<PATH_TO_APIDASH_REPO>with the actual absolute path to where you cloned this repository on your machine:{ "servers": { "apidash-mcp": { "command": "node", "args": [ "<PATH_TO_APIDASH_REPO>/scripts/apidash-mcp.js" ] } } }Examples of valid paths:
"C:/Users/Username/Documents/apidash/scripts/apidash-mcp.js""/Users/Username/projects/apidash/scripts/apidash-mcp.js"(Note: Use standard forward slashes
/in the JSON path, even on Windows, as Node.js handles them perfectly and it prevents escaping errors).2. Architecture and File Overview
Added Files
mcp_engine.dart: Acts as the core JSON-RPC protocol router. It listens for incoming tool executions or resource requests, matches the requested method (e.g.,tools/call), and dispatches it to the appropriate handler while catching errors to prevent server hangs.mcp_service.dart: Manages the lifecycle of the headless Dart process. It bridges standard input/output (stdio) to the isolate ports, allowing the underlying Flutter/Dart engine to communicate with the Node.js wrapper.tool_handler.dart: The brain of the operations. It registers the schemas for the AI tools and executes the actual backend logic (like sending HTTP requests and saving to the database).resource_handler.dart: Responsible for providing the MCP client with the correct UI template based on the requestedui://URI scheme.html_templates.dart: Contains the raw HTML, CSS, and Javascript needed to render the API Dash dashboards inside VS Code's webview panels.The 4 Core Tools and How They Invoke Each Other
apidash_execute_request:_metaUI trigger. This forces VS Code to open the Results Dashboard.apidash_get_results:visibility: ["app"]modifier in its_metaschema.apidash_list_history:structuredContent(raw JSON) and sends a_metatrigger to open the History UI. The UI's Javascript automatically intercepts this raw JSON to render the interactive list.apidash_delete_request:visibility: ["app"]modifier.window.parent.postMessageto secretly ask the MCP client to call this tool on the backend, bypassing the AI entirely.Invoking visible to app only tools - not visible to the ai agent
apidash_get_resultsapidash_delete_request3. The Node.js Wrapper & Stdio Communication
You might wonder why a
.jsfile is used as the entry point when the entire application is built in Dart/Flutter.Why a
.jsscript?Most MCP clients running inside VS Code expect to spawn a server process via a highly standard environment (like Node.js or Python) and communicate over standard Input/Output (
stdio). The Node.js script acts as a lightweight, reliable proxy wrapper.Why this approach is necessary:
API Dash relies heavily on Flutter-specific packages (like
WidgetsFlutterBinding) and complex local databases. If you try to run a pure, raw Dart script from the command line without the proper Flutter context, these core packages will crash.By starting a Flutter-based headless app, we initialize all the necessary core packages securely. The Node.js script simply pipes standard JSON-RPC text strings via
stdininto the headless Dart environment, and the Dart environment pushes responses back out viastdout. TheMcpServiceclass actively listens to thisstdinstream, processes the JSON, and pipes it into the isolated MCP engine.4. Hive Boxes for Local Storage
The engine utilizes Hive CE (
hive_ce) as its local storage mechanism.What it does:
Initialize an isolated
agent_historybox specifically for the MCP server.Why it is important:
.flush()to guarantee it is written to the disk. Milliseconds later, the UI wakes up, queries Hive, and is guaranteed to find the data.execution_id) for every request, Hive allows us to build a comprehensive, permanent history log that the user can browse and manage.