Employee API MCP Server

Employee API MCP Server

MCP server for querying employee data via tools like get_employees and get_employee_by_id. Serves as a proof-of-concept for integrating Pega applications with AI agents.

Category
访问服务器

README

Employee REST API + MCP Server POC

A proof-of-concept Node.js application that exposes Employee data through:

  • A traditional REST API
  • An MCP (Model Context Protocol) server
  • MCP Streamable HTTP transport
  • A public Render deployment

The long-term goal of this project is to explore integration between Pega applications, AI agents, and MCP-based tools.


Project Goal

Build a simple Employee REST API, expose Employee operations as MCP tools, deploy the application publicly, and prepare the architecture for future Pega integration.


Architecture

                    ┌─────────────────────┐
                    │    MCP Client       │
                    │  AI Agent / Pega    │
                    └──────────┬──────────┘
                               │
                               │ MCP
                               │ Streamable HTTP
                               ▼
                    ┌─────────────────────┐
                    │     MCP Server      │
                    │                     │
                    │       /mcp          │
                    └──────────┬──────────┘
                               │
                               │ Shared Employee
                               │ Service Functions
                               ▼
                    ┌─────────────────────┐
                    │    Employee Data    │
                    └─────────────────────┘
                               ▲
                               │
                               │ REST
                               │
                    ┌──────────┴──────────┐
                    │   REST API Client   │
                    └─────────────────────┘

Both the REST API and MCP tools run inside the same Node.js/Express application.

The MCP tools reuse the same Employee service functions used by the REST API.

This avoids unnecessary HTTP calls from the MCP server back into the REST API running in the same application.


Technology Stack

  • Node.js
  • Express
  • Model Context Protocol (MCP)
  • MCP TypeScript SDK for JavaScript/Node.js
  • Streamable HTTP transport
  • Zod
  • Git
  • GitHub
  • Render

Project Structure

employee-api/
│
├── server.js
├── mcp-http-server.js
├── mcp-server.js
├── package.json
├── package-lock.json
├── .gitignore
└── README.md

server.js is the current combined application entry point.

The standalone MCP server files are retained as part of the POC development history.


REST API Endpoints

Health / Root Endpoint

GET /

Example:

curl https://employee-api-mcp.onrender.com/

Get All Employees

GET /employees

Example:

curl https://employee-api-mcp.onrender.com/employees

Example response:

[
  {
    "id": 1,
    "name": "Rahul Ghosh",
    "designation": "Junior Developer",
    "department": "CMO"
  },
  {
    "id": 2,
    "name": "Pramathesh Chatterjee",
    "designation": "Senior Developer",
    "department": "CMO"
  },
  {
    "id": 3,
    "name": "Sudipta Biswas",
    "designation": "Lead Developer",
    "department": "CMO"
  }
]

Get Employee By ID

GET /employees/:id

Example:

curl https://employee-api-mcp.onrender.com/employees/2

Example response:

{
  "id": 2,
  "name": "Pramathesh Chatterjee",
  "designation": "Senior Developer",
  "department": "CMO"
}

If the employee does not exist:

{
  "message": "Employee not found"
}

MCP Endpoint

The MCP server is available at:

POST /mcp
GET /mcp
DELETE /mcp

Public endpoint:

https://employee-api-mcp.onrender.com/mcp

The server uses MCP Streamable HTTP transport with session management.

A valid MCP client must initialize a session before discovering or calling tools.


Available MCP Tools

get_employees

Returns all Employees.

Input schema:

{}

Conceptual call:

get_employees()

get_employee_by_id

Returns one Employee using the Employee ID.

Input schema:

{
  "id": "number"
}

Conceptual call:

get_employee_by_id(id: 2)

Running Locally

Clone the repository:

git clone https://github.com/rahulgh033/employee-api-mcp.git

Enter the project directory:

cd employee-api-mcp

Install dependencies:

npm install

Start the application:

npm start

Expected output:

Employee API + MCP Server running on port 3000
REST API: http://localhost:3000/employees
MCP Endpoint: http://localhost:3000/mcp

Local REST API Testing

Test the root endpoint:

curl http://localhost:3000/

Get all Employees:

curl http://localhost:3000/employees

Get one Employee:

curl http://localhost:3000/employees/1

Test an Employee that does not exist:

curl http://localhost:3000/employees/999

MCP Protocol Testing

The deployed MCP server was tested manually using curl.

The test flow was:

initialize
    ↓
Receive MCP Session ID
    ↓
tools/list
    ↓
tools/call
    ↓
get_employees
    ↓
tools/call
    ↓
get_employee_by_id

1. Initialize MCP Session

curl -i -X POST https://employee-api-mcp.onrender.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "capabilities": {},
      "clientInfo": {
        "name": "curl-test-client",
        "version": "1.0.0"
      }
    }
  }'

The server returns an MCP session header:

mcp-session-id: <SESSION_ID>

Save this value for subsequent requests.


2. Discover MCP Tools

Replace <SESSION_ID> with the session ID returned by the initialize request.

curl -i -X POST https://employee-api-mcp.onrender.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "mcp-session-id: <SESSION_ID>" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/list",
    "params": {}
  }'

Expected tools:

get_employees
get_employee_by_id

3. Call get_employees

curl -i -X POST https://employee-api-mcp.onrender.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "mcp-session-id: <SESSION_ID>" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "get_employees",
      "arguments": {}
    }
  }'

The MCP server returns the Employee list as MCP tool content.


4. Call get_employee_by_id

curl -i -X POST https://employee-api-mcp.onrender.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "mcp-session-id: <SESSION_ID>" \
  -d '{
    "jsonrpc": "2.0",
    "id": 4,
    "method": "tools/call",
    "params": {
      "name": "get_employee_by_id",
      "arguments": {
        "id": 2
      }
    }
  }'

Expected MCP tool result:

{
  "id": 2,
  "name": "Pramathesh Chatterjee",
  "designation": "Senior Developer",
  "department": "CMO"
}

MCP Session Lifecycle

The Streamable HTTP server maintains MCP transports using the MCP session ID.

Conceptually:

Client
   │
   │ initialize
   ▼
MCP Server
   │
   │ Create Transport
   │
   │ Generate Session ID
   ▼
Session Store
   │
   │
   ▼
Client receives mcp-session-id
   │
   │ tools/list
   │ tools/call
   │ GET /mcp
   │ DELETE /mcp
   ▼
Existing MCP Transport

Requests without a valid session ID are rejected unless the request is a valid MCP initialize request.


Deployment

The application is deployed as a Render Web Service.

Build command:

npm install

Start command:

npm start

The application listens on:

process.env.PORT || 3000

This allows Render to dynamically assign the service port while retaining port 3000 for local development.


Live Application

REST API:

https://employee-api-mcp.onrender.com/employees

MCP Endpoint:

https://employee-api-mcp.onrender.com/mcp

GitHub Repository:

https://github.com/rahulgh033/employee-api-mcp

Verified POC Capabilities

The following functionality has been successfully tested:

  • Employee REST API running locally
  • Employee lookup by ID
  • Employee not-found handling
  • REST API and MCP server running in one Express application
  • MCP Streamable HTTP transport
  • MCP initialization handshake
  • MCP session creation
  • MCP session reuse
  • MCP tools/list
  • MCP tools/call
  • get_employees MCP tool
  • get_employee_by_id MCP tool
  • Git version control
  • GitHub repository deployment
  • Render cloud deployment
  • Public REST API access
  • Public MCP endpoint access
  • MCP tool execution against the deployed Render service

Current POC Status

Employee REST API          COMPLETE
        ↓
MCP Server                 COMPLETE
        ↓
Streamable HTTP            COMPLETE
        ↓
MCP Tool Discovery         COMPLETE
        ↓
MCP Tool Execution         COMPLETE
        ↓
GitHub Deployment          COMPLETE
        ↓
Render Deployment          COMPLETE
        ↓
Pega Integration           NEXT

Future Improvements

Potential next steps:

  • Add create_employee
  • Add update_employee
  • Add delete_employee
  • Move Employee data to PostgreSQL
  • Add input validation
  • Add automated tests
  • Add structured logging
  • Add authentication and authorization
  • Add rate limiting
  • Add health/readiness endpoints
  • Add MCP Inspector testing
  • Evaluate stateless vs stateful MCP deployment architecture
  • Add persistent/distributed MCP session storage if horizontally scaling
  • Evaluate Pega MCP client capabilities
  • Build a Pega-to-MCP bridge if required
  • Integrate MCP tools with Pega cases, data pages, or agentic workflows

Future Pega Integration

Target architecture:

Pega Application
        ↓
Pega Agent / Integration Layer
        ↓
MCP Client
        ↓
Streamable HTTP
        ↓
Employee MCP Server
        ↓
Employee Service Layer
        ↓
Employee Data

The next phase of this POC is to determine the best integration pattern for Pega to discover and invoke MCP tools.


Author

Rahul Ghosh

GitHub: rahulgh033


Disclaimer

This project is a proof of concept intended for learning, experimentation, and architecture exploration.

The current Employee data is stored in memory and the public MCP endpoint does not implement production-grade authentication, authorization, persistence, or distributed session management.

推荐服务器

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

官方
精选