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 transport
Connect 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 lint
before committing - Update documentation as needed
MIT