Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
version: "2"
run:
issues-exit-code: 1
output:
formats:
text:
path: stdout
print-linter-name: true
print-issued-lines: true
linters:
default: none
enable:
- depguard
- exhaustive
- goconst
- gocyclo
- gosec
- govet
- ineffassign
- lll
- paralleltest
- promlinter
- revive
- staticcheck
- thelper
- tparallel
- unparam
- unused
settings:
depguard:
rules:
prevent_unmaintained_packages:
list-mode: lax
files:
- $all
- '!$test'
deny:
- pkg: io/ioutil
desc: this is deprecated
gocyclo:
min-complexity: 15
gosec:
excludes:
- G601
lll:
line-length: 130
revive:
severity: warning
rules:
- name: blank-imports
severity: warning
- name: context-as-argument
- name: context-keys-type
- name: duplicated-imports
- name: error-naming
- name: error-return
- name: exported
severity: error
- name: if-return
- name: identical-branches
- name: indent-error-flow
- name: import-shadowing
- name: package-comments
- name: redefines-builtin-id
- name: struct-tag
- name: unconditional-recursion
- name: unnecessary-stmt
- name: unreachable-code
- name: unused-parameter
- name: unused-receiver
- name: unhandled-error
disabled: true
exclusions:
generated: lax
rules:
- linters:
- lll
- gocyclo
- errcheck
- dupl
- gosec
- paralleltest
path: (.+)_test\.go
- linters:
- lll
path: .golangci.yml
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
settings:
gci:
sections:
- standard
- default
- prefix(github.com/StacklokLabs/osv-mcp)
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
3 changes: 2 additions & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package main provides the entry point for the OSV MCP Server.
package main

import (
Expand Down Expand Up @@ -45,4 +46,4 @@ func main() {
}

log.Println("Shutting down server")
}
}
2 changes: 1 addition & 1 deletion cmd/server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ func TestCreateServer(t *testing.T) {
// Verify server properties
assert.Equal(t, mcp.ServerName, "osv-mcp")
assert.Equal(t, mcp.ServerVersion, "0.1.0")
}
}
9 changes: 6 additions & 3 deletions pkg/mcp/server.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package mcp provides MCP server tools for OSV.
package mcp

import (
Expand All @@ -15,7 +16,7 @@ import (
const (
// ServerName is the name of the MCP server
ServerName = "osv-mcp"

// ServerVersion is the version of the MCP server
ServerVersion = "0.1.0"
)
Expand Down Expand Up @@ -235,7 +236,9 @@ func (s *Server) handleQueryVulnerabilitiesBatch(ctx context.Context, request mc
}

if purl != "" && (packageName != "" || ecosystem != "") {
return mcp.NewToolResultError(fmt.Sprintf("If purl is specified, package_name and ecosystem should not be specified in query %d", i)), nil
return mcp.NewToolResultError(
fmt.Sprintf("If purl is specified, package_name and ecosystem should not be specified in query %d", i),
), nil
}

// Create query request
Expand Down Expand Up @@ -293,4 +296,4 @@ func (s *Server) handleGetVulnerability(ctx context.Context, request mcp.CallToo
}

return mcp.NewToolResultText(string(result)), nil
}
}
Loading