feat: add google maps mcp source (#125)

This commit is contained in:
2026-06-13 01:59:54 +01:00
committed by GitHub
parent ef7301ab18
commit 38b21a1aa4
14 changed files with 492 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
import { GoogleMapsSource, type GoogleMapsSourceOptions } from "@freya/source-google-maps"
import type { FeedSourceProvider } from "../session/feed-source-provider.ts"
export interface GoogleMapsSourceProviderOptions {
readonly apiKey: string
readonly client?: GoogleMapsSourceOptions["client"]
}
export class GoogleMapsSourceProvider implements FeedSourceProvider {
readonly sourceId = "freya.google-maps"
private readonly apiKey: string
private readonly client: GoogleMapsSourceProviderOptions["client"]
constructor(options: GoogleMapsSourceProviderOptions) {
if (!nonEmptyString(options.apiKey)) {
throw new Error("Google Maps MCP API key must be configured")
}
this.apiKey = options.apiKey
this.client = options.client
}
async feedSourceForUser(
_userId: string,
_config: unknown,
_credentials: unknown,
): Promise<GoogleMapsSource> {
return new GoogleMapsSource({
apiKey: this.apiKey,
client: this.client,
})
}
}
function nonEmptyString(value: string): boolean {
return typeof value === "string" && value.trim().length > 0
}