Unable to use mcp api package

I have been trying to write an MCP client that uses galley as the MCP server.
While initialising the client for MCP from my code, i am hitting a compile time error that looks like this:

cannot use cl (type "istio.io/api/mcp/v1alpha1".AggregatedMeshConfigServiceClient) as type "istio.io/istio/vendor/istio.io/api/mcp/v1alpha1".AggregatedMeshConfigServiceClient in argument to "istio.io/istio/pkg/mcp/client".New:
	"istio.io/api/mcp/v1alpha1".AggregatedMeshConfigServiceClient does not implement "istio.io/istio/vendor/istio.io/api/mcp/v1alpha1".AggregatedMeshConfigServiceClient (wrong type for IncrementalAggregatedResources method)
		have IncrementalAggregatedResources(context.Context, ..."google.golang.org/grpc".CallOption) ("istio.io/api/mcp/v1alpha1".AggregatedMeshConfigService_IncrementalAggregatedResourcesClient, error)
		want IncrementalAggregatedResources(context.Context, ..."istio.io/istio/vendor/google.golang.org/grpc".CallOption) ("istio.io/istio/vendor/istio.io/api/mcp/v1alpha1".AggregatedMeshConfigService_IncrementalAggregatedResourcesClient, error)

Why does this expect istio.io/api/mcp/v1alpha1".AggregatedMeshConfigServiceClient from the vendor package? Ideally it should have compared just the type.

I figured out the problem. It was due to the fact that the vendor folder of istio.io also had the same package as was present in the regular tree. Ideally a vendor folder in my project should resolve the issue by ensuring that this confusion does not occur. Pls suggest, if there are any other alternate solutions.