MCP Kynhood Events Server

MCP Kynhood Events Server

Enables Claude Desktop to interact with the Kynhood Events API, allowing users to list events with pagination and retrieve detailed event information through natural language queries.

Category
访问服务器

README

MCP Kynhood Events Server

A Model Context Protocol (MCP) server that enables Claude Desktop to interact with the Kynhood Events API. This server provides tools for listing events and retrieving detailed event information.

Features

  • Automatic Token Management: Fetches and caches guest tokens automatically
  • Smart Retry Logic: Handles 401 errors by refreshing tokens
  • Type-Safe: Built with TypeScript for robust error handling
  • Production-Ready: Comprehensive logging and error handling

Tools Available

1. listEvents

List events from the Kynhood API with pagination support.

Parameters:

  • skip (optional, default: 0): Number of events to skip
  • limit (optional, default: 10): Maximum number of events to return

Returns: Array of events with metadata

2. getEventById

Get detailed information about a specific event.

Parameters:

  • id (required): The event ID (24-character hex string)

Returns: Complete event details

Installation

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Claude Desktop app

Steps

  1. Clone or create the project directory:
mkdir mcp-kynhood-events
cd mcp-kynhood-events
  1. Install dependencies:
npm install
  1. Configure environment (optional):
cp .env.example .env

Edit .env if you need to customize settings:

API_BASE_URL=https://***.****.com/api
DEFAULT_SKIP=0
DEFAULT_LIMIT=10
DEBUG=false

Running the Server

Development Mode

npm start

Build TypeScript

npm run build

Watch Mode (Auto-restart)

npm run dev

Connecting to Claude Desktop

Configuration

Add this server to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "kynhood-events": {
      "command": "node",
      "args": [
        "G:\\projects\\mcp\\event\\dist\\index.js"
      ],
      "env": {
        "API_BASE_URL": "https://***.****.com/api"
      }
    }
  }
}

Alternative: Using TypeScript directly (no build required):

{
  "mcpServers": {
    "kynhood-events": {
      "command": "npx",
      "args": [
        "-y",
        "tsx",
        "G:\\projects\\mcp\\event\\src\\index.ts"
      ],
      "env": {
        "API_BASE_URL": "https://***.****.com/api"
      }
    }
  }
}

Note: Update the path to match your actual installation directory.

Restart Claude Desktop

After updating the configuration, completely quit and restart Claude Desktop for changes to take effect.

Usage Examples

Once connected to Claude Desktop, you can use natural language to interact with the Kynhood Events API:

Example Queries

List trending events:

Show me the latest events from Kynhood

Get specific event details:

Get details for event 68cd87381ea5

List with pagination:

Show me events 10-20 from Kynhood (skip 10, limit 10)

Multiple operations:

List the first 5 events, then show me details for the first one

Architecture

Project Structure

mcp-kynhood-events/
├── src/
│   ├── index.ts              # MCP server entry point
│   ├── api/
│   │   ├── token.ts          # Token fetching logic
│   │   └── events.ts         # Events API calls
│   ├── tools/
│   │   ├── listEvents.ts     # List events tool
│   │   └── getEventById.ts   # Get event by ID tool
│   └── utils/
│       ├── http.ts           # HTTP client with retry logic
│       ├── logger.ts         # Logging utility
│       └── tokenCache.ts     # In-memory token cache
├── package.json
├── tsconfig.json
└── README.md

Token Management Flow

  1. First Request: Server checks token cache (empty)
  2. Fetch Token: Calls GET /api/token to get guest token
  3. Cache Token: Stores token with 55-minute TTL
  4. Use Token: Attaches to all subsequent API requests
  5. Handle 401: If token expires, automatically fetches new token and retries

Error Handling

  • Network Errors: Logged and returned to Claude with context
  • 401 Unauthorized: Automatically retries once with fresh token
  • Invalid Responses: Validates response structure and provides meaningful errors
  • Missing Parameters: Validates required parameters before API calls

API Endpoints Used

1. Get Guest Token

GET https://***.****.com/api/token

Returns JWT token for guest authentication.

2. List Events

POST https://***.****.com/api/events?skip=0&limit=10
Authorization: Bearer <token>
Body: {}

Returns paginated list of events.

3. Get Event by ID

GET https://***.****.com/api/events/:eventId
Authorization: Bearer <token>

Returns detailed event information.

Development

Adding New Tools

  1. Create tool file in src/tools/
  2. Define input/output interfaces
  3. Implement tool function
  4. Export tool definition
  5. Register in src/index.ts

Debugging

Enable debug logging:

DEBUG=true

Logs are output to stderr (visible in Claude Desktop logs).

Troubleshooting

Server Not Appearing in Claude Desktop

  1. Check configuration file path is correct
  2. Verify JSON syntax in claude_desktop_config.json
  3. Ensure file paths use absolute paths
  4. Restart Claude Desktop completely

Token Errors

  • Server automatically handles token refresh
  • Check API_BASE_URL is correct
  • Verify network connectivity to api.kynhood.com

Build Errors

# Clean and reinstall
rm -rf node_modules dist
npm install
npm run build

Testing the API Manually

You can test the Kynhood API endpoints directly:

# Get token
curl https://***.****.com/api/token

# List events (replace TOKEN with actual token)
curl -X POST "https://***.****.com/api/events?skip=0&limit=10" \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d "{}"

# Get event by ID
curl "https://***.****.com/api/events/68cd8a9496a5" \
  -H "Authorization: Bearer TOKEN"

License

MIT

Support

For issues or questions:

  • Check the logs in Claude Desktop
  • Verify API connectivity: curl https://***.****.com/api/token
  • Review this README for configuration steps

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选