New cmd/mcpd binary using github.com/modelcontextprotocol/go-sdk
v1.5.0 over stdio transport. Exposes Lakehouse capabilities as MCP
tools: list_datasets, get_manifest, query_sql, embed_text,
search_vectors. Each tool proxies to the gateway via HTTP.
Replaces the MCP-tool subset of the Rust system's Bun mcp-server.ts
(the audit's "split this 2520-line empire" finding from R-005). HTTP
demo routes (the staffing co-pilot UI at /api/intelligence/*,
/headshots/*, etc.) stay Bun until G5 cutover — those are demo-
specific and depend on matrix-indexer signals not yet ported.
Architecture:
cmd/mcpd/main.go (235 LoC)
main() reads --gateway flag, builds server via buildServer(),
runs on StdioTransport. Each tool's args is a typed struct with
jsonschema tags (the SDK's canonical pattern); reflection
generates the JSON Schema automatically.
gatewayClient: thin HTTP wrapper over the configured gateway URL.
30s per-request timeout. 16 MiB tool-response cap. Non-2xx
surfaces as IsError CallToolResult (NOT as transport error) so
the LLM caller sees the error text and can decide how to react.
proxy() handles GET + POST + JSON body uniformly. errorResult()
+ jsonResult() helpers normalize CallToolResult shape.
cmd/mcpd/main_test.go (13 test funcs)
Tests the full MCP wire end-to-end without a subprocess: spin
up a fake gateway via httptest, build the MCP server pointed at
it, connect a client via in-memory transports (NewInMemoryTransports),
call each tool. Each tool gets:
- happy path (gateway returns 200 → tool returns content)
- input validation (missing required fields → IsError)
- upstream error (gateway 4xx → tool returns IsError)
Plus TestListTools verifies all 5 tools register; TestGatewayUnreachable
verifies network-level failures surface as IsError, not panics.
Setup for Claude Desktop / Code documented in README:
{
"mcpServers": {
"lakehouse": {
"command": "/path/to/bin/mcpd",
"args": ["--gateway", "http://127.0.0.1:3110"]
}
}
}
Verified:
go test -count=1 ./cmd/mcpd/ — 13/13 green
just verify — vet + test + 9 smokes 35s
Out of scope for this commit:
- Resources (mcp.AddResource): not needed yet; tools cover the
interactive surface. Add when an LLM-side use case shows up.
- Prompts (mcp.AddPrompt): same.
- Streamable transports (HTTP, SSE): stdio is the universal one;
streamable can be added with srv.Run(ctx, &mcp.StreamableHTTPHandler{})
swap if a daemon-mode deploy makes sense.
- mcpd inside the daemon-supervised stack: it's stdio-only and
spawned by the MCP client, not run as a service. Adding a
daemon-mode (HTTP transport on a port) is a follow-up if MCP
consumers want long-lived sessions.
This is a tool-surface only port. The Bun mcp-server.ts also serves
HTTP demo routes (/api/catalog/datasets, /intelligence/*, /headshots/*)
that depend on the matrix-indexer signals from the Rust system; those
stay Bun until G5 cutover when the staffing co-pilot service ports
to Go.
Direct deps added:
github.com/modelcontextprotocol/go-sdk v1.5.0
Transitive (resolved by go mod tidy):
github.com/google/jsonschema-go v0.4.2
github.com/yosida95/uritemplate/v3 v3.0.2
golang.org/x/oauth2 v0.35.0
github.com/segmentio/encoding v0.5.4
github.com/golang-jwt/jwt/v5 v5.3.1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
70 lines
3.3 KiB
Modula-2
70 lines
3.3 KiB
Modula-2
module git.agentview.dev/profit/golangLAKEHOUSE
|
|
|
|
go 1.25.0
|
|
|
|
require (
|
|
github.com/apache/arrow-go/v18 v18.6.0
|
|
github.com/aws/aws-sdk-go-v2 v1.41.6
|
|
github.com/aws/aws-sdk-go-v2/config v1.32.16
|
|
github.com/aws/aws-sdk-go-v2/credentials v1.19.15
|
|
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.16
|
|
github.com/aws/aws-sdk-go-v2/service/s3 v1.100.0
|
|
github.com/aws/smithy-go v1.25.0
|
|
github.com/coder/hnsw v0.6.1
|
|
github.com/duckdb/duckdb-go/v2 v2.10502.0
|
|
github.com/go-chi/chi/v5 v5.2.5
|
|
github.com/google/uuid v1.6.0
|
|
github.com/hashicorp/golang-lru/v2 v2.0.7
|
|
github.com/modelcontextprotocol/go-sdk v1.5.0
|
|
github.com/pelletier/go-toml/v2 v2.3.0
|
|
)
|
|
|
|
require (
|
|
github.com/andybalholm/brotli v1.2.1 // indirect
|
|
github.com/apache/thrift v0.22.0 // indirect
|
|
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9 // indirect
|
|
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.22 // indirect
|
|
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22 // indirect
|
|
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.22 // indirect
|
|
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.23 // indirect
|
|
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.8 // indirect
|
|
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.14 // indirect
|
|
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.22 // indirect
|
|
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.22 // indirect
|
|
github.com/aws/aws-sdk-go-v2/service/signin v1.0.10 // indirect
|
|
github.com/aws/aws-sdk-go-v2/service/sso v1.30.16 // indirect
|
|
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.20 // indirect
|
|
github.com/aws/aws-sdk-go-v2/service/sts v1.42.0 // indirect
|
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
|
github.com/chewxy/math32 v1.10.1 // indirect
|
|
github.com/duckdb/duckdb-go-bindings v0.10502.0 // indirect
|
|
github.com/duckdb/duckdb-go-bindings/lib/darwin-amd64 v0.10502.0 // indirect
|
|
github.com/duckdb/duckdb-go-bindings/lib/darwin-arm64 v0.10502.0 // indirect
|
|
github.com/duckdb/duckdb-go-bindings/lib/linux-amd64 v0.10502.0 // indirect
|
|
github.com/duckdb/duckdb-go-bindings/lib/linux-arm64 v0.10502.0 // indirect
|
|
github.com/duckdb/duckdb-go-bindings/lib/windows-amd64 v0.10502.0 // indirect
|
|
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
|
|
github.com/goccy/go-json v0.10.6 // indirect
|
|
github.com/google/flatbuffers v25.12.19+incompatible // indirect
|
|
github.com/google/jsonschema-go v0.4.2 // indirect
|
|
github.com/google/renameio v1.0.1 // indirect
|
|
github.com/klauspost/compress v1.18.5 // indirect
|
|
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
|
github.com/pierrec/lz4/v4 v4.1.26 // indirect
|
|
github.com/segmentio/asm v1.1.3 // indirect
|
|
github.com/segmentio/encoding v0.5.4 // indirect
|
|
github.com/viterin/partial v1.1.0 // indirect
|
|
github.com/viterin/vek v0.4.2 // indirect
|
|
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
|
|
github.com/zeebo/xxh3 v1.1.0 // indirect
|
|
golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect
|
|
golang.org/x/net v0.52.0 // indirect
|
|
golang.org/x/oauth2 v0.35.0 // indirect
|
|
golang.org/x/sync v0.20.0 // indirect
|
|
golang.org/x/sys v0.43.0 // indirect
|
|
golang.org/x/text v0.35.0 // indirect
|
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 // indirect
|
|
google.golang.org/grpc v1.80.0 // indirect
|
|
google.golang.org/protobuf v1.36.11 // indirect
|
|
)
|