Skip to content

MCP Server #2523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

MCP Server #2523

wants to merge 7 commits into from

Conversation

trieloff
Copy link
Contributor

@trieloff trieloff commented Apr 24, 2025

  • feat(mcp): add MCP command and logging tools
  • feat(mcp-logger): add resetLogs function and enhance logging tests
  • fix(stop-tool): handle string port values and improve error handling
  • test(mcp): bring test coverage up to 100%
  • docs(README): add section on using AEM as an MCP server

This PR adds a small MCP server that can be used to start, stop, and retrieve logs from a local
AEM development server. Check the readme for details on running it, although to run it from a this
branch, you'll need npx -y github:adobe/helix-cli#mcp mcp. Yep, that's mcp twice.

- Introduced a new MCP command with support for tools to manage AEM development servers.
- Added logging functionality with an in-memory logger to capture log entries.
- Implemented tools for starting (`up`), stopping (`stop`), and retrieving logs (`logs`) from the MCP server.
- Updated CLI to include the new `mcp` command alongside existing commands.
- Introduced a new `resetLogs` function to clear the log buffer, primarily for testing purposes.
- Added comprehensive unit tests for the MCP logger, covering various logging functionalities, including filtering and context handling.
- Created new test files for MCP command and tools, ensuring robust testing of command structure and execution.
- Enhanced existing tests to validate logging behavior and error handling in tools.
- Updated the stop tool to correctly handle string values for ports, ensuring compatibility with user input.
- Enhanced error handling in the stop tool, including cases where no servers are running or when specified servers are not found.
- Added comprehensive tests to cover various scenarios, including stopping multiple servers, handling errors during stop operations, and ensuring proper logging of errors.
- Updated copyright year in the test file to reflect the current year.
- Introduced a new section detailing how to use AEM as an MCP server with compatible tools.
- Provided command usage for integrating AEM with IDEs and interacting with AI assistants for server management.
@kptdobe
Copy link
Contributor

kptdobe commented Apr 25, 2025

Fun POC.
The fact that the PR is not a draft worries me a little bit.

- Added 'trace' as a new log level in the in-memory logger.
- Updated log level enumeration in the logs tool to include 'trace'.
- Enhanced unit tests to cover logging at the 'trace' level and added filtering tests for log levels, including 'trace'.
- Adjusted existing tests to account for the new log level and ensure accurate log message assertions.
- Added functionality to the MCPCommand to check for a valid git repository in specified workspace paths and the current directory.
- Implemented logic to change the working directory to the first valid git repository found, improving server initialization.
- Removed outdated test for readline initialization in the run method to streamline test coverage.
Copy link

This PR will trigger a minor release when merged.

@trieloff
Copy link
Contributor Author

Screenshot 2025-04-25 at 13 53 25 Screenshot 2025-04-25 at 13 53 43 Screenshot 2025-04-25 at 13 54 01 Screenshot 2025-04-25 at 13 55 15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants