A comprehensive Model Context Protocol (MCP) server built with TypeScript that provides Tools, Resources, and Prompts for Flow API integration. Supports both STDIO and HTTP/SSE transports.
- β Tools - 8 Flow API operations (start flows, get status, complete tasks, etc.)
- β
Resources - Real-time flow state data via
flow://flows/{flowId}URIs - β Prompts - Friendly loan advisor with personality and humor
- β Dual Transports - STDIO for CLI tools, HTTP/SSE for web applications
- Start and manage loan application flows
- Retrieve flow status and task information
- Complete tasks with validation
- Access flow and task schemas
- Monitor API health status
-
Install dependencies:
npm install
-
Start the server:
# STDIO server (for CLI MCP clients) npm run dev # HTTP server (for web applications) npm run dev:http # Runs on http://localhost:3003
-
Test the HTTP server:
curl http://localhost:3003/health
// Start a loan application flow
{
"name": "start_flow",
"arguments": {
"flowDefinition": "loan-application",
"applicant": { "nin": "12345678901" },
"loanPurpose": "PURCHASE",
"loanAmount": 500000
}
}
// Get flow status
{
"name": "get_flow_status",
"arguments": { "flowId": "flow-123" }
}// Access flow state data
URI: "flow://flows/flow-123"
// Returns comprehensive flow information as JSON// Get friendly loan advice
{
"name": "loan-advisor",
"arguments": {
"customerType": "individual",
"loanAmount": 500000,
"loanPurpose": "PURCHASE"
}
}
// Returns: "π Welcome to the magical world of loans! ..."npm run dev- STDIO server with auto-reloadnpm run dev:http- HTTP server with auto-reloadnpm run build- Build TypeScript to JavaScriptnpm run start- Production STDIO servernpm run start:http- Production HTTP servernpm run typecheck- TypeScript type checkingnpm run lint- ESLint code analysisnpm run lint:fix- Auto-fix linting issues
src/
βββ server.ts # STDIO MCP server
βββ http-server.ts # HTTP/SSE MCP server
βββ flow-client.ts # Flow API client
βββ types.ts # TypeScript definitions
βββ __tests__/ # Comprehensive test suite
npm test- Run all testsnpm run test:watch- Watch modenpm run test:coverage- Coverage report
- β HTTP server functionality - Endpoints, CORS, sessions
- β MCP protocol compliance - JSON-RPC 2.0, capabilities
- β Tools/Resources/Prompts - Schema validation, execution
- β Error handling - Edge cases, API failures
- β Integration testing - End-to-end workflows
- β Performance & security - Load testing, validation
- For command-line MCP clients
- Direct process communication
- Used by tools like Claude Desktop
- For web applications and HTTP clients
- Server-Sent Events for real-time updates
- RESTful endpoints with CORS support
- Runs on port 3003 (configurable)
The server connects to Flow API at:
- Base URL:
https://api.dev-2r.in.staccflow.com - Timeout: 30 seconds
- Authentication: API key based
Configure your MCP client to run:
npm run start # STDIO transportConnect to HTTP endpoints:
- SSE:
GET http://localhost:3003/sse - Messages:
POST http://localhost:3003/message - Health:
GET http://localhost:3003/health
- Follow TypeScript best practices
- Add tests for new features
- Run
npm run lintbefore committing - Update documentation as needed
MIT