Asking Fate MCP Server

Asking Fate MCP Server

Provides fortune-telling tools including tarot card spreads, Thai horoscope, zodiac info, and auspicious dates. Enables interactive tarot card picking via an MCP App UI and returns structured JSON for interpretation.

Category
访问服务器

README

AskingFate — MCP Server

Remote MCP server for askingfate.com fortune-telling services, built with Next.js (App Router, API-only) and mcp-handler.

Endpoint: https://mcp.askingfate.com/mcp (Streamable HTTP only — SSE is disabled), protected by OAuth 2.1 (see Auth below)

Tools

Tool Description
draw_tarot_spread Shuffles the full 78-card deck (crypto-random, no duplicates, upright/reversed) and opens an interactive MCP App UI where the user taps face-down cards arranged in a fan to complete the spread (single, three_card, or celtic_cross). The user's picks are sent back to the host for the model to interpret.
get_thai_horoscope Structured Thai astrology data (the traditional Thaksa tables) for a birth date: day planet, element, lucky/kalakini colours, lucky numbers, the eight Thaksa positions, and an approximate ascendant when a birth time is given.
get_zodiac_info Western (tropical) sign with element/quality/ruling planet, approximate Thai sidereal sign, and the Thai/Chinese 12-year animal with year-boundary caveats.
get_auspicious_dates Auspicious dates in a month for a purpose (wedding, business, moving, car) rated by traditional Thai day-of-week principles, with reasons and days to avoid.

All tools are read-only (readOnlyHint: true), computed from static data modules — no external APIs. Tool results return structured JSON for the model to interpret; the server does not generate fortune text.

Development

npm install
cp .env.example .env.local   # set OAUTH_DEV_USER_ID for local testing
npm run dev     # then connect an MCP client to http://localhost:3000/mcp
npm run build   # production build + strict TypeScript check

Layout

  • app/[transport]/route.ts — MCP handler, tool registration, CORS, withMcpAuth wrapper
  • app/oauth/ — OAuth 2.1 authorization server (register, authorize, token)
  • app/.well-known/ — OAuth metadata (RFC 9728 protected resource + RFC 8414 authorization server)
  • lib/oauth/ — token/store/session plumbing (see below)
  • lib/tarot/ — 78-card deck data, spread definitions, crypto-random shuffle
  • lib/astro/ — Thai Thaksa tables, horoscope/zodiac/auspicious-date logic
  • lib/mcp/tarot-app-html.ts — self-contained card-picking MCP App (sandboxed iframe, no storage APIs)

Auth

The MCP endpoint requires OAuth 2.1 Bearer tokens. This deployment is both the authorization server and the protected resource (issuer = https://mcp.askingfate.com), and it delegates login to the existing askingfate.com account system.

Flow (what Claude does when you add this as a custom connector)

  1. POST /mcp without a token → 401 + WWW-Authenticate pointing at /.well-known/oauth-protected-resource, which points at the authorization server metadata (/.well-known/oauth-authorization-server).
  2. Claude registers itself via Dynamic Client Registration (POST /oauth/register, RFC 7591). Public clients (token_endpoint_auth_method: "none") and confidential clients (client_secret_post / client_secret_basic, secret stored hashed) are accepted; PKCE stays mandatory either way. Scope values are treated as opaque labels (Claude sends claudeai) — only the format is validated. Redirect URIs are checked against an allowlist (https://claude.ai/api/mcp/auth_callback, https://claude.com/api/mcp/auth_callback, plus OAUTH_ALLOWED_REDIRECT_URIS). The endpoints are also aliased at the MCP-spec default root paths (/register, /authorize, /token) for clients that skip metadata discovery.
  3. The user lands on GET /oauth/authorize. No session yet → redirect to askingfate.com/signin with a callbackUrl pointing at /oauth/callback here. After login (or immediately, if already logged in on askingfate.com) the main site hands the Supabase access token back in the URL fragment; /oauth/callback POSTs it to /oauth/session, which verifies it server-side (same Supabase project) and sets a signed HttpOnly session cookie for this deployment, then resumes the authorize URL → a short consent page (app name, requested scopes, Allow/Deny).
  4. Consent issues a single-use authorization code (60 s TTL, stored hashed, bound to user + client + PKCE code_challenge) and redirects back to Claude.
  5. POST /oauth/token exchanges the code — PKCE S256 is verified on every exchange, no fallback — for a 1-hour HS256 JWT access token (user_id, scope, exp in the payload) plus a 30-day refresh token (stored hashed, rotated on every use).
  6. Tools receive the caller via extra.authInfo — the askingfate user id is at extra.authInfo.extra.userId.

Storage

Three "tables", all keyed in Redis (Upstash REST / Vercel KV) with in-memory fallback for local dev: oauth_clients, oauth_codes, oauth_refresh_tokens. Codes and refresh tokens are stored only as SHA-256 hashes. Set UPSTASH_REDIS_REST_URL/UPSTASH_REDIS_REST_TOKEN (or the KV_REST_API_* pair) in production.

Wiring up the askingfate.com account system

The main site authenticates with Supabase in the browser (the session lives in localStorage on askingfate.com), so no cookie ever reaches the mcp. subdomain. Instead, the main site's /signin, /signup and Google /auth/callback pages recognise a callbackUrl pointing at an allowlisted external origin (this deployment — see lib/external-auth-callback.ts in the simple-tarot repo) and hand the Supabase access token back in the URL fragment; /oauth/session verifies it against the project and issues our own session cookie. Deployment requirements:

  1. Set SUPABASE_URL + SUPABASE_ANON_KEY (or their NEXT_PUBLIC_-prefixed twins) to the exact values the main site uses — without them /oauth/authorize refuses with a 503 saying so.
  2. The main site must be deployed with the token-handoff support above.

lib/oauth/session.ts/lib/oauth/supabase.ts remain the single integration point. When session establishment fails, /oauth/callback shows the exact server error (wrong Supabase project, missing JWT_SECRET, origin mismatch, …) and the reason is also logged server-side.

Testing locally / MCP Inspector

# .env.local: OAUTH_DEV_USER_ID=user_dev_1   (bypasses the askingfate session
# check — dev builds only, ignored in production)
npm run dev
npx @modelcontextprotocol/inspector   # connect to http://localhost:3000/mcp

Loopback redirect URIs (http://localhost, http://127.0.0.1) are allowed outside production so the Inspector can complete the flow; in production they are rejected unless OAUTH_ALLOW_LOOPBACK_REDIRECTS=true.

Quick smoke checks:

curl -si -X POST http://localhost:3000/mcp | grep -i www-authenticate
curl -s http://localhost:3000/.well-known/oauth-protected-resource | jq
curl -s http://localhost:3000/.well-known/oauth-authorization-server | jq

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选