# java-mcp-server **Repository Path**: easycallcenter365/java-mcp-server ## Basic Information - **Project Name**: java-mcp-server - **Description**: java实现的mcp server - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2026-08-25 - **Last Updated**: 2026-09-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Cal.com MCP Server (Java) A Java 8 port of [`@calcom/cal-mcp`](https://github.com/calcom/cal-mcp) — a Model Context Protocol (MCP) server exposing the Cal.com scheduling API as LLM-callable tools. ## Features - **Java 8** compatible (bytecode target 1.8). - **MCP transports**: Streamable HTTP **and** Streamable Stateless (single `POST /mcp` JSON endpoint, plus `GET`/`DELETE` for the Streamable HTTP session lifecycle and an optional `Accept: text/event-stream` SSE response). No SSE/stdio legacy transport. - **167 Cal.com API tools** derived from the same `tools.json` the Node server uses, with identical tool selection/naming rules. - Default selection limited to 9 core tools (see below); `--all-tools` exposes all 167. ## Requirements - Java 8+ (JDK 8 to run; the shaded jar is compiled to Java 8 bytecode). - A Cal.com API key (`CAL_API_KEY` / `-Dcal.apiKey`). ## Build ```bash mvn -o clean package # omit -o if you have network access ``` Produces `target/cal-mcp-java.jar` (shaded, self-contained). ## Run ```bash CAL_API_KEY= java -jar target/cal-mcp-java.jar # or java -Dcal.apiKey= -jar target/cal-mcp-java.jar # options java -jar target/cal-mcp-java.jar --all-tools --port 8080 ``` | Option / env | Meaning | | --------------------- | ------------------------------------------------ | | `--port` / `PORT` / `-Dcal.port` | HTTP listen port (default `8080`) | | `--all-tools` / `-a` | Expose all 167 tools (default: 9 core tools) | | `CAL_API_KEY` / `-Dcal.apiKey` | Cal.com bearer API key (injected as `Authorization: Bearer ...`) | ## MCP endpoint - `POST http://host:port/mcp` — JSON-RPC over HTTP (both Streamable HTTP and Streamable Stateless clients). - `GET /mcp` (with `Accept: text/event-stream`) — opens an SSE stream for server-initiated messages (Streamable HTTP). - `DELETE /mcp` — session termination (stateless server: no-op, returns 200). ### Protocol support `initialize`, `ping`, `tools/list`, `tools/call`, and notifications (`notifications/initialized`, etc.). Protocol version `2024-11-05`. ## Default tools `getBooking`, `getBookings`, `createBooking`, `rescheduleBooking`, `cancelBooking`, `getEventTypes`, `getEventTypeById`, `updateEventType`, `deleteEventType`. ## Project layout ``` src/main/java/com/calcom/mcp/ Main.java entry point / arg parsing McpHttpServer.java com.sun.net.httpserver based Streamable HTTP server McpRequestHandler.java JSON-RPC dispatch (initialize/ping/tools/*) ToolRegistry.java loads tools.json, applies selection + builds inputSchema ApiInvoker.java executes Cal.com API calls via Apache HttpClient Tool.java tool model src/main/resources/tools.json tool definitions (from the Node server) ``` Dependencies (fully offline-buildable, bundled into the shaded jar): - `jackson-databind` 2.17.0 (JSON) - `httpclient` 4.5.13 (outbound Cal.com calls) - JDK built-in `com.sun.net.httpserver.HttpServer` (HTTP server) ## API Manual 本地测试地址:http://127.0.0.1:8080/mcp {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"manual-test","version":"1.0"}}} # 获取函数列表 {"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}} # 获取所有可预约的项目列表 {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"getEventTypes","arguments":{}}} #获取全部已预订的订单列表 {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"getBookings","arguments":{}}} #提交预定,start字段使用UTC时间格式,实际使用需要把北京时间减去8小时; {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"createBooking","arguments":{"body":{"eventTypeId":123,"start":"2026-08-25T09:00:00Z","attendee":{"name":"Zhang Wei","email":"zhangwei@example.com","timeZone":"Asia/Shanghai"}}}}} {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"createBooking","arguments":{"body":{"eventTypeId":6665708,"start":"2026-08-20T17:00:00Z","attendee":{"name":"x zhaohai green","email":"15005622236@example.com","timeZone":"Asia/Shanghai"}}}}} #取消预定,需要先 查询预定,获取uid {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"cancelBooking","arguments":{"params":{"bookingUid":"9TB9d1QrMkmwbJzu466Gxa"},"body":{"cancellationReason":"客户临时取消,电话告知"}}}}} # 根据邮件地址查询有效预定 {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"getBookings","arguments":{"params":{"attendeeEmail":"150056222370x2@example.com","status":"upcoming"}}}}