About TypeScript MCP Server
A TypeScript and Express MCP server for payroll and employee data, with API authentication and SSE communication. It includes an example client for testing its resources, tools, and prompt.
Key features
- 01Payroll calculation
- 02Employee lookup and listing
- 03Greeting and user resources
- 04API and partner authentication
- 05SSE communication
- 06Example client
Use cases
- 01Calculate an employee’s gross pay, tax, and net pay
- 02Look up employee information by ID
- 03Browse people with filters and pagination
MCP support
Exposes payroll and employee tools, greeting and user resources, and an ask-question prompt to MCP clients. Clients communicate through the SSE and messages endpoints.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMETypeScript MCP Server
A Model Context Protocol (MCP) server implementation using TypeScript and Express for payroll management.
What is MCP?
The Model Context Protocol (MCP) enables AI models to interact with external systems in a standardized way. It provides a framework for defining resources, tools, and prompts that LLMs can use to perform tasks.
For more information, visit the Model Context Protocol repository.
Features
- Implements the MCP protocol for LLM interactions
- Provides payroll management tools and employee information access
- Uses Express for HTTP handling
- Supports Server-Sent Events (SSE) for real-time communication
- Includes a client example for testing
Requirements
- Node.js 18+
- npm or yarn
Installation
- Clone the repository
- Install dependencies:
npm install
- Create a
.envfile based on the.env.exampletemplate:
cp .env.example .env
- Update the
.envfile with your API configuration:
# API configuration
BASE_URL=http://app.localopfin.com
PORT=8089
Running the Server
Start the development server with:
npm run dev
For production:
npm run build
npm start
The server will run on port 8089 by default. You can change this by setting the PORT environment variable in the .env file.
Authentication
This server supports two authentication methods for API requests:
- API authentication using authId and authKey
- Partner authentication using partnerKey and clientKey
For custom authentication needs, you can modify the src/api.ts file.
API Endpoints
GET /sse: Server-Sent Events endpoint for MCP communicationPOST /messages: Endpoint for clients to send messages to the MCP server
Available Resources
greeting://welcome: A static welcome messageusers://{userId}: A dynamic resource that returns user data
Available Tools
view-people: View information about a specific person using employee ID (requires authId and authKey authentication)view-all-people: View all people with optional filtering and pagination (supports both API authentication with authId/authKey or Partner authentication with partnerKey/clientKey)getEmployeeInfo: A simplified employee information retrieval tool that returns basic employee data (name, department, role) based on employee IDcalculatePayroll: Calculate payroll for an employee based on hours worked and hourly rate (computes gross pay, 20% tax, and net pay)
Available Interfaces
The project includes typed interfaces for API responses:
ApiResponse<T>: Generic API response wrapper with data, error, and status fieldsApiConfig: Configuration for API client with baseUrl and optional headersApiCredentials: For API-based authentication with authId and authKeyPartnerCredentials: For partner-based authentication with partnerKey and clientKey
These interfaces help ensure type safety when working with API data.
Available Prompts
ask-question: A prompt template for asking questions
Testing with the Example Client
The repository includes an example client that demonstrates how to connect to the MCP server and use its resources, tools, and prompts.
To run the example client (with the server already running):
npm run client
This will:
- Connect to the MCP server
- List available resources, tools, and prompts
- Read the greeting resource
- Use the available tools
- Get the ask-question prompt
Usage with LLMs
This MCP server can be used with LLM clients that support the MCP protocol. Refer to the MCP documentation for information on how to connect LLM clients to this server.
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.