A demonstration project showcasing Model Context Protocol (MCP) servers for local hardware control. This project provides cross-platform implementations in both Go and TypeScript that allow AI assistants to interact with system hardware through standardized MCP tools.
This MCP server exposes four hardware control tools:
- set_brightness: Adjust screen brightness (0-100%)
- get_brightness: Get current screen brightness level
- play_sound: Play system notification sounds (beep, alert, success, error, default)
- open_app: Launch applications by name
- Windows (including WSL)
- macOS
- Linux (with X11)
mcp-hardware-control-demo-main/
├── go/ # Go implementation
│ ├── main.go # Main server code
│ ├── go.mod # Go module dependencies
│ └── go.sum # Go module checksums
├── typescript/ # TypeScript implementation
│ ├── src/index.ts # Main server code
│ ├── package.json # Node.js dependencies
│ ├── tsconfig.json # TypeScript configuration
│ └── build/ # Compiled JavaScript output
└── README.md # This file
- Ensure you have Go 1.25+ installed
- Navigate to the go directory:
cd go
- Install dependencies:
go mod tidy
- Build the server:
go build -o mcp-hardware-control main.go
- Ensure you have Node.js 18+ installed
- Navigate to the typescript directory:
cd typescript
- Install dependencies:
npm install
- Build the project:
npm run build
cd go
./mcp-hardware-control
cd typescript
npm start
The server communicates via stdin/stdout using the MCP protocol and should be integrated with MCP-compatible clients.
Adjusts the screen brightness level.
Parameters:
level
(integer, 0-100): Brightness level (0 = minimum, 100 = maximum)
Example:
{
"level": 75
}
Retrieves the current screen brightness level.
Parameters: None
Returns: Current brightness percentage
Plays a system notification sound.
Parameters:
sound_type
(string, optional): Type of sound to play"beep"
: Standard beep"alert"
: Alert sound"success"
: Success notification"error"
: Error notification"default"
: Default system sound
Opens a specified application.
Parameters:
app_name
(string): Name of the application to open- Windows: Executable name (e.g., "notepad", "calc")
- macOS: Application name (e.g., "Calculator", "Safari")
- Linux: Command name
- Uses PowerShell for brightness control via WMI
- Uses
[console]::beep()
for sound playback - Uses
start
command for opening applications
- Uses
brightness
CLI tool (with AppleScript fallback) for brightness - Uses
afplay
for system sounds - Uses
open -a
for applications
- Uses
xrandr
for brightness control - Uses
paplay
for sound playback - Uses direct command execution for applications
github.com/modelcontextprotocol/go-sdk v1.0.0
@modelcontextprotocol/sdk ^1.0.4
zod ^3.23.8
cd go
go run main.go
cd typescript
npm run dev # Watch mode compilation
- Fork the repository
- Create a feature branch
- Make your changes
- Test on multiple platforms
- Submit a pull request
MIT License - see LICENSE file for details
Roberto Morais