Skip to content

Commit 3bc34bc

Browse files
committed
mcp: reuse go-mcp library for MCP server implementation
Replaces odek's hand-rolled MCP server (internal/mcp/mcp.go) with a thin adapter over github.com/BackendStack21/go-mcp v1.1.0. Changes: - internal/mcp/mcp.go: rewritten as ~130-line adapter wrapping gomcp.Server - Removed duplicated JSON-RPC/MCP protocol types (~230 lines of protocol code) - Startup logging moved from cmd/odek/mcp.go into Server.Run() - Added go-mcp as direct dependency (21no.de ecosystem) - All 14 existing tests pass unchanged go-mcp provides: JSON-RPC 2.0 dispatch, init tracking, ping, tool/resource/prompt handlers, protocol version 2025-03-26, isError:true for tool errors.
1 parent e25af66 commit 3bc34bc

4 files changed

Lines changed: 53 additions & 292 deletions

File tree

cmd/odek/mcp.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,5 @@ Flags:
113113
// Create and run the MCP server
114114
version := getVersion()
115115
server := mcp.NewServer(version, nativeTools, os.Stdin, os.Stdout)
116-
117-
// Log startup to stderr (stdin/stdout are for MCP protocol)
118-
fmt.Fprintf(os.Stderr, "odek mcp ⚡ MCP server starting (v%s)\n", version)
119-
fmt.Fprint(os.Stderr, " Tools: ")
120-
for i, t := range nativeTools {
121-
if i > 0 {
122-
fmt.Fprint(os.Stderr, ", ")
123-
}
124-
fmt.Fprint(os.Stderr, t.Name)
125-
}
126-
fmt.Fprintln(os.Stderr)
127-
128116
return server.Run(context.Background())
129117
}

go.mod

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ module github.com/BackendStack21/kode
33
go 1.25.0
44

55
require (
6+
github.com/BackendStack21/go-mcp v1.1.0
67
github.com/BackendStack21/go-vector v1.1.1
78
golang.org/x/net v0.54.0
9+
golang.org/x/term v0.43.0
810
)
911

10-
require (
11-
golang.org/x/sys v0.44.0 // indirect
12-
golang.org/x/term v0.43.0 // indirect
13-
)
12+
require golang.org/x/sys v0.44.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/BackendStack21/go-mcp v1.1.0 h1:NQStOkqUWjzzzmySnfFHvPKhbKr92iBuPJjkNpb0MIU=
2+
github.com/BackendStack21/go-mcp v1.1.0/go.mod h1:RKFw6nrl6ySQqqrR8KtG7HYZ/heyyjT8SjiEtlbTMY8=
13
github.com/BackendStack21/go-vector v1.1.1 h1:sycI+a/ifT2DD3kdH0HleWtjKmIVNutvL/pgOL9qTA8=
24
github.com/BackendStack21/go-vector v1.1.1/go.mod h1:+IzfAFO4m6xrjsOhZsiTAbMbm8+hX0d9C1uD0SGPzHc=
35
golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w=

0 commit comments

Comments
 (0)