sigrok-mcp-server
CLAUDE.md12 starsChanged 9 months agoMITView on GitHub
All documentation, code comments, commit messages, and PR descriptions in this repository must be written in English. sigrok-mcp-server is an MCP (Model Context Protocol) server that wraps sigrok-cli, exposing sigrok's signal analysis capabilities to LLMs. It translates MCP tool calls into sigrok-cli invocations and returns structured results, enabling LLMs to control logic analyzers, decode protocols, and analyze signals. Written in Go. Licensed under MIT (Kenos, Inc.).
In this repositoryOne other file it gives its agents.
- issue-managerSkill
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
All documentation, code comments, commit messages, and PR descriptions in this repository must be written in English.
- Very specific: line 27
Follow standard Go conventions (gofmt, go vet)
- Very specific: line 28
Use table-driven tests with t.Run() subtests
- Distinctive: line 31
Keep packages small and focused.
- Very specific: line 68
All user inputs are validated with regexes before passing to sigrok-cli (command injection prevention)
- Very specific: line 80
Dev container: Use the devcontainer configuration for local development (devcontainer.json in .devcontainer/).
≈ “Common” is an estimate: at least 1 in 5 of the 27,641 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Documentation Language
All documentation, code comments, commit messages, and PR descriptions in this repository must be written in English.
Project Overview
sigrok-mcp-server is an MCP (Model Context Protocol) server that wraps sigrok-cli, exposing sigrok's signal analysis capabilities to LLMs. It translates MCP tool calls into sigrok-cli invocations and returns structured results, enabling LLMs to control logic analyzers, decode protocols, and analyze signals.
Written in Go. Licensed under MIT (Kenos, Inc.).
Language & Build
- Language: Go
- Module:
github.com/KenosInc/sigrok-mcp-server - Build:
go build ./... - Run tests:
go test ./... - Run single test:
go test ./... -run TestName - Lint:
go vet ./... - Tidy dependencies:
go mod tidy
Code Style
- Follow standard Go conventions (
gofmt,go vet) - Use table-driven tests with
t.Run()subtests - Error handling: return errors, don't panic; wrap with
fmt.Errorf("context: %w", err) - Naming: follow Go conventions — exported names in PascalCase, unexported in camelCase
- Keep packages small and focused; avoid circular dependencies
Architecture
- MCP Server (Go): Implements the MCP protocol, receives tool calls from LLMs, and delegates to
sigrok-cli. - sigrok-cli wrapper: Constructs and executes
sigrok-clicommands, parses output, and returns structured responses.sigrok-cliis the sole interface to sigrok — no C bindings or libsigrok dependency. - Docker container: The MCP server runs inside a Docker container with
sigrok-clipre-installed. - Transport: MCP communication uses stdio (stdin/stdout JSON-RPC).
Package Structure
cmd/sigrok-mcp-server/— Entrypoint (main.go): wires config, executor, handlers, starts stdio serverinternal/config/— Env-based configuration (SIGROK_CLI_PATH,SIGROK_TIMEOUT_SECONDS,SIGROK_WORKING_DIR)internal/sigrok/— CLI executor (Executor) and output parsers; testdata/ contains golden output filesinternal/serial/— Serial port querier for direct instrument communication (independent of sigrok-cli)internal/devices/— Device profile registry with embedded JSON profiles; supports lookup by name, model, or*IDN?responseinternal/tools/— MCP tool definitions (tools.go) and handler implementations (handlers.go)
Key Dependencies
github.com/mark3labs/mcp-go— MCP protocol framework (tool registration, JSON-RPC stdio transport)go.bug.st/serial— Cross-platform serial port library (pure Go on Linux)
Environment Variables
SIGROK_CLI_PATH— Path to sigrok-cli binary (default:sigrok-cli)SIGROK_TIMEOUT_SECONDS— Command timeout in seconds (default:30)SIGROK_WORKING_DIR— Working directory for sigrok-cli (default: current dir)
Testing Patterns
Runnerinterface ininternal/tools/enables mock-based handler testsCommandFactoryininternal/sigrok/executor.gois a test seam for injecting fake commandsinternal/sigrok/testdata/contains goldensigrok-clioutput files for parser tests
Security
- All user inputs are validated with regexes before passing to
sigrok-cli(command injection prevention) - Key regexes:
validIDRe,validOptionRe,validFilenameReininternal/tools/handlers.go - Filenames are restricted to flat names (no path separators) to prevent path traversal
Project Metadata
- GitHub:
github.com/KenosInc/sigrok-mcp-server - License: MIT (Kenos, Inc.)
- Main branch:
main
Development Environment
- Dev container: Use the devcontainer configuration for local development (
devcontainer.jsonin.devcontainer/). - CI/CD: GitHub Actions. Workflows live in
.github/workflows/.
Running
- Local (devcontainer): Open in VS Code / IDE with devcontainer support, or use
devcontainer up. - Docker:
docker build -t sigrok-mcp-server .thendocker run sigrok-mcp-server
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

