mirror of
https://github.com/kennethnym/aris.git
synced 2026-06-13 11:01:18 +01:00
feat: add google maps mcp source (#125)
This commit is contained in:
39
apps/freya-backend/src/google-maps/provider.ts
Normal file
39
apps/freya-backend/src/google-maps/provider.ts
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user