mcp-labrat

mcp-labrat

An MCP server that enables interaction with CalDAV calendars to manage events and check availability through natural language or voice commands. It provides specific tools for listing, searching, and creating calendar entries using an OpenAI-compatible interface.

Category
访问服务器

README

mcp-labrat

Voice + MCP calendar demo.

This project is a small Express app that:

  • Hosts an MCP server (Streamable HTTP transport) that exposes calendar tools backed by a CalDAV server
  • Hosts an HTTP “MCP client” endpoint that sends a prompt to an OpenAI-compatible Chat Completions API and lets the model call those MCP tools
  • Serves a simple browser UI (in public/) that records audio, transcribes it (Whisper API), and sends the resulting prompt to the MCP client endpoint

Requirements

  • Node.js 18+ (Node 20+ recommended)
  • A CalDAV server + credentials (or accept the defaults, but tools won’t be useful)
  • An OpenAI-compatible API endpoint for:
    • Chat Completions (/v1/chat/completions)
    • Audio Transcriptions (/v1/audio/transcriptions)

In this lab, OPENAI_PROXY_URL typically points to a proxy service (not OpenAI directly). The proxy is responsible for adding any required authentication (e.g. API keys) to outgoing requests.

Because auth is handled by the proxy, the server uses direct HTTP requests (via fetchData) instead of the official OpenAI SDK.

Quick start

  1. Install

    npm install
    
  2. Create .env

    cp .env-sample .env
    

    Then edit .env and set OPENAI_PROXY_URL to your proxy/base URL (e.g. http://localhost:1234 or your deployed proxy).

  3. Run the dev server

    npm run dev
    
  4. Open the demo UI

    • Visit http://localhost:3000/
    • Click “Start Recording”, speak a command, then click “Stop Recording”
    • Click “Send”

Environment variables

Create a .env file in the project root.

Server

  • PORT (optional, default: 3000)
  • NODE_ENV (optional, e.g. development)

MCP client + OpenAI-compatible API

  • MCP_SERVER_URL (required)
    • Example: http://localhost:3000/api/v1/mcp
    • This can point back to the same server instance.
  • OPENAI_PROXY_URL (required)
    • Base URL of your OpenAI-compatible proxy (the app calls /v1/chat/completions and /v1/audio/transcriptions under it)
    • Example: http://localhost:1234
  • OPENAI_MODEL (optional, default: gpt-4o)

Audio transcription (Whisper)

  • OPENAI_TRANSCRIPTION_MODEL (optional, default: whisper-1)

CalDAV (calendar backing store)

  • CALDAV_SERVER_URL (optional, default: http://localhost:5232/)
  • CALDAV_USERNAME (optional, default: username)
  • CALDAV_PASSWORD (optional, default: password)

Radicale (dev CalDAV server)

For local development you can run a minimal Radicale CalDAV server with no authentication.

macOS / Linux

  1. Install Radicale
python3 -m pip install --user radicale
  1. Create a local config + data folder
mkdir -p radicale-data/collections
cat > radicale.config <<'EOF'
[server]
hosts = 127.0.0.1:5232

[auth]
type = none

[storage]
filesystem_folder = ./radicale-data/collections
EOF
  1. Run Radicale
radicale --config ./radicale.config

Windows (PowerShell)

  1. Install Radicale
py -m pip install --user radicale
  1. Create a local config + data folder
New-Item -ItemType Directory -Force -Path .\radicale-data\collections | Out-Null
@'
[server]
hosts = 127.0.0.1:5232

[auth]
type = none

[storage]
filesystem_folder = ./radicale-data/collections
'@ | Set-Content -Encoding UTF8 .\radicale.config
  1. Run Radicale
py -m radicale --config .\radicale.config
  1. Point this app to Radicale

In .env:

  • CALDAV_SERVER_URL=http://localhost:5232/
  • CALDAV_USERNAME=anything (ignored when auth=none)
  • CALDAV_PASSWORD=anything (ignored when auth=none)

Scripts

  • npm run dev – run server with nodemon + ts-node
  • npm run build – compile TypeScript to dist/
  • npm start – run the compiled server (dist/index.js)

API

Base path is /api/v1.

Health

GET /api/v1/

Returns a simple JSON message.

MCP server

POST /api/v1/mcp

Implements the MCP Streamable HTTP transport.

MCP client

POST /api/v1/client

Accepts either:

  1. JSON (text prompt)
curl -sS \
 -H 'Content-Type: application/json' \
 -d '{"prompt":"List my events","timezone":"Europe/Helsinki"}' \
 http://localhost:3000/api/v1/client
  1. multipart/form-data (audio upload)

The field name must be audio.

curl -sS \
 -F 'audio=@command.webm' \
 -F 'timezone=Europe/Helsinki' \
 http://localhost:3000/api/v1/client

Response:

{
  "answer": "...",
  "toolCalls": 2
}

MCP tools

The MCP server currently exposes:

  • listEvents – list events in the primary CalDAV calendar
  • getEventsInTimeSlot – check availability for a time slot (relative date inputs)
  • createEvent – create an event (relative date inputs + title + optional description/location)

The MCP client instructs the model to use tools for all user requests and applies some workflow rules (e.g., check availability before creating events when the user asks “if the time is free”).

Troubleshooting

  • Mic permission: The browser will prompt for microphone access the first time. If recording fails, check site permissions.
  • CalDAV auth: If the calendar tools always return empty results, verify CALDAV_* values and that your user has at least one calendar.
  • Proxy URL: OPENAI_PROXY_URL must be the base URL; the app calls /v1/chat/completions and /v1/audio/transcriptions under it.
  • Uploads cleanup: Uploaded audio is deleted best-effort after transcription; check filesystem permissions if uploads/ grows unexpectedly.

API doc: POST /api/v1/client

Runs a user prompt through the MCP client. The server will call an OpenAI-compatible Chat Completions API, and the model can invoke MCP calendar tools (via the MCP server URL).

Request

Supported content types:

  1. application/json (text prompt)
  • prompt (string, required) – the user command/question
  • timezone (string, optional) – IANA timezone name (defaults to the server’s default timezone). See: List of tz database time zones

JSON request body example:

{
  "prompt": "List my events",
  "timezone": "Europe/Helsinki"
}

Example:

curl -sS \
  -H 'Content-Type: application/json' \
  -d '{"prompt":"List my events","timezone":"Europe/Helsinki"}' \
  http://localhost:3000/api/v1/client

Option 2: multipart/form-data (audio)

  • audio (file, required) – audio file to transcribe (browser demo sends audio/webm)
  • timezone (string, optional) – IANA timezone name

In this mode the server transcribes the audio first and uses the transcription text as the prompt.

Example:

curl -sS \
  -F 'audio=@command.webm' \
  -F 'timezone=Europe/Helsinki' \
  http://localhost:3000/api/v1/client

Response

On success (HTTP 200):

{
  "answer": "...",
  "toolCalls": 2
}
  • answer (string) – final assistant output
  • toolCalls (number) – total number of tool calls made during the run

Errors

  • 400 – invalid request body (e.g., missing prompt in JSON, invalid timezone)
  • 500 – transcription failures, OpenAI/MCP errors, or unexpected server errors

Errors are returned as JSON:

{
  "message": "..."
}

推荐服务器

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

官方
精选