Skip to main content
Glama
NotionClient.ts1.19 kB
/** * NotionClient - Notion APIクライアントのラッパー(Axios版) */ import axios, { AxiosInstance } from 'axios'; export class NotionClient { private axiosInstance: AxiosInstance; private apiKey: string; constructor(apiKey: string) { if (!apiKey || apiKey.trim().length === 0) { throw new Error('Notion API key is required'); } this.apiKey = apiKey; // Axiosインスタンスを作成 this.axiosInstance = axios.create({ baseURL: 'https://api.notion.com/v1', headers: { 'Authorization': `Bearer ${apiKey}`, 'Notion-Version': '2022-06-28', 'Content-Type': 'application/json', }, }); } /** * Axiosインスタンスを取得 */ getAxiosInstance(): AxiosInstance { return this.axiosInstance; } /** * APIキーを取得 */ getApiKey(): string { return this.apiKey; } /** * APIキーの有効性を確認 */ async validateApiKey(): Promise<boolean> { try { // ユーザー情報を取得して認証を確認 await this.axiosInstance.get('/users/me'); return true; } catch (error) { return false; } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kazy1014/notion-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server