|
| 1 | +# IFLOW.md |
| 2 | + |
| 3 | +This file provides guidance to iFlow Cli when working with code in this repository. |
| 4 | + |
| 5 | +## Common Commands |
| 6 | + |
| 7 | +### Building |
| 8 | +- `npm run build` - Compiles TypeScript code to JavaScript in the `dist` directory |
| 9 | +- `npm run watch` - Continuously watches and compiles TypeScript files |
| 10 | + |
| 11 | +### Running |
| 12 | +- `npm start` - Runs the compiled server from `dist/index.js` in stdio mode |
| 13 | +- `npm run start:sse` - Runs the compiled server from `dist/index.js` in SSE mode |
| 14 | + |
| 15 | +### Development |
| 16 | +- Use `npm run watch` during development for automatic recompilation |
| 17 | +- The server entry point is `index.ts` which exports all functionality as an MCP server |
| 18 | +- To run in SSE mode during development: `node dist/index.js --sse` |
| 19 | + |
| 20 | +## Architecture Overview |
| 21 | + |
| 22 | +This is an MCP (Model Context Protocol) server implementation that provides AI assistants with the ability to interact with Alibaba Cloud DevOps (Yunxiao) platform. |
| 23 | + |
| 24 | +The server is structured into several modules: |
| 25 | + |
| 26 | +1. **Core Entry Point** (`index.ts`): |
| 27 | + - Initializes the MCP server |
| 28 | + - Registers all available tools |
| 29 | + - Handles tool requests and maps them to appropriate functions |
| 30 | + - Supports both stdio and SSE transports |
| 31 | + |
| 32 | +2. **Operations Modules** (in `operations/` directory): |
| 33 | + - `codeup/` - Contains functions for code repository operations (branches, files, repositories, change requests) |
| 34 | + - `flow/` - Contains functions for pipeline operations and service connections |
| 35 | + - `organization/` - Contains functions for organization and member management |
| 36 | + - `packages/` - Contains functions for package/artifact repository operations |
| 37 | + - `projex/` - Contains functions for project and work item management |
| 38 | + |
| 39 | +3. **Common Modules** (in `common/` directory): |
| 40 | + - `types.ts` - Defines all Zod schemas for input validation |
| 41 | + - `errors.ts` - Custom error handling for Yunxiao API responses |
| 42 | + - `version.ts` - Version information for the server |
| 43 | + |
| 44 | +The server implements a standard MCP server pattern where: |
| 45 | +1. Tools are registered with their schemas in the ListTools handler |
| 46 | +2. Actual tool execution happens in the CallTool handler |
| 47 | +3. Each operation has a dedicated function file that makes API calls to Yunxiao |
| 48 | +4. All inputs are validated using Zod schemas before processing |
| 49 | + |
| 50 | +The server exposes dozens of tools covering: |
| 51 | +- Code repository management (branches, files, repositories) |
| 52 | +- Code review operations (change requests, comments) |
| 53 | +- Project management (projects, work items, work item types) |
| 54 | +- Pipeline management (pipelines, runs, jobs) |
| 55 | +- Package repository management (artifacts, repositories) |
| 56 | +- Organization management (members, departments, roles) |
| 57 | +- Service connections management |
| 58 | + |
| 59 | +## SSE Mode |
| 60 | + |
| 61 | +The server can run in SSE (Server-Sent Events) mode, which allows it to be accessed over HTTP instead of stdio. This is useful when deploying the server as a remote service. |
| 62 | + |
| 63 | +To run in SSE mode: |
| 64 | +1. Use `npm run start:sse` or `node dist/index.js --sse` |
| 65 | +2. The server will start an HTTP server on port 3000 (configurable with PORT environment variable) |
| 66 | +3. Clients can connect via SSE at `http://localhost:3000/sse` |
| 67 | +4. Messages are sent to `http://localhost:3000/messages?sessionId=<session-id>` |
| 68 | + |
| 69 | +In SSE mode, the server maintains sessions for each connected client, allowing for proper request/response correlation. |
0 commit comments