Skip to content

Commit fe9b88b

Browse files
authored
refactor: move MCP implementation from ls (#2)
1 parent 903491e commit fe9b88b

File tree

118 files changed

+12719
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+12719
-2
lines changed

.github/workflows/build.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
6+
jobs:
7+
lint:
8+
name: lint
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Prepare git
12+
run: |
13+
git config --global core.autocrlf false
14+
git config --global core.longpaths true
15+
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version-file: 'go.mod'
22+
23+
- name: Setup tools
24+
run: make tools
25+
26+
- name: Run go generate commands
27+
run: make generate
28+
29+
- name: Verify generated files match committed versions
30+
run: |
31+
if ! git status --porcelain=v1 | wc -l | grep -qE '^ *0 *$'; then
32+
echo "❌ Generated files have changed. Please run 'make generate' locally and commit the changes."
33+
git status --porcelain=v1
34+
exit 1
35+
fi
36+
37+
- name: Lint source code
38+
run: make lint
39+
40+
unit-tests:
41+
name: unit tests
42+
needs: [lint]
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Prepare git
46+
run: |
47+
git config --global core.autocrlf false
48+
git config --global core.longpaths true
49+
50+
- uses: actions/checkout@v4
51+
52+
- name: Set up Go
53+
uses: actions/setup-go@v5
54+
with:
55+
go-version-file: 'go.mod'
56+
57+
- name: Setup tools
58+
run: make tools
59+
60+
- name: Run tests
61+
run: make clean test
62+
63+
check-licenses:
64+
name: check licenses
65+
needs: [unit-tests]
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Prepare git
69+
run: |
70+
git config --global core.autocrlf false
71+
git config --global core.longpaths true
72+
73+
- uses: actions/checkout@v4
74+
75+
- name: Set up Go
76+
uses: actions/setup-go@v5
77+
with:
78+
go-version-file: 'go.mod'
79+
80+
- name: Setup tools (`make tools`)
81+
run: make tools
82+
83+
- name: update licenses
84+
run: make license-update
85+
86+
- name: Verify license files match committed versions
87+
run: |
88+
if ! git status --porcelain=v1 | wc -l | grep -qE '^ *0 *$'; then
89+
echo "❌ License files have changed. Please run 'make license-update' locally and commit the changes."
90+
git status --porcelain=v1
91+
exit 1
92+
fi

.gitignore

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,48 @@
1-
.idea
1+
#################################
2+
# Compiled source #
3+
#################################
4+
build/
5+
out/
6+
output/
7+
8+
#################################
9+
# Golang files (with tooling) #
10+
#################################
11+
.bin
12+
.dccache
13+
*.exe
14+
*.exe~
15+
*.dll
16+
*.so
17+
*.dylib
18+
*.test
19+
*.out
20+
21+
#################################
22+
# IDE generated files #
23+
#################################
24+
.settings/
25+
.classpath
26+
.project
27+
.idea/
28+
*.iml
29+
*.ipr
30+
*.iws
31+
32+
#################################
33+
# Logs and temp files #
34+
#################################
35+
*.log
36+
*.tmp
37+
*~
38+
39+
#################################
40+
# OS generated files #
41+
#################################
42+
Thumbs.db
43+
.directory
44+
.DS_Store
45+
._*
46+
webidentity.json
47+
48+
.qodo

Makefile

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Copyright 2022 Snyk Ltd.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# project variables
16+
PROJECT_NAME := studio-mcp
17+
18+
# build variables
19+
.DEFAULT_GOAL = test
20+
BUILD_DIR := build
21+
DEV_GOARCH := $(shell go env GOARCH)
22+
DEV_GOOS := $(shell go env GOOS)
23+
GOPATH := $(shell go env GOPATH)
24+
GOROOT := $(shell go env GOROOT)
25+
VERSION := $(shell git show -s --format=%cd --date=format:%Y%m%d.%H%M%S)
26+
COMMIT := $(shell git show -s --format=%h)
27+
LDFLAGS_DEV := "-X 'github.com/snyk/studio-mcp/application/config.Development=true' -X 'github.com/snyk/studio-mcp/application/config.Version=v$(VERSION)-SNAPSHOT-$(COMMIT)'"
28+
29+
TOOLS_BIN := $(shell pwd)/.bin
30+
31+
OVERRIDE_GOCI_LINT_V := v2.6.1
32+
GOLICENSES_V := v1.6.0
33+
PACT_V := 2.4.2
34+
35+
TIMEOUT := "-timeout=45m"
36+
37+
38+
## tools: Install required tooling.
39+
.PHONY: tools
40+
tools: $(TOOLS_BIN)/go-licenses $(TOOLS_BIN)/golangci-lint
41+
42+
$(TOOLS_BIN)/go-licenses:
43+
@echo "==> Installing go-licenses"
44+
@GOBIN=$(TOOLS_BIN) go install github.com/google/go-licenses@$(GOLICENSES_V)
45+
46+
$(TOOLS_BIN)/golangci-lint:
47+
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(OVERRIDE_GOCI_LINT_V)/install.sh | sh -s -- -b $(TOOLS_BIN)/ $(OVERRIDE_GOCI_LINT_V)
48+
49+
## clean: Delete the build directory
50+
.PHONY: clean
51+
clean:
52+
@echo "==> Removing '$(BUILD_DIR)' directory..."
53+
@rm -rf $(BUILD_DIR)
54+
55+
## lint: Lint code with golangci-lint.
56+
.PHONY: lint
57+
lint: $(TOOLS_BIN)/golangci-lint
58+
@echo "==> Linting code with 'golangci-lint'..."
59+
@$(TOOLS_BIN)/golangci-lint run ./...
60+
61+
## lint: Lint code with golangci-lint.
62+
.PHONY: lint-fix
63+
lint-fix: $(TOOLS_BIN)/golangci-lint
64+
@echo "==> Linting and fixing code with 'golangci-lint'..."
65+
@$(TOOLS_BIN)/golangci-lint run --fix ./...
66+
67+
68+
69+
## test: Run all tests.
70+
.PHONY: test
71+
test:
72+
@echo "==> Running unit tests..."
73+
@mkdir -p $(BUILD_DIR)
74+
go test $(TIMEOUT) -failfast -cover -coverprofile=$(BUILD_DIR)/coverage.out ./...
75+
76+
## generate: Regenerate generated files (e.g. mocks).
77+
.PHONY: generate
78+
generate:
79+
@echo "==> Generating generated files..."
80+
@go generate ./...
81+
82+
## build: Build binary for default local system's OS and architecture.
83+
.PHONY: build
84+
build:
85+
@echo "==> Building binary..."
86+
@echo " running go build for GOOS=$(DEV_GOOS) GOARCH=$(DEV_GOARCH)"
87+
# workaround for missing .exe extension on Windows
88+
ifeq ($(OS),Windows_NT)
89+
@go build -o $(BUILD_DIR)/$(PROJECT_NAME).$(DEV_GOOS).$(DEV_GOARCH).exe \
90+
-ldflags=$(LDFLAGS_DEV)
91+
else
92+
@go build -o $(BUILD_DIR)/$(PROJECT_NAME).$(DEV_GOOS).$(DEV_GOARCH) \
93+
-ldflags=$(LDFLAGS_DEV)
94+
endif
95+
96+
## build-debug: Build binary for debugging
97+
.PHONY: build-debug
98+
build-debug:
99+
@make clean
100+
@echo "==> Building binary..."
101+
@echo " running go build with debug flags"
102+
103+
ifeq ($(OS),Windows_NT)
104+
@go build -o $(BUILD_DIR)/$(PROJECT_NAME).exe \
105+
-ldflags=$(LDFLAGS_DEV) \
106+
-gcflags="all=-N -l"
107+
else
108+
@go build -o $(BUILD_DIR)/$(PROJECT_NAME) \
109+
-ldflags=$(LDFLAGS_DEV)
110+
-gcflags="all=-N -l"
111+
endif
112+
113+
.PHONY: license-update
114+
license-update: $(TOOLS_BIN)/go-licenses
115+
@echo "==> Updating license information..."
116+
@rm -rf 'licenses'
117+
@GOROOT=$(GOROOT) $(TOOLS_BIN)/go-licenses save ./pkg/mcp --save_path="licenses" --ignore "github.com/snyk/studio-mcp"
118+
119+
.PHONY: licenses
120+
licenses: $(TOOLS_BIN)/go-licenses
121+
@GOROOT=$(GOROOT) $(TOOLS_BIN)/go-licenses report ./pkg/mcp --ignore github.com/snyk/studio-mcp
122+
123+
help: Makefile
124+
@echo "Usage: make <command>"
125+
@echo ""
126+
@echo "Commands:"
127+
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,38 @@
1-
# TBD
1+
# Snyk Studio MCP
2+
3+
MCP (Model Context Protocol) is an open protocol that standardizes how applications share context with large language models.
4+
5+
MCP can provide AI systems with additional information needed to generate accurate and relevant responses for use cases where the AI systems do not have the context, by integrating the AI systems with tools and platforms that have specific capabilities.&#x20;
6+
7+
You can integrate Snyk MCP into MCP-supporting tools to provide Snyk security context.
8+
9+
Snyk is introducing an MCP server as part of the Snyk CLI. This allows MCP-enabled agentic tools to integrate Snyk security scanning capabilities directly, thus bridging the gap between security scanning and AI-assisted workflows.
10+
11+
In environments or applications that use MCP, you can use the `snyk mcp` CLI command to:
12+
13+
* Invoke Snyk scans:\
14+
Trigger CLI security scans for code, dependencies, or configurations in your codebase in your current MCP context.
15+
* Retrieve results:\
16+
Obtain Snyk security findings directly in your MCP-enabled tool or environment.
17+
18+
&#x20;The Snyk MCP server supports integrating the following Snyk security tools into an AI system:
19+
20+
* `snyk_sca_scan` (Open Source scan)
21+
* `snyk_code_scan` (Code scan)
22+
* `snyk_iac_scan` (IaC scan)
23+
* `snyk_container_scan` (IaC scan)
24+
* `snyk_sbom_scan` (SBOM file scan)
25+
* `snyk_aibom` (Create AIBOM)
26+
* `snyk_trust` (Trust a given folder before running a scan)
27+
* `snyk_auth` (authentication)
28+
* `snyk_logout` (logout)
29+
* `snyk_auth_status` (authentication status check)
30+
* `snyk_version` (version information)
31+
32+
33+
Running `snyk_sca_scan` may execute third-party ecosystem tools (for example, Gradle or Maven) on your machine to fetch the project's dependency tree.
34+
35+
36+
For more details, see the [Snyk MCP installation, configuration and startup](https://docs.snyk.io/integrations/snyk-studio-agentic-integrations/quickstart-guides-for-snyk-studio) and [Troubleshooting for the Snyk MCP server](https://docs.snyk.io/integrations/snyk-studio-agentic-integrations/troubleshooting) pages.
37+
38+
**This repository is closed to public contributions.**

0 commit comments

Comments
 (0)