
Day 5 Remote MCP Server
Enables Claude Web to interact with Google Docs through a remote HTTP-based MCP server. Provides scalable document operations including creation, editing, and management with service account authentication.
README
Day 5: APIs From Remote MCP
学習目標
Day4のLocal MCPサーバーをRemote MCPサーバーとしてデプロイし、Claude WebからもGoogle Docs操作を可能にする
今日学ぶこと
- Local MCP vs Remote MCP の違い
- HTTP/WebSocketベースのMCPサーバー実装
- Claude Web Custom Connectors との統合
- スケーラブルなAPI統合アーキテクチャ
- 本格的なEpisodicRAGシステムの基盤構築
プロジェクト構造
Day5_APIsFromRemoteMCP/
├── README.md # このファイル
├── package.json # Node.js プロジェクト設定
├── tsconfig.json # TypeScript設定
├── .env.example # 環境変数のサンプル
├── .gitignore # Git除外ファイル
├── vercel.json # Vercel デプロイ設定(オプション)
├── src/
│ ├── server.ts # Remote MCPサーバー本体
│ ├── routes/
│ │ ├── mcp.ts # MCP protocol endpoints
│ │ └── health.ts # ヘルスチェック
│ ├── services/
│ │ └── google-docs-remote.ts # Remote用Google Docsサービス
│ ├── middleware/
│ │ ├── auth.ts # 認証ミドルウェア
│ │ ├── cors.ts # CORS設定
│ │ └── error.ts # エラーハンドリング
│ └── utils/
│ ├── mcp-protocol.ts # MCPプロトコル実装
│ └── websocket.ts # WebSocket管理
├── deployment/
│ ├── vercel/ # Vercel用設定
│ ├── railway/ # Railway用設定
│ └── docker/ # Docker用設定
└── dist/ # コンパイル後のJavaScript
Day1-4からのステップアップ
これまでの学習 → Day5での発展
- Day1: Python関数 → スケーラブルなAPI関数
- Day2: Local MCP → Remote MCP Server
- Day3: 認証学習 → サーバーサイド認証管理
- Day4: Claude Desktop統合 → Claude Web + Custom Connectors
Local MCP vs Remote MCP
Local MCP (Day4)
Claude Desktop ←→ Node.js Process ←→ Google APIs
(stdio) (localhost) (OAuth2)
特徴:
- Claude Desktop専用
- Stdio通信(標準入出力)
- ローカルプロセス
- OAuth2認証(ユーザー権限)
Remote MCP (Day5)
Claude Web ←→ HTTP Server ←→ Google APIs
(HTTPS) (Remote Host) (Service Account)
特徴:
- Claude Web + Desktop 両対応
- HTTP/WebSocket通信
- リモートサーバー
- サービスアカウント認証(サーバー権限)
アーキテクチャ設計
Core Components
1. Remote MCP Server
// HTTP endpoint for MCP protocol
app.post('/mcp', handleMCPRequest);
// WebSocket for real-time updates
app.ws('/ws', handleWebSocket);
2. Authentication Strategy
// Day3で学んだサービスアカウント認証を活用
const auth = new GoogleServiceAccount({
keyFile: process.env.GOOGLE_SERVICE_ACCOUNT_KEY,
scopes: ['docs', 'drive']
});
3. Claude Web Integration
// Custom Connector 設定
{
"name": "EpisodicRAG Remote",
"url": "https://your-server.vercel.app/mcp",
"description": "Remote Google Docs operations"
}
技術スタック
Backend
- Express.js: HTTP サーバー
- ws: WebSocket サポート
- Google APIs: Day3・4の知識活用
- Zod: スキーマ検証(Day4と同じ)
Deployment Options
- Vercel: サーバーレス関数(推奨)
- Railway: フルスタックホスティング
- Docker: コンテナデプロイ
Security
- API Key認証: カスタムコネクタ用
- Rate Limiting: DDoS防止
- CORS: クロスオリジン制御
- Input Validation: Zod による検証
Day5の革新的なポイント
1. Universal Access
Claude Desktop (Day4) → Local MCP
Claude Web (Day5) → Remote MCP
Mobile Apps (Future) → Same Remote MCP
2. Scalable Architecture
Single Remote Server → Multiple Client Types
→ Multiple Google Accounts
→ Multiple API Integrations
3. EpisodicRAG Foundation
- Centralized Knowledge: すべてのクライアントから同じEpisodicRAGフォルダーにアクセス
- Unified API: 一貫したGoogle Docs操作
- Multi-User Support: 将来的な複数ユーザー対応
MCP Protocol Implementation
HTTP Endpoint Design
// MCP tools/list
GET /mcp/tools
// MCP tools/call
POST /mcp/tools/call
{
"name": "create_document",
"arguments": {
"title": "Remote Test Document"
}
}
WebSocket Real-time Updates
// Document creation notifications
ws.send({
"type": "document_created",
"data": {
"id": "doc_id",
"url": "https://docs.google.com/..."
}
});
セキュリティ考慮事項
1. API Key Management
- Environment Variables で秘密鍵管理
- Rotation 可能な API キー設計
- Per-client access control
2. Rate Limiting
// Per IP, Per API Key limits
const rateLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100 // requests per window
});
3. Input Sanitization
// Zod schema validation
const CreateDocSchema = z.object({
title: z.string().max(200).min(1),
content: z.string().max(10000).optional()
});
Deployment Strategy
Phase 1: Basic Remote MCP
- Express サーバー実装
- Day4 tools の HTTP 版変換
- Vercel デプロイ
- Claude Web テスト
Phase 2: Advanced Features
- WebSocket リアルタイム更新
- Multi-user support
- Advanced error handling
- Monitoring & Logging
Phase 3: EpisodicRAG Integration
- Knowledge graph connections
- Advanced document relationships
- AI-powered content suggestions
- Automated knowledge curation
🎉 デプロイ成功!
Railway.app でのデプロイ
- Public URL: https://testday5-production.up.railway.app
- Health Check: https://testday5-production.up.railway.app/health
- MCP Endpoint: https://testday5-production.up.railway.app/mcp
Claude Web Custom Connector設定
Name: Railway MCP Server
URL: https://testday5-production.up.railway.app/mcp
Description: Simple MCP server hosted on Railway
利用可能なツール
get_time
- 現在時刻を取得echo
- メッセージをエコーcalculate
- 簡単な数式計算
成功基準
- [x] Remote MCPサーバーがHTTPで動作する ✅
- [x] Claude WebでCustom Connectorが設定できる ✅
- [x] Railway.appでのデプロイ成功 ✅
- [ ] Day4と同等のGoogle Docs操作がリモートで可能
- [x] スケーラブルなアーキテクチャの基盤完成 ✅
Day4との互換性
Shared Tools
create_document
→ HTTP POST /mcp/tools/callwrite_to_document
→ 同上list_loop_documents
→ 同上create_learning_log
→ 同上
Migration Path
Day4 Local MCP → Day5 Remote MCP → Hybrid Usage
Claude Desktop Claude Web Both Platforms
次のステップ(Day6以降展望)
- Advanced EpisodicRAG: AIベースのナレッジキュレーション
- Multi-API Integration: Slack, Notion, GitHub等との統合
- Real-time Collaboration: リアルタイム共同編集
- AI Assistant Integration: GPT-4, Claude等との直接統合
参考リンク
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。