-
Notifications
You must be signed in to change notification settings - Fork 213
hawkBit MCP server #2871
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
denislavprinov
wants to merge
2
commits into
eclipse-hawkbit:master
Choose a base branch
from
boschglobal:feature/hawkbit-mcp-server
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,700
−0
Open
hawkBit MCP server #2871
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # hawkBit MCP Server | ||
|
|
||
| A standalone [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that provides AI assistants with tools to interact with [Eclipse hawkBit](https://www.eclipse.org/hawkbit/) for IoT device software update management. | ||
|
|
||
| ## Building | ||
|
|
||
| From the project root directory: | ||
|
|
||
| ```bash | ||
| mvn clean package -pl hawkbit-mcp -am -DskipTests | ||
| ``` | ||
|
|
||
| The JAR will be created at: `hawkbit-mcp/target/hawkbit-mcp-server-0-SNAPSHOT.jar` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The MCP server supports two transport modes: | ||
|
|
||
| | Mode | Use Case | Authentication | | ||
| |------|----------|----------------| | ||
| | **HTTP/SSE** | Remote access, multi-user | Per-request via `Authorization` header | | ||
| | **STDIO** | Local CLI tools (e.g., Claude Code) | Environment variables | | ||
|
|
||
|
|
||
| ### HTTP Transport | ||
|
|
||
| Use HTTP transport when running the server as a standalone service: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "hawkbit-mcp": { | ||
| "type": "http", | ||
| "url": "http://localhost:8081/mcp", | ||
| "headers": { | ||
| "Authorization": "Basic <BASE64_ENCODED_CREDENTIALS>" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Start the server separately: | ||
|
|
||
| ```bash | ||
| java -jar hawkbit-mcp-server-0-SNAPSHOT.jar \ | ||
| --hawkbit.mcp.mgmt-url=<HAWKBIT_URL> | ||
| ``` | ||
|
|
||
| **Generating Base64 credentials:** | ||
|
|
||
| ```bash | ||
| # Linux/Mac | ||
| echo -n "<TENANT>\\<USERNAME>:<PASSWORD>" | base64 | ||
|
|
||
| # PowerShell | ||
| [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("<TENANT>\<USERNAME>:<PASSWORD>")) | ||
| ``` | ||
|
|
||
| ### STDIO Transport | ||
|
|
||
| Use STDIO transport for direct integration: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "hawkbit-mcp": { | ||
| "command": "java", | ||
| "args": [ | ||
| "-Dspring.ai.mcp.server.stdio=true", | ||
| "-Dspring.main.web-application-type=none", | ||
| "-jar", | ||
| "/path/to/hawkbit-mcp-server-0-SNAPSHOT.jar" | ||
| ], | ||
| "env": { | ||
| "HAWKBIT_URL": "<HAWKBIT_URL>", | ||
| "HAWKBIT_USERNAME": "<TENANT>\\<USERNAME>", | ||
| "HAWKBIT_PASSWORD": "<PASSWORD>" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Configuration Properties | ||
|
|
||
| | Property | Environment Variable | Description | Default | | ||
| |----------|---------------------|-------------|---------| | ||
| | `hawkbit.mcp.mgmt-url` | `HAWKBIT_URL` | hawkBit Management API URL | `http://localhost:8080` | | ||
| | `hawkbit.mcp.username` | `HAWKBIT_USERNAME` | Username for STDIO mode | - | | ||
| | `hawkbit.mcp.password` | `HAWKBIT_PASSWORD` | Password for STDIO mode | - | | ||
| | `hawkbit.mcp.validation.enabled` | - | Validate credentials against hawkBit | `true` | | ||
| | `hawkbit.mcp.validation.cache-ttl` | - | Cache TTL for auth validation | `600s` | | ||
|
|
||
| ### Operation Controls | ||
|
|
||
| You can enable/disable specific operations globally or per-entity: | ||
|
|
||
| ```properties | ||
| # Global: disable all deletes | ||
| hawkbit.mcp.operations.delete-enabled=false | ||
|
|
||
| # Per-entity: allow delete for targets only | ||
| hawkbit.mcp.operations.targets.delete-enabled=true | ||
|
|
||
| # Disable rollout lifecycle operations | ||
| hawkbit.mcp.operations.rollouts.start-enabled=false | ||
| hawkbit.mcp.operations.rollouts.approve-enabled=false | ||
| ``` | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| <!-- | ||
|
|
||
| Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
|
|
||
| This program and the accompanying materials are made | ||
| available under the terms of the Eclipse Public License 2.0 | ||
| which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
|
|
||
| SPDX-License-Identifier: EPL-2.0 | ||
|
|
||
| --> | ||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>org.eclipse.hawkbit</groupId> | ||
| <artifactId>hawkbit-parent</artifactId> | ||
| <version>${revision}</version> | ||
| </parent> | ||
|
|
||
| <artifactId>hawkbit-mcp-server</artifactId> | ||
| <name>hawkBit :: MCP Server (Standalone)</name> | ||
| <description>Standalone MCP server that connects to hawkBit via REST API</description> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.eclipse.hawkbit</groupId> | ||
| <artifactId>hawkbit-sdk-mgmt</artifactId> | ||
| <version>${project.version}</version> | ||
| <exclusions> | ||
| <exclusion> | ||
| <groupId>org.springdoc</groupId> | ||
| <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-hateoas</artifactId> | ||
| </exclusion> | ||
| </exclusions> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-validation</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-security</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.ai</groupId> | ||
| <artifactId>spring-ai-starter-mcp-server-webmvc</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.ai</groupId> | ||
| <artifactId>spring-ai-mcp-annotations</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-configuration-processor</artifactId> | ||
| <optional>true</optional> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.github.ben-manes.caffeine</groupId> | ||
| <artifactId>caffeine</artifactId> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-resources-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <id>copy-hawkbit-docs</id> | ||
| <phase>generate-resources</phase> | ||
| <goals> | ||
| <goal>copy-resources</goal> | ||
| </goals> | ||
| <configuration> | ||
| <outputDirectory>${project.build.outputDirectory}/hawkbit-docs</outputDirectory> | ||
| <resources> | ||
| <resource> | ||
| <directory>${project.basedir}/../docs</directory> | ||
| <includes> | ||
| <include>README.md</include> | ||
| <include>what-is-hawkbit.md</include> | ||
| <include>quick-start.md</include> | ||
| <include>features.md</include> | ||
| <include>architecture.md</include> | ||
| <include>base-setup.md</include> | ||
| <include>hawkbit-sdk.md</include> | ||
| <include>feign-client.md</include> | ||
| <include>clustering.md</include> | ||
| <include>authentication.md</include> | ||
| <include>authorization.md</include> | ||
| <include>datamodel.md</include> | ||
| <include>rollout-management.md</include> | ||
| <include>targetstate.md</include> | ||
| <include>management-api.md</include> | ||
| <include>direct-device-integration-api.md</include> | ||
| <include>device-management-federation-api.md</include> | ||
| </includes> | ||
| </resource> | ||
| </resources> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
| <configuration> | ||
| <mainClass>org.eclipse.hawkbit.mcp.server.HawkbitMcpServerApplication</mainClass> | ||
| </configuration> | ||
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>repackage</goal> | ||
| </goals> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
32 changes: 32 additions & 0 deletions
32
hawkbit-mcp/src/main/java/org/eclipse/hawkbit/mcp/server/HawkbitMcpServerApplication.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /** | ||
denislavprinov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| * | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| */ | ||
| package org.eclipse.hawkbit.mcp.server; | ||
|
|
||
| import org.eclipse.hawkbit.mcp.server.config.HawkbitMcpProperties; | ||
| import org.springframework.boot.SpringApplication; | ||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration; | ||
|
|
||
| /** | ||
| * Standalone MCP Server application that connects to hawkBit via REST API. | ||
| * <p> | ||
| * This server acts as a proxy between MCP clients and hawkBit, | ||
| * passing through authentication credentials to the hawkBit REST API. | ||
| * </p> | ||
| */ | ||
| @SpringBootApplication(exclude = UserDetailsServiceAutoConfiguration.class) | ||
| @EnableConfigurationProperties(HawkbitMcpProperties.class) | ||
| public class HawkbitMcpServerApplication { | ||
|
|
||
| public static void main(String[] args) { | ||
| SpringApplication.run(HawkbitMcpServerApplication.class, args); | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<TENANT>\\<USERNAME>does not work in hawkbit. Authentication should be only with<USERNAME>only.