diff --git a/Dockerfile b/Dockerfile index 2a11589c..fa66ccf6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,5 +40,6 @@ RUN chmod +x /usr/bin/pathfinder RUN chmod +x /usr/bin/entrypoint.sh LABEL maintainer="shiva@shivasurya.me" +LABEL io.modelcontextprotocol.server.name="dev.codepathfinder/pathfinder" ENTRYPOINT ["/usr/bin/entrypoint.sh"] \ No newline at end of file diff --git a/python-sdk/README.md b/python-sdk/README.md index ecdfd9ab..1f19f40c 100644 --- a/python-sdk/README.md +++ b/python-sdk/README.md @@ -1,3 +1,5 @@ + + # Code Pathfinder Python SDK Write security rules in Python for Code Pathfinder, an open-source security scanner that combines structural code analysis with AI-powered vulnerability detection. diff --git a/python-sdk/pyproject.toml b/python-sdk/pyproject.toml index 07e91e32..7fc91327 100644 --- a/python-sdk/pyproject.toml +++ b/python-sdk/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "codepathfinder" -version = "1.3.6" +version = "1.3.7" description = "Python SDK for code-pathfinder static analysis for modern security teams" readme = "README.md" requires-python = ">=3.8" diff --git a/sast-engine/VERSION b/sast-engine/VERSION index 95b25aee..3336003d 100644 --- a/sast-engine/VERSION +++ b/sast-engine/VERSION @@ -1 +1 @@ -1.3.6 +1.3.7 diff --git a/sast-engine/cmd/serve.go b/sast-engine/cmd/serve.go index 6f75aade..3c09f97a 100644 --- a/sast-engine/cmd/serve.go +++ b/sast-engine/cmd/serve.go @@ -60,6 +60,7 @@ func runServe(cmd *cobra.Command, _ []string) error { // Create server with empty index (will be populated by background indexing) server := mcp.NewServerWithBackgroundIndexing(projectPath, pythonVersion, disableAnalytics) + server.SetVersion(Version) // Start indexing in background goroutine go func() { diff --git a/sast-engine/mcp/server.go b/sast-engine/mcp/server.go index 75beb338..39dbaf16 100644 --- a/sast-engine/mcp/server.go +++ b/sast-engine/mcp/server.go @@ -25,6 +25,7 @@ type Server struct { degradation *GracefulDegradation analytics *Analytics disableAnalytics bool + version string // Go-specific context for stdlib metadata in MCP tool responses. // Set via SetGoContext after the Go call graph is built. @@ -32,6 +33,12 @@ type Server struct { goModuleRegistry *core.GoModuleRegistry } +// SetVersion sets the server version reported in MCP initialize responses. +// Should be called with cmd.Version (injected via ldflags at build time). +func (s *Server) SetVersion(version string) { + s.version = version +} + // SetGoContext stores the Go version and module registry so that MCP tool // responses can include stdlib metadata (is_stdlib, signature, return_type, // etc.) for Go standard library calls. @@ -244,11 +251,16 @@ func (s *Server) handleInitialize(req *JSONRPCRequest) *JSONRPCResponse { s.analytics.ReportClientConnected(params.ClientInfo.Name, params.ClientInfo.Version) } + version := s.version + if version == "" { + version = "dev" + } + return SuccessResponse(req.ID, InitializeResult{ ProtocolVersion: "2024-11-05", ServerInfo: ServerInfo{ - Name: "pathfinder", - Version: "0.1.0-poc", + Name: "dev.codepathfinder/pathfinder", + Version: version, }, Capabilities: Capabilities{ Tools: &ToolsCapability{ diff --git a/sast-engine/mcp/server_test.go b/sast-engine/mcp/server_test.go index 96411ef2..b7f91fe0 100644 --- a/sast-engine/mcp/server_test.go +++ b/sast-engine/mcp/server_test.go @@ -352,8 +352,8 @@ func TestHandleInitialize(t *testing.T) { result, ok := resp.Result.(InitializeResult) require.True(t, ok) assert.Equal(t, "2024-11-05", result.ProtocolVersion) - assert.Equal(t, "pathfinder", result.ServerInfo.Name) - assert.Equal(t, "0.1.0-poc", result.ServerInfo.Version) + assert.Equal(t, "dev.codepathfinder/pathfinder", result.ServerInfo.Name) + assert.Equal(t, "dev", result.ServerInfo.Version) assert.NotNil(t, result.Capabilities.Tools) } diff --git a/sast-engine/mcp/types_test.go b/sast-engine/mcp/types_test.go index 99b15ff4..04f534c5 100644 --- a/sast-engine/mcp/types_test.go +++ b/sast-engine/mcp/types_test.go @@ -220,8 +220,8 @@ func TestInitializeResult_Serialization(t *testing.T) { result := InitializeResult{ ProtocolVersion: "2024-11-05", ServerInfo: ServerInfo{ - Name: "pathfinder", - Version: "0.1.0-poc", + Name: "dev.codepathfinder/pathfinder", + Version: "1.3.7", }, Capabilities: Capabilities{ Tools: &ToolsCapability{ListChanged: true}, diff --git a/server.json b/server.json new file mode 100644 index 00000000..e199ac1f --- /dev/null +++ b/server.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", + "name": "dev.codepathfinder/pathfinder", + "title": "Code Pathfinder", + "description": "Code intelligence MCP server: call graphs, type inference, and symbol search for Python/Go.", + "repository": { + "url": "https://github.com/shivasurya/code-pathfinder", + "source": "github" + }, + "version": "1.3.7", + "packages": [ + { + "registryType": "pypi", + "identifier": "codepathfinder", + "version": "1.3.7", + "transport": { + "type": "stdio" + }, + "packageArguments": [ + { + "type": "positional", + "value": "serve", + "description": "Start the MCP server", + "isRequired": true + }, + { + "type": "named", + "name": "--project", + "description": "Project root to index (defaults to current directory)", + "isRequired": false, + "default": ".", + "format": "filepath" + } + ] + }, + { + "registryType": "oci", + "identifier": "docker.io/shivasurya/code-pathfinder:v1.3.7", + "transport": { + "type": "stdio" + } + } + ] +}