SevenRooms MCP Server

SevenRooms MCP Server

Enables restaurant reservation management through SevenRooms API, allowing users to create reservations and query available time slots with guest details and party size information.

Category
访问服务器

README

SevenRooms MCP Server

HTTP-based Model Context Protocol (MCP) server exposing tools and resources for SevenRooms reservations and availability. Uses StreamableHTTPServerTransport (HTTP + SSE) instead of stdio. Built with TypeScript and the official @modelcontextprotocol/sdk.

Features

  • make_reservations tool: Create restaurant reservations with guest details
  • available_time_slot resource: Query available reservation time slots
  • TypeScript + Zod validation
  • Streamable HTTP transport (JSON responses + optional SSE streaming)
  • Ready for Azure App Service deployment via GitHub Actions

Project Structure

src/
  server.ts                         # Main MCP HTTP server (/mcp endpoint)
  tools/makeReservation.ts          # make_reservations tool registration
  resources/available_time_slot.ts  # available_time_slot resource registration
test/                               # Integration tests
.env.example                        # Example environment vars
tsconfig.json
package.json
.github/workflows/azure-deploy.yml  # CI/CD workflow to Azure App Service

Environment Variables

Name Required Description
SEVENROOMS_API_KEY Yes Authentication for SevenRooms API
SEVENROOMS_API_URL Yes Base API URL (e.g. https://api.sevenrooms.com)
PORT Optional Listening port (App Service sets automatically)

Copy .env.example to .env for local use:

SEVENROOMS_API_KEY=your_key_here
SEVENROOMS_API_URL=https://api.sevenrooms.com

Local Development

npm install
npm run build
npm start              # starts HTTP server on PORT (default 3000)
# or
npm run start:dev      # tsx live-reload

Server endpoints:

  • POST /mcp – JSON-RPC MCP requests (initialize, tools/list, resources/list, tools/call, etc.)
  • GET /mcp – SSE stream (if using streaming scenarios)
  • DELETE /mcp – Close session (stateful mode; stateless here so optional)
  • GET /health – Simple health probe

Sample Initialize Request

curl -X POST http://localhost:3000/mcp \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"initialize",
    "params":{
      "protocolVersion":"1.0",
      "clientInfo":{"name":"local-client","version":"1.0"},
      "capabilities":{}
    }
  }'

List Tools

curl -X POST http://localhost:3000/mcp \
  -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

Call make_reservations Tool (example)

curl -X POST http://localhost:3000/mcp \
  -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "id":3,
    "method":"tools/call",
    "params":{
      "name":"make_reservations",
      "arguments":{
        "date":"2025-12-20",
        "time":"19:00",
        "party_size":2,
        "first_name":"Jane",
        "last_name":"Doe",
        "email":"jane@example.com",
        "phone":"+15555550123"
      }
    }
  }'

Tools & Resources Details

Tool: make_reservations

Input fields:

date, time, party_size, first_name, last_name, email, phone

Returns success or detailed error text from SevenRooms API.

Resource: available_time_slot

URI format:

available://YYYY-MM-DD/HH:MM/party_size

Returns JSON: { "available_times": ["18:00", "18:30", ...] } filtered for entries where type === 'book.

SevenRooms API Endpoints Used

  • Reservations: POST {SEVENROOMS_API_URL}/reservations
  • Availability: GET {SEVENROOMS_API_URL}/availability with query params date, time, party_size

Adjust endpoint paths if your SevenRooms account differs.

Azure App Service Deployment

1. Create Azure Resources (CLI Example)

az group create -n sevenrooms-rg -l eastus
az appservice plan create -g sevenrooms-rg -n sevenrooms-plan --sku B1 --is-linux
az webapp create -g sevenrooms-rg -p sevenrooms-plan -n <WEBAPP_NAME> --runtime "NODE:18-lts"

2. Configure App Settings

az webapp config appsettings set -g sevenrooms-rg -n <WEBAPP_NAME> --settings \
  SEVENROOMS_API_KEY="<secret>" \
  SEVENROOMS_API_URL="https://api.sevenrooms.com"

Azure injects PORT automatically; do not hardcode it unless needed.

3. GitHub Secrets

Add in repo Settings → Actions → Secrets:

  • AZURE_WEBAPP_NAME = <WEBAPP_NAME>
  • AZURE_WEBAPP_PUBLISH_PROFILE = publish profile XML pasted verbatim

4. Workflow (azure-deploy.yml)

Steps: checkout, setup Node + cache, install (skip if cache hit), test, build, list build output, deploy.

5. Verify Deployment

curl https://<WEBAPP_NAME>.azurewebsites.net/health
curl -X POST https://<WEBAPP_NAME>.azurewebsites.net/mcp \
  -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"1.0","clientInfo":{"name":"remote","version":"1.0"},"capabilities":{}}}'

Logging & Observability

  • Use console.error() for server logs (stderr captured by App Service).
  • Add Application Insights: set APPINSIGHTS_INSTRUMENTATIONKEY or connection string.
  • Consider structured logging (JSON) for easier analysis.

Troubleshooting

Issue Cause Fix
404 /mcp Build missing or wrong start path Ensure npm run build and start uses node build/server.js
500 SevenRooms errors Invalid API key or payload Verify env vars & input fields
Timeout Low SKU or network latency Increase plan size / adjust retry
Not Acceptable Missing Accept header Use Accept: application/json (JSON-only enabled)
Capabilities error Missing capabilities in initialize Include "capabilities":{}

Production Recommendations

  • Use at least B1 plan; scale out based on CPU or HTTP queue length.
  • Restrict ingress with Access Restrictions or Front Door.
  • Rotate SEVENROOMS_API_KEY regularly.
  • Implement retries for transient SevenRooms failures (429, 5xx).
  • Add rate limiting if exposed publicly.

Contributing

  1. Branch from main
  2. Implement changes in src/
  3. npm test && npm run build
  4. PR and merge to trigger deployment

License

MIT (update as needed).

References

  • MCP Docs: https://modelcontextprotocol.io/
  • SDK Repo: https://github.com/modelcontextprotocol/typescript-sdk
  • SevenRooms API Docs: (refer to account-specific portal)

SevenRooms MCP Server

A Model Context Protocol (MCP) server for managing restaurant reservations with SevenRooms. Built according to the MCP specification using TypeScript and the official @modelcontextprotocol/sdk.

Features

  • make_reservations Tool: Create restaurant reservations with guest details
  • available_time_slot Resource: Query available reservation time slots
  • Fully typed with TypeScript and Zod validation
  • STDIO-based communication for seamless MCP integration
  • Azure App Service deployment ready

Project Structure

src/
  index.ts          # Main MCP server with tools and resources
test/
  makeReservation.test.js   # Unit tests for make_reservations tool
  availableTimeSlot.test.js # Unit tests for available_time_slot resource
.env.example        # Example environment variables
tsconfig.json       # TypeScript configuration
package.json        # Project dependencies and scripts
.github/
  workflows/
    azure-deploy.yml # GitHub Actions CI/CD workflow

Prerequisites

  • Node.js >= 16
  • npm
  • SevenRooms API key and base URL

Local Development

1. Install Dependencies

npm install

2. Configure Environment Variables

Copy .env.example to .env and fill in your SevenRooms credentials:

cp .env.example .env

Then edit .env:

SEVENROOMS_API_KEY=your_sevenrooms_api_key_here
SEVENROOMS_API_URL=https://api.sevenrooms.com

3. Build the Server

npm run build

This compiles TypeScript to JavaScript in the build/ directory.

4. Run Tests

npm test

Expected output:

  available_time_slot resource
    ✓ throws when required fields missing
    ✓ returns only times with type == "book"

  make_reservations tool
    ✓ throws when required fields missing
    ✓ calls SevenRooms reservations endpoint and returns data

  4 passing

5. Start the Server

For production:

npm start

For development with auto-reload:

npm run start:dev

The server will start on stdio, ready for MCP clients to connect.

MCP Tools & Resources

Tool: make_reservations

Makes a reservation at a restaurant through SevenRooms.

Input Schema:

{
  "date": "YYYY-MM-DD (e.g., 2025-12-25)",
  "time": "HH:MM (e.g., 19:00)",
  "party_size": 4,
  "first_name": "John",
  "last_name": "Doe",
  "email": "john@example.com",
  "phone": "555-1234"
}

Response: Returns the SevenRooms API response with reservation confirmation details (ID, status, etc.).

Resource: available_time_slot

Queries available reservation time slots for a given date, time, and party size.

URI Format:

available://YYYY-MM-DD/HH:MM/party_size

Example:

available://2025-12-25/19:00/4

Response:

{
  "available_times": ["18:00", "18:30", "19:00", "19:30"]
}

The resource automatically filters to only include times where type === 'book' from the SevenRooms availability API.

SevenRooms API Integration

The server calls the following SevenRooms endpoints:

Reservations Endpoint

  • URL: {SEVENROOMS_API_URL}/reservations
  • Method: POST
  • Auth: Bearer token in Authorization header
  • Payload:
    {
      "datetime": "2025-12-25T19:00",
      "party_size": 4,
      "guest": {
        "first_name": "John",
        "last_name": "Doe",
        "email": "john@example.com",
        "phone": "555-1234"
      }
    }
    

Availability Endpoint

  • URL: {SEVENROOMS_API_URL}/availability
  • Method: GET
  • Auth: Bearer token in Authorization header
  • Query Params: date, time, party_size

Note: Adjust endpoints and request payloads if your SevenRooms API account requires different paths or authentication methods.

Testing

The project includes unit tests using Mocha, Chai, and Nock (for HTTP mocking).

Run tests:

npm test

Tests cover:

  • Input validation for both tool and resource
  • Mocked SevenRooms API responses
  • Filtering logic for available time slots (type === 'book')

Azure Deployment

Prerequisites

  1. Azure App Service instance
  2. GitHub repository with this code
  3. Azure publish profile exported

Setup Steps

  1. Create Azure App Service

    • Create a new Web App (Node.js 18 LTS or later)
    • Copy the publish profile XML
  2. Configure GitHub Secrets

    • In your GitHub repository, go to Settings → Secrets and variables → Actions
    • Add these secrets:
      • AZURE_WEBAPP_NAME — The name of your Azure Web App
      • AZURE_WEBAPP_PUBLISH_PROFILE — The publish profile XML content
  3. Set App Service Configuration

    • In Azure portal, go to your App Service → Configuration
    • Add these application settings:
      • SEVENROOMS_API_KEY — Your SevenRooms API key
      • SEVENROOMS_API_URL — Your SevenRooms API base URL (e.g., https://api.sevenrooms.com)
      • PORT — Leave blank to auto-bind (Azure sets this automatically)
  4. Deploy

    • Push to main branch
    • GitHub Actions workflow runs automatically
    • Deployment proceeds to Azure App Service

The workflow is defined in .github/workflows/azure-deploy.yml and:

  • Checks out the code
  • Installs dependencies
  • Builds the TypeScript
  • Deploys using the publish profile

Verify Deployment

After deployment, you can:

  • Check the App Service activity log in Azure portal
  • Review GitHub Actions workflow run logs on GitHub
  • Test the server by connecting via MCP client pointing to the deployed instance

Logging

Important: The MCP server uses stdio for communication, so logging is restricted:

  • ✅ Use console.error() for logging (writes to stderr, safe for STDIO-based MCP)
  • ❌ Never use console.log() (writes to stdout, corrupts MCP JSON-RPC messages)

For production, consider:

  • Redirecting logs to Application Insights via Azure SDK
  • Using structured logging libraries that write to stderr
  • Checking Azure App Service logs in the Azure portal

Troubleshooting

"Cannot find module '@modelcontextprotocol/sdk'"

  • Run npm install to ensure all dependencies are installed
  • Check that @modelcontextprotocol/sdk is in package.json dependencies

Build errors (TypeScript)

  • Ensure Node.js >= 16 is installed
  • Delete build/ and node_modules/ and reinstall: npm install && npm run build

Tests failing

  • Ensure .env file exists (even if empty) or set env vars in your shell before running tests
  • Check that nock mocks match your actual SevenRooms API requests

Server not connecting as MCP client

  • Ensure the server runs without throwing errors: npm start (should print to stderr)
  • Verify the MCP client is correctly configured to call the server

Contributing

  1. Make changes to src/index.ts
  2. Run tests: npm test
  3. Build: npm run build
  4. Commit and push to trigger CI/CD

License

MIT

References

推荐服务器

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

官方
精选