Skip to content

feature: Add ACP support to connect NetBeans to an agent and expose some netbeans features as MCP tools to be used by that agent - #9712

Open
ehsavoie wants to merge 9 commits into
apache:masterfrom
ehsavoie:acp
Open

ehsavoie wants to merge 9 commits into
apache:masterfrom
ehsavoie:acp

Conversation

@ehsavoie

@ehsavoie ehsavoie commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

This enables integration with coding agent using the ACP protocol.
It also provides a way to expose MCP tools through HTTP, either directly or via the ACP protocol itself.
I tested it with IBM Bob, Github Copilot, Antigravity and a friend ACP agent he wrote
This is a new feature that creates a new ACP Chat Window, it is in extra as I consider it experimental.
Assisted-by: Codex (GPT-6.1 Terra)


^Add meaningful description above

Click to collapse/expand PR instructions

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

LLMs, Commit messages and PR description:

  • Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.
  • LLM assisted commits should be attributed with an Assisted-by: MODEL_NAME MODEL_VERSION line appended to the commit message.
    • Please mention coding assistance in the PR description too (eg. by adding the same Assisted-by line from above)
    • Please describe the changes in your own words - we'd like to know you understand the changes being made!

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

PR approval and merge checklist:

  1. Was this PR correctly labeled, did the right tests run? When did they run?
  2. Is this PR squashed?
  3. Are author name / email address correct? Are co-authors correctly listed? Do the commit messages need updates?
  4. Does the PR title and description still fit after the Nth iteration? Is the description sufficient to appear in the release notes?

If this PR targets the delivery branch: don't merge. (full wiki article)

@ehsavoie ehsavoie self-assigned this Oct 13, 2026
@ehsavoie ehsavoie added kind:feature A feature request ci:all-tests [ci] enable all tests labels Oct 13, 2026
@mbien mbien added ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) and removed ci:all-tests [ci] enable all tests labels Oct 13, 2026
@mbien

mbien commented Oct 13, 2026

Copy link
Copy Markdown
Member

(cancelled CI here since we have a ~7h queue atm and freeze is this week)

@ehsavoie

Copy link
Copy Markdown
Contributor Author

@neilcsmith-net I've added a SPI which enables tools via plugins to be provided to the harness. This should makes this extension some entry point for NetBeans developers to expand from.

@jtulach
jtulach requested a review from eppleton November 22, 2026 06:21

@jtulach jtulach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just few notes after reading first twenty or so files.

Comment thread agentic/acp.api/nbproject/project.xml Resolved

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, ACP support is an interesting addition. A first, structural pass (I haven't reviewed the UI/API/tool code in detail yet; jtulach already left API-level notes):

  1. Cluster placement: the description says the feature lives in extra because it's experimental, but nbbuild/cluster.properties adds acp.api, acp.mcp, acp.mcp.spi, acp.mcp.tools, acp.ui and libs.acp to nb.cluster.ide, and acp.mcp.java to nb.cluster.java. That way they would be part of every NetBeans distribution. If experimental is the intent, extra (or a separate cluster) seems a better fit.

  2. Jackson move and upgrade: libs.jackson is moved from the enterprise cluster to ide and upgraded from 2.17.2 to 2.22.3 in the same PR. That affects the existing users of the library in enterprise and is easier to review and revert on its own, so I'd suggest a separate PR for it. In this diff, git also pairs some files as renames across modules (e.g. enterprise/libs.jackson/build.xml → ide/acp.api/build.xml, enterprise/libs.jackson/external/binaries-list → ide/libs.acp/external/binaries-list), which makes the move hard to follow.

  3. Eclipse metadata: nbbuild/misc/prepare-bundles/.classpath, .project and .settings/* are added; that looks accidental.

  4. LLM attribution: one of the 27 commits carries an Assisted-by: line, and the PR description doesn't mention coding assistance. The PR template asks for Assisted-by on assisted commits and a note in the description; could you check whether the other commits need it too?

On the positive side, the MCP HTTP server looks carefully done: it binds to 127.0.0.1 on a random port, uses a random per-session bearer token, and validates the Host and Origin headers.

Given the size (111 files, ~13k lines), splitting it (e.g. libraries first, then API/SPI, then UI and tools) would also make review much more manageable.

@ehsavoie
ehsavoie force-pushed the acp branch 2 times, most recently from 7bff0d4 to b8cfdd2 Compare November 23, 2026 09:23
@ehsavoie

Copy link
Copy Markdown
Contributor Author

@eppleton @jtulach thanks. I think I've addressed your comments and rewrote the git history to make it easier to follow.

@jtulach

jtulach commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Shouldn't we start a new cluster? The amount of AI support modules is likely to grow... it may warrant its own agentic cluster!

@neilcsmith-net

Copy link
Copy Markdown
Member

As I've been pinged above. There is already a discussion at https://lists.apache.org/thread.html/tofgwlkghf1qfz2s8cbhhyn0xt49110f about this and where it ends up. Resolution should happen there.

If this, or any other AI support, is likely to require a faster release schedule, and releases more than once per quarter, then it doesn't belong in this repo at all. I still believe that ASF-released plugins developed in one or more separate repos is the way forward. Again, a choice for the mailing list.

-1 to landing this in extra (not that it does). That's the worst of all worlds.

+1 to handling the Jackson move separately. And possibly rationalising what JSON support we actually need.

On the assisted contributions, there is also evolving guidance at https://www.apache.org/legal/generative-tooling.html and elsewhere that is behind and steering what we ask for.

@neilcsmith-net neilcsmith-net added the do not merge Don't merge this PR, it is not ready or just demonstration purposes. label Nov 23, 2026

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rework. The structural points from my first pass are addressed (own nb.cluster.acp in extra, Eclipse files gone, Jackson in separate commits, Assisted-by everywhere). The cluster question itself belongs to the dev@ thread Neil linked.

This is a second pass focused on the MCP part (acp.mcp, acp.mcp.spi, acp.mcp.tools, acp.mcp.java). All of it is from reading the code; I have not built or run it. The security basics look good: localhost bind, a random per-session token that is revoked when the connection closes, Host/Origin checks, the project path guard using canonical paths, and git run as an argument list rather than through a shell. Details inline:

  • spec conformance of notification handling in the HTTP transport
  • get_current_file_context reads the activated TopComponent, which is the chat window while the user types in it
  • git_diff accepts a target starting with -
  • refactorings run without showing the user the non-fatal problems or a preview, and they are enabled by default
  • offset-based Java tools vs. line/column
  • acp.mcp exports its implementation package

Comment thread ide/acp.mcp/nbproject/project.xml Resolved

@neilcsmith-net neilcsmith-net left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have concerns about the cluster change as currently done. The important thing is that if we decide to merge this here, it must be part of the release cluster config. I don't want to see us repeat the issues with the Rust cluster with this too.

Comment thread nbbuild/cluster.properties Resolved
Comment thread nbbuild/cluster.properties Resolved

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, quick turnaround. I checked the fix commits against my previous comments: notifications now get 202 and batches are handled, get_current_file_context uses EditorRegistry.lastFocusedComponent() and applies the project guard, git_diff rejects a leading -, both refactoring providers are opt-in, the Java tools accept line/column, and acp.mcp no longer exports its implementation package. All resolved from my side. One new issue with the line/column change, inline.

@ehsavoie

Copy link
Copy Markdown
Contributor Author

I've rewritten the history to a few commits, leaving only the commits that didn't get reviewed

@NicolaIsotta
NicolaIsotta removed their request for review November 26, 2026 11:24
@eppleton

Copy link
Copy Markdown
Contributor

Thanks, ffb547c resolves my last point. The Java tool schemas are plain objects again and the either/or check is done at runtime. get_current_file_context now also returns line and column. Nothing further from me on the MCP part.

One small thing: ffb547c is the only commit without the Assisted-by: Codex (GPT-6.1 Terra) line that the other commits carry.

@eppleton eppleton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at 7208425. Moving the refactoring code into the shared RefactoringExecution and returning git failures as tool errors with exit code and output both look good. Three points, two on the new file access in acp.api and one on the Jackson signature baseline; details inline. These are from reading the code, except the SecureDirectoryStream check, which I ran on macOS.

Move the Jackson module from the enterprise cluster to the IDE cluster so IDE modules can depend on it.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Update the bundled Jackson libraries and their module metadata. Jackson annotations uses version 2.22.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Add the ACP SDK and its supporting libraries to the IDE cluster.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Add ACP agent configuration, authentication, session management, and file
and terminal operations. Register the modules in the agentic cluster.

Expose IDE and Java tools through an MCP server and provider SPI. Support
JSON-RPC batches and notification responses, use the last focused editor
for project-scoped context, and validate Git diff revisions.

Make refactoring tools opt-in and allow Java refactorings to locate symbols
by line and column or character offset. Add tests for transport behavior,
editor context, project boundaries, revision validation and positions.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Anton Epple <toni.epple@eppleton.de>
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Add agent configuration and chat with editor context, session management,
permissions, terminal support and change previews.

Keep the MCP server implementation private and activate its provider
through a runtime dependency.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Anton Epple <toni.epple@eppleton.de>
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Add the agentic cluster to the release configuration. The full configuration continues to include it through the release cluster list.
Use the module identifier from the agentic cluster so Javadoc configuration validation and module resolution can find it.
Treat agentic modules as part of the base IDE so they are not listed as user-installed features or expected to have feature-on-demand metadata. Enable them in the ergonomics test configurations.
The module data initialization log is emitted before the cache lookup, so it can appear even when data is restored from cache. Check for actual agentic manifest-load events instead and verify that the test detects them. Keep the existing initialization check for other clusters.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Remove top-level schema alternatives that some agent clients reject while retaining runtime validation of offset and line/column inputs. Return the caret line and column in editor context and accept positions at line and file ends.

Add coverage for the tool schemas and caret positions.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Constrain ACP file operations to session directories and validate session
working directories. Share refactoring execution and report Git command
failures through MCP. Update the Jackson module version and baseline.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Separate session handling, rendering and dialogs, and make editor
actions lazy. Update streaming messages incrementally and bound retained
history, images and diffs. Add focused UI tests.

Assisted-by: Codex (GPT-6.1 Terra)
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
@eppleton

Copy link
Copy Markdown
Contributor

Thanks, 5e08ce7 addresses both file-access points. When SecureDirectoryStream isn't available, the handlers now use the checked portable path instead of dropping the fs capability, and missing parent directories are created inside the session roots. The comments in the code state honestly what the fallback can't guarantee.

On the Jackson baseline: moving the regenerated .sig into the upgrade commit is cleaner, but the regeneration itself still hides the classes and methods that 2.22.3 removed compared with the NetBeans 32 baseline. libs.jackson already sets sigtest.gen.fail.on.error=false, so with the old baseline sigtest should only report those incompatibilities, not fail the build. Do you remember which CI check failed? If it was something else, regenerating the baseline might not have been the right fix for it. Otherwise I'd keep the NB 32 baseline, so that whoever merges the upgrade can see the list of removed API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) do not merge Don't merge this PR, it is not ready or just demonstration purposes. kind:feature A feature request needs:discussion Requires discussion on the NetBeans dev mailing list

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants