@orchestrator-claude/mcp-server 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mcp.json.example +11 -0
- package/README.md +180 -0
- package/dist/client/OrchestratorApiClient.d.ts +35 -0
- package/dist/client/OrchestratorApiClient.d.ts.map +1 -0
- package/dist/client/OrchestratorApiClient.js +121 -0
- package/dist/client/OrchestratorApiClient.js.map +1 -0
- package/dist/client/index.d.ts +8 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +26 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +7 -0
- package/dist/client/types.js.map +1 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -0
- package/dist/errors/McpApiError.d.ts +23 -0
- package/dist/errors/McpApiError.d.ts.map +1 -0
- package/dist/errors/McpApiError.js +27 -0
- package/dist/errors/McpApiError.js.map +1 -0
- package/dist/handlers/context-handlers.d.ts +64 -0
- package/dist/handlers/context-handlers.d.ts.map +1 -0
- package/dist/handlers/context-handlers.js +67 -0
- package/dist/handlers/context-handlers.js.map +1 -0
- package/dist/handlers/gate-handlers.d.ts +63 -0
- package/dist/handlers/gate-handlers.d.ts.map +1 -0
- package/dist/handlers/gate-handlers.js +67 -0
- package/dist/handlers/gate-handlers.js.map +1 -0
- package/dist/handlers/index.d.ts +15 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +241 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/metrics-handlers.d.ts +84 -0
- package/dist/handlers/metrics-handlers.d.ts.map +1 -0
- package/dist/handlers/metrics-handlers.js +87 -0
- package/dist/handlers/metrics-handlers.js.map +1 -0
- package/dist/handlers/pending-action-handlers.d.ts +81 -0
- package/dist/handlers/pending-action-handlers.d.ts.map +1 -0
- package/dist/handlers/pending-action-handlers.js +87 -0
- package/dist/handlers/pending-action-handlers.js.map +1 -0
- package/dist/handlers/workflow-handlers.d.ts +80 -0
- package/dist/handlers/workflow-handlers.d.ts.map +1 -0
- package/dist/handlers/workflow-handlers.js +87 -0
- package/dist/handlers/workflow-handlers.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +51 -0
- package/dist/server.js.map +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# @orchestrator/mcp-server
|
|
2
|
+
|
|
3
|
+
> MCP server for Orchestrator - thin client forwarding to REST API
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides an MCP (Model Context Protocol) server that exposes Orchestrator functionality to Claude Code and other MCP-compatible clients.
|
|
8
|
+
|
|
9
|
+
**Architecture**: This is a **thin client** that forwards all requests to the Orchestrator REST API. It contains NO business logic, only request transformation and error handling.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
### Global Installation (Recommended)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @orchestrator/mcp-server
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Local Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @orchestrator/mcp-server
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
### Prerequisites
|
|
28
|
+
|
|
29
|
+
1. **REST API Server Running**: The MCP server requires the Orchestrator REST API to be running.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Start API server (in main orchestrator project)
|
|
33
|
+
docker-compose up -d
|
|
34
|
+
# OR
|
|
35
|
+
npm start
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. **API Key**: Generate an API key using the CLI:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
orchestrator auth generate
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This creates `~/.orchestrator/config.json` with your API key.
|
|
45
|
+
|
|
46
|
+
### Claude Code Integration
|
|
47
|
+
|
|
48
|
+
Add to your Claude Code config (`.mcp.json` or Claude settings):
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"orchestrator": {
|
|
54
|
+
"command": "orchestrator-mcp-server"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Environment Variables
|
|
61
|
+
|
|
62
|
+
- `MCP_DEBUG=true` - Enable debug logging
|
|
63
|
+
- `ORCHESTRATOR_API_URL` - Override API URL (default: `http://localhost:3000`)
|
|
64
|
+
|
|
65
|
+
## Available Tools
|
|
66
|
+
|
|
67
|
+
### Workflow Management
|
|
68
|
+
|
|
69
|
+
- `getStatus` - Get workflow status
|
|
70
|
+
- `advancePhase` - Advance workflow to next phase
|
|
71
|
+
- `approveAction` - Approve pending action
|
|
72
|
+
- `getContext` (v2) - Get workflow context and available actions
|
|
73
|
+
- `executeAction` (v2) - Execute deterministic action
|
|
74
|
+
|
|
75
|
+
### Project Management
|
|
76
|
+
|
|
77
|
+
- `detectWorkflow` - Detect workflow type from prompt
|
|
78
|
+
- `validateArtifact` - Validate generated artifacts
|
|
79
|
+
- `createCheckpoint` - Create git checkpoint
|
|
80
|
+
|
|
81
|
+
### Ping-Pong Pattern (LIM-001 Solution)
|
|
82
|
+
|
|
83
|
+
- `getNextAction` - Get next pending action
|
|
84
|
+
- `setPendingAction` - Set pending action for agent invocation
|
|
85
|
+
- `clearPendingAction` - Clear pending action
|
|
86
|
+
- `approveAction` - Approve action requiring human approval
|
|
87
|
+
|
|
88
|
+
## Architecture
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Claude Code
|
|
92
|
+
↓
|
|
93
|
+
MCP Server (thin client)
|
|
94
|
+
↓
|
|
95
|
+
REST API (business logic)
|
|
96
|
+
↓
|
|
97
|
+
Domain/Application/Infrastructure Layers
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Key Principles:**
|
|
101
|
+
|
|
102
|
+
1. **No Business Logic**: All logic resides in REST API
|
|
103
|
+
2. **Stateless**: No state stored in MCP server
|
|
104
|
+
3. **Simple Transformation**: Request → API Call → Response
|
|
105
|
+
4. **Error Forwarding**: API errors forwarded to Claude
|
|
106
|
+
|
|
107
|
+
## Development
|
|
108
|
+
|
|
109
|
+
### Building
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm run build
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Testing
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm test
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Running Locally
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# With debug logging
|
|
125
|
+
MCP_DEBUG=true npm start
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Troubleshooting
|
|
129
|
+
|
|
130
|
+
### "API server unavailable"
|
|
131
|
+
|
|
132
|
+
1. Check if REST API is running:
|
|
133
|
+
```bash
|
|
134
|
+
curl http://localhost:3000/api/v1/health
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
2. Check if API key is configured:
|
|
138
|
+
```bash
|
|
139
|
+
cat ~/.orchestrator/config.json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
3. Regenerate API key if needed:
|
|
143
|
+
```bash
|
|
144
|
+
orchestrator auth generate
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### "API key not configured"
|
|
148
|
+
|
|
149
|
+
Run:
|
|
150
|
+
```bash
|
|
151
|
+
orchestrator auth generate
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### MCP Server Not Found in Claude
|
|
155
|
+
|
|
156
|
+
1. Ensure global installation:
|
|
157
|
+
```bash
|
|
158
|
+
npm list -g @orchestrator/mcp-server
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
2. Restart Claude Code after installing
|
|
162
|
+
|
|
163
|
+
3. Check Claude Code logs for MCP connection errors
|
|
164
|
+
|
|
165
|
+
## Version Compatibility
|
|
166
|
+
|
|
167
|
+
| MCP Server | Orchestrator CLI | REST API |
|
|
168
|
+
|------------|------------------|----------|
|
|
169
|
+
| 0.9.x | >= 0.9.0 | >= 0.9.0 |
|
|
170
|
+
| 1.0.x | >= 1.0.0 | >= 1.0.0 |
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
|
175
|
+
|
|
176
|
+
## Support
|
|
177
|
+
|
|
178
|
+
- [Documentation](https://docs.orchestrator.ai)
|
|
179
|
+
- [GitHub Issues](https://github.com/your-org/orchestrator/issues)
|
|
180
|
+
- [Discord Community](https://discord.gg/orchestrator)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OrchestratorApiClient
|
|
3
|
+
*
|
|
4
|
+
* REST API client that makes HTTP requests to the Orchestrator API.
|
|
5
|
+
* Implements all 18 MCP tool methods.
|
|
6
|
+
*/
|
|
7
|
+
import type { Config } from '../config.js';
|
|
8
|
+
import type { IOrchestratorApiClient } from './types.js';
|
|
9
|
+
export declare class OrchestratorApiClient implements IOrchestratorApiClient {
|
|
10
|
+
private config;
|
|
11
|
+
constructor(config: Config);
|
|
12
|
+
/**
|
|
13
|
+
* Makes HTTP request to API
|
|
14
|
+
*/
|
|
15
|
+
private request;
|
|
16
|
+
detectWorkflow(prompt: string): Promise<unknown>;
|
|
17
|
+
startWorkflow(type: string, prompt: string): Promise<unknown>;
|
|
18
|
+
advancePhase(workflowId: string): Promise<unknown>;
|
|
19
|
+
getStatus(workflowId?: string): Promise<unknown>;
|
|
20
|
+
getContext(workflowId?: string): Promise<unknown>;
|
|
21
|
+
executeAction(workflowId: string, action: string, prompt?: string): Promise<unknown>;
|
|
22
|
+
canAdvance(workflowId: string, targetPhase: string): Promise<unknown>;
|
|
23
|
+
evaluateGate(workflowId: string, targetPhase: string): Promise<unknown>;
|
|
24
|
+
createCheckpoint(workflowId: string, description: string): Promise<unknown>;
|
|
25
|
+
validateArtifact(artifactId: string): Promise<unknown>;
|
|
26
|
+
getNextAction(workflowId?: string): Promise<unknown>;
|
|
27
|
+
setPendingAction(workflowId: string, action: unknown): Promise<unknown>;
|
|
28
|
+
clearPendingAction(workflowId: string, result?: unknown): Promise<unknown>;
|
|
29
|
+
approveAction(workflowId: string): Promise<unknown>;
|
|
30
|
+
getMetrics(workflowId?: string): Promise<unknown>;
|
|
31
|
+
getInvocations(workflowId?: string, limit?: number): Promise<unknown>;
|
|
32
|
+
startAgentInvocation(agentName: string, phase: string, workflowId?: string): Promise<unknown>;
|
|
33
|
+
completeAgentInvocation(invocationId: string, status: string, summary?: string): Promise<unknown>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=OrchestratorApiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrchestratorApiClient.d.ts","sourceRoot":"","sources":["../../src/client/OrchestratorApiClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGzD,qBAAa,qBAAsB,YAAW,sBAAsB;IAClE,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAI1B;;OAEG;YACW,OAAO;IAiCf,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIhD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7D,YAAY,CAAC,UAAU,EA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,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC;IAQb,uBAAuB,CAC3B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC;CAOpB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OrchestratorApiClient
|
|
3
|
+
*
|
|
4
|
+
* REST API client that makes HTTP requests to the Orchestrator API.
|
|
5
|
+
* Implements all 18 MCP tool methods.
|
|
6
|
+
*/
|
|
7
|
+
import { McpApiError } from '../errors/McpApiError.js';
|
|
8
|
+
export class OrchestratorApiClient {
|
|
9
|
+
config;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Makes HTTP request to API
|
|
15
|
+
*/
|
|
16
|
+
async request(method, path, body) {
|
|
17
|
+
const url = `${this.config.apiUrl}${path}`;
|
|
18
|
+
const headers = {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
};
|
|
21
|
+
if (this.config.apiKey) {
|
|
22
|
+
headers['X-API-Key'] = this.config.apiKey;
|
|
23
|
+
}
|
|
24
|
+
const response = await fetch(url, {
|
|
25
|
+
method,
|
|
26
|
+
headers,
|
|
27
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
28
|
+
signal: AbortSignal.timeout(this.config.timeout),
|
|
29
|
+
});
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
let errorBody = {};
|
|
32
|
+
try {
|
|
33
|
+
errorBody = (await response.json());
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Ignore JSON parse errors
|
|
37
|
+
}
|
|
38
|
+
throw McpApiError.fromHttpResponse(response.status, errorBody);
|
|
39
|
+
}
|
|
40
|
+
return response.json();
|
|
41
|
+
}
|
|
42
|
+
// Workflow Methods (Part 1)
|
|
43
|
+
async detectWorkflow(prompt) {
|
|
44
|
+
return this.request('POST', '/api/v1/workflows/detect', { prompt });
|
|
45
|
+
}
|
|
46
|
+
async startWorkflow(type, prompt) {
|
|
47
|
+
return this.request('POST', '/api/v1/workflows', { type, prompt });
|
|
48
|
+
}
|
|
49
|
+
async advancePhase(workflowId) {
|
|
50
|
+
return this.request('PUT', `/api/v1/workflows/${workflowId}/advance`, {});
|
|
51
|
+
}
|
|
52
|
+
async getStatus(workflowId) {
|
|
53
|
+
if (workflowId) {
|
|
54
|
+
return this.request('GET', `/api/v1/workflows/${workflowId}/status`);
|
|
55
|
+
}
|
|
56
|
+
return this.request('GET', '/api/v1/workflows/status');
|
|
57
|
+
}
|
|
58
|
+
async getContext(workflowId) {
|
|
59
|
+
const id = workflowId || 'active';
|
|
60
|
+
return this.request('GET', `/api/v1/workflows/${id}/context`);
|
|
61
|
+
}
|
|
62
|
+
async executeAction(workflowId, action, prompt) {
|
|
63
|
+
const body = { action };
|
|
64
|
+
if (prompt) {
|
|
65
|
+
body.prompt = prompt;
|
|
66
|
+
}
|
|
67
|
+
return this.request('POST', `/api/v1/workflows/${workflowId}/action`, body);
|
|
68
|
+
}
|
|
69
|
+
async canAdvance(workflowId, targetPhase) {
|
|
70
|
+
return this.request('GET', `/api/v1/workflows/${workflowId}/can-advance?targetPhase=${encodeURIComponent(targetPhase)}`);
|
|
71
|
+
}
|
|
72
|
+
// Gate & Checkpoint Methods (Part 2)
|
|
73
|
+
async evaluateGate(workflowId, targetPhase) {
|
|
74
|
+
return this.request('POST', `/api/v1/workflows/${workflowId}/gate`, { targetPhase });
|
|
75
|
+
}
|
|
76
|
+
async createCheckpoint(workflowId, description) {
|
|
77
|
+
return this.request('POST', `/api/v1/workflows/${workflowId}/checkpoint`, { description });
|
|
78
|
+
}
|
|
79
|
+
async validateArtifact(artifactId) {
|
|
80
|
+
return this.request('POST', `/api/v1/artifacts/${artifactId}/validate`, {});
|
|
81
|
+
}
|
|
82
|
+
// Pending Action Methods (Part 2)
|
|
83
|
+
async getNextAction(workflowId) {
|
|
84
|
+
const id = workflowId || 'active';
|
|
85
|
+
return this.request('GET', `/api/v1/workflows/${id}/pending-action`);
|
|
86
|
+
}
|
|
87
|
+
async setPendingAction(workflowId, action) {
|
|
88
|
+
return this.request('POST', `/api/v1/workflows/${workflowId}/pending-action`, action);
|
|
89
|
+
}
|
|
90
|
+
async clearPendingAction(workflowId, result) {
|
|
91
|
+
return this.request('DELETE', `/api/v1/workflows/${workflowId}/pending-action`, result);
|
|
92
|
+
}
|
|
93
|
+
async approveAction(workflowId) {
|
|
94
|
+
return this.request('POST', `/api/v1/workflows/${workflowId}/pending-action/approve`, {});
|
|
95
|
+
}
|
|
96
|
+
// Metrics Methods (Part 2)
|
|
97
|
+
async getMetrics(workflowId) {
|
|
98
|
+
const id = workflowId || 'active';
|
|
99
|
+
return this.request('GET', `/api/v1/workflows/${id}/metrics`);
|
|
100
|
+
}
|
|
101
|
+
async getInvocations(workflowId, limit) {
|
|
102
|
+
const id = workflowId || 'active';
|
|
103
|
+
const query = limit ? `?limit=${limit}` : '';
|
|
104
|
+
return this.request('GET', `/api/v1/workflows/${id}/invocations${query}`);
|
|
105
|
+
}
|
|
106
|
+
async startAgentInvocation(agentName, phase, workflowId) {
|
|
107
|
+
const body = { agentName, phase };
|
|
108
|
+
if (workflowId) {
|
|
109
|
+
body.workflowId = workflowId;
|
|
110
|
+
}
|
|
111
|
+
return this.request('POST', '/api/v1/invocations/start', body);
|
|
112
|
+
}
|
|
113
|
+
async completeAgentInvocation(invocationId, status, summary) {
|
|
114
|
+
const body = { status };
|
|
115
|
+
if (summary) {
|
|
116
|
+
body.summary = summary;
|
|
117
|
+
}
|
|
118
|
+
return this.request('POST', `/api/v1/invocations/${invocationId}/complete`, body);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=OrchestratorApiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrchestratorApiClient.js","sourceRoot":"","sources":["../../src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/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the OrchestratorApiClient interface.
|
|
5
|
+
*/
|
|
6
|
+
export interface IOrchestratorApiClient {
|
|
7
|
+
detectWorkflow(prompt: string): Promise<unknown>;
|
|
8
|
+
startWorkflow(type: string, prompt: string): Promise<unknown>;
|
|
9
|
+
advancePhase(workflowId: string): Promise<unknown>;
|
|
10
|
+
getStatus(workflowId?: string): Promise<unknown>;
|
|
11
|
+
getContext(workflowId?: string): Promise<unknown>;
|
|
12
|
+
executeAction(workflowId: string, action: string, prompt?: string): Promise<unknown>;
|
|
13
|
+
canAdvance(workflowId: string, targetPhase: string): Promise<unknown>;
|
|
14
|
+
evaluateGate(workflowId: string, targetPhase: string): Promise<unknown>;
|
|
15
|
+
createCheckpoint(workflowId: string, description: string): Promise<unknown>;
|
|
16
|
+
validateArtifact(artifactId: string): Promise<unknown>;
|
|
17
|
+
getNextAction(workflowId?: string): Promise<unknown>;
|
|
18
|
+
setPendingAction(workflowId: string, action: unknown): Promise<unknown>;
|
|
19
|
+
clearPendingAction(workflowId: string, result?: unknown): Promise<unknown>;
|
|
20
|
+
approveAction(workflowId: string): Promise<unknown>;
|
|
21
|
+
getMetrics(workflowId?: string): Promise<unknown>;
|
|
22
|
+
getInvocations(workflowId?: string, limit?: number): Promise<unknown>;
|
|
23
|
+
startAgentInvocation(agentName: string, phase: string, workflowId?: string): Promise<unknown>;
|
|
24
|
+
completeAgentInvocation(invocationId: string, status: string, summary?: string): Promise<unknown>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,sBAAsB;IAErC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9D,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAGjD,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrF,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAGtE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAGvD,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3E,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAGpD,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9F,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Loads configuration from environment variables.
|
|
5
|
+
*/
|
|
6
|
+
export interface Config {
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
timeout: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function loadConfig(): Config;
|
|
12
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,IAAI,MAAM,CAYnC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Loads configuration from environment variables.
|
|
5
|
+
*/
|
|
6
|
+
export function loadConfig() {
|
|
7
|
+
const apiUrl = process.env.ORCHESTRATOR_API_URL;
|
|
8
|
+
if (!apiUrl) {
|
|
9
|
+
throw new Error('ORCHESTRATOR_API_URL environment variable is required');
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
apiUrl: apiUrl.replace(/\/+$/, ''), // Remove trailing slashes
|
|
13
|
+
apiKey: process.env.ORCHESTRATOR_API_KEY,
|
|
14
|
+
timeout: parseInt(process.env.ORCHESTRATOR_API_TIMEOUT || '30000', 10),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAEhD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,0BAA0B;QAC9D,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;QACxC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,OAAO,EAAE,EAAE,CAAC;KACvE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* McpApiError
|
|
3
|
+
*
|
|
4
|
+
* Custom error class for API errors.
|
|
5
|
+
* Converts HTTP errors to MCP-compatible format.
|
|
6
|
+
*/
|
|
7
|
+
export declare class McpApiError extends Error {
|
|
8
|
+
readonly statusCode: number;
|
|
9
|
+
readonly type?: string | undefined;
|
|
10
|
+
constructor(statusCode: number, message: string, type?: string | undefined);
|
|
11
|
+
static fromHttpResponse(status: number, body: {
|
|
12
|
+
detail?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
}): McpApiError;
|
|
15
|
+
toMcpError(): {
|
|
16
|
+
content: Array<{
|
|
17
|
+
type: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
isError: true;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=McpApiError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpApiError.d.ts","sourceRoot":"","sources":["../../src/errors/McpApiError.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qBAAa,WAAY,SAAQ,KAAK;aAElB,UAAU,EAAE,MAAM;aAElB,IAAI,CAAC,EAAE,MAAM;gBAFb,UAAU,EAAE,MAAM,EAClC,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,YAAA;IAM/B,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,WAAW;IAK9F,UAAU,IAAI;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE;CAMhF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* McpApiError
|
|
3
|
+
*
|
|
4
|
+
* Custom error class for API errors.
|
|
5
|
+
* Converts HTTP errors to MCP-compatible format.
|
|
6
|
+
*/
|
|
7
|
+
export class McpApiError extends Error {
|
|
8
|
+
statusCode;
|
|
9
|
+
type;
|
|
10
|
+
constructor(statusCode, message, type) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.statusCode = statusCode;
|
|
13
|
+
this.type = type;
|
|
14
|
+
this.name = 'McpApiError';
|
|
15
|
+
}
|
|
16
|
+
static fromHttpResponse(status, body) {
|
|
17
|
+
const message = body.detail || `HTTP ${status} error`;
|
|
18
|
+
return new McpApiError(status, message, body.type);
|
|
19
|
+
}
|
|
20
|
+
toMcpError() {
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: 'text', text: `Error (${this.statusCode}): ${this.message}` }],
|
|
23
|
+
isError: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=McpApiError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpApiError.js","sourceRoot":"","sources":["../../src/errors/McpApiError.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAElB;IAEA;IAHlB,YACkB,UAAkB,EAClC,OAAe,EACC,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,eAAU,GAAV,UAAU,CAAQ;QAElB,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,MAAc,EAAE,IAAwC;QAC9E,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,IAAI,QAAQ,MAAM,QAAQ,CAAC;QACtD,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,UAAU;QACR,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,IAAI,CAAC,UAAU,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAChF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Handlers
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for V2 context API:
|
|
5
|
+
* - getContext
|
|
6
|
+
* - executeAction
|
|
7
|
+
* - canAdvance
|
|
8
|
+
*/
|
|
9
|
+
import type { IOrchestratorApiClient } from '../client/types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Handler for getContext tool
|
|
12
|
+
*/
|
|
13
|
+
export declare function createGetContextHandler(client: IOrchestratorApiClient): (params: {
|
|
14
|
+
workflowId?: string;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
content: Array<{
|
|
17
|
+
type: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
isError: true;
|
|
21
|
+
} | {
|
|
22
|
+
content: {
|
|
23
|
+
type: string;
|
|
24
|
+
text: string;
|
|
25
|
+
}[];
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Handler for executeAction tool
|
|
29
|
+
*/
|
|
30
|
+
export declare function createExecuteActionHandler(client: IOrchestratorApiClient): (params: {
|
|
31
|
+
workflowId: string;
|
|
32
|
+
action: string;
|
|
33
|
+
prompt?: string;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
content: Array<{
|
|
36
|
+
type: string;
|
|
37
|
+
text: string;
|
|
38
|
+
}>;
|
|
39
|
+
isError: true;
|
|
40
|
+
} | {
|
|
41
|
+
content: {
|
|
42
|
+
type: string;
|
|
43
|
+
text: string;
|
|
44
|
+
}[];
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Handler for canAdvance tool
|
|
48
|
+
*/
|
|
49
|
+
export declare function createCanAdvanceHandler(client: IOrchestratorApiClient): (params: {
|
|
50
|
+
workflowId: string;
|
|
51
|
+
targetPhase: string;
|
|
52
|
+
}) => Promise<{
|
|
53
|
+
content: Array<{
|
|
54
|
+
type: string;
|
|
55
|
+
text: string;
|
|
56
|
+
}>;
|
|
57
|
+
isError: true;
|
|
58
|
+
} | {
|
|
59
|
+
content: {
|
|
60
|
+
type: string;
|
|
61
|
+
text: string;
|
|
62
|
+
}[];
|
|
63
|
+
}>;
|
|
64
|
+
//# sourceMappingURL=context-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/context-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,IACtD,QAAQ;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAa9C;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,sBAAsB,IACzD,QAAQ;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAiB9E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,IACtD,QAAQ;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAalE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Handlers
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for V2 context API:
|
|
5
|
+
* - getContext
|
|
6
|
+
* - executeAction
|
|
7
|
+
* - canAdvance
|
|
8
|
+
*/
|
|
9
|
+
import { McpApiError } from '../errors/McpApiError.js';
|
|
10
|
+
/**
|
|
11
|
+
* Handler for getContext tool
|
|
12
|
+
*/
|
|
13
|
+
export function createGetContextHandler(client) {
|
|
14
|
+
return async (params) => {
|
|
15
|
+
try {
|
|
16
|
+
const response = await client.getContext(params.workflowId);
|
|
17
|
+
return {
|
|
18
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (error instanceof McpApiError) {
|
|
23
|
+
return error.toMcpError();
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Handler for executeAction tool
|
|
31
|
+
*/
|
|
32
|
+
export function createExecuteActionHandler(client) {
|
|
33
|
+
return async (params) => {
|
|
34
|
+
try {
|
|
35
|
+
const response = await client.executeAction(params.workflowId, params.action, params.prompt);
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof McpApiError) {
|
|
42
|
+
return error.toMcpError();
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Handler for canAdvance tool
|
|
50
|
+
*/
|
|
51
|
+
export function createCanAdvanceHandler(client) {
|
|
52
|
+
return async (params) => {
|
|
53
|
+
try {
|
|
54
|
+
const response = await client.canAdvance(params.workflowId, params.targetPhase);
|
|
55
|
+
return {
|
|
56
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (error instanceof McpApiError) {
|
|
61
|
+
return error.toMcpError();
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=context-handlers.js.map
|