@vibe-agent-toolkit/gateway-mcp 0.1.2-rc.4
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/README.md +368 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +7 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/stateless-adapter.d.ts +27 -0
- package/dist/adapters/stateless-adapter.d.ts.map +1 -0
- package/dist/adapters/stateless-adapter.js +46 -0
- package/dist/adapters/stateless-adapter.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/observability/console-logger.d.ts +11 -0
- package/dist/observability/console-logger.d.ts.map +1 -0
- package/dist/observability/console-logger.js +44 -0
- package/dist/observability/console-logger.js.map +1 -0
- package/dist/observability/interfaces.d.ts +2 -0
- package/dist/observability/interfaces.d.ts.map +1 -0
- package/dist/observability/interfaces.js +2 -0
- package/dist/observability/interfaces.js.map +1 -0
- package/dist/observability/no-op-provider.d.ts +22 -0
- package/dist/observability/no-op-provider.d.ts.map +1 -0
- package/dist/observability/no-op-provider.js +59 -0
- package/dist/observability/no-op-provider.js.map +1 -0
- package/dist/server/mcp-gateway.d.ts +45 -0
- package/dist/server/mcp-gateway.d.ts.map +1 -0
- package/dist/server/mcp-gateway.js +89 -0
- package/dist/server/mcp-gateway.js.map +1 -0
- package/dist/server/result-translator.d.ts +24 -0
- package/dist/server/result-translator.d.ts.map +1 -0
- package/dist/server/result-translator.js +78 -0
- package/dist/server/result-translator.js.map +1 -0
- package/dist/server/stdio-transport.d.ts +16 -0
- package/dist/server/stdio-transport.d.ts.map +1 -0
- package/dist/server/stdio-transport.js +97 -0
- package/dist/server/stdio-transport.js.map +1 -0
- package/dist/types.d.ts +126 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# @vibe-agent-toolkit/gateway-mcp
|
|
2
|
+
|
|
3
|
+
MCP Gateway for exposing VAT agents through the Model Context Protocol, enabling orchestration by LLM systems like Claude Desktop.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Stdio Transport** - Native integration with Claude Desktop and other MCP clients
|
|
8
|
+
- **Stateless Agent Support** - Pure Function Tools and One-Shot LLM Analyzers
|
|
9
|
+
- **Multi-Agent Servers** - Expose multiple agents through a single MCP server
|
|
10
|
+
- **Runtime Agnostic** - Works with any VAT runtime adapter (Vercel AI SDK, OpenAI, LangChain, Claude Agent SDK)
|
|
11
|
+
- **Type-Safe** - Full TypeScript support with branded session IDs
|
|
12
|
+
- **Error Classification** - Distinguishes retryable vs non-retryable errors for intelligent retry logic
|
|
13
|
+
- **Observability Ready** - Hooks for OpenTelemetry integration (console logger included)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Using bun
|
|
19
|
+
bun add @vibe-agent-toolkit/gateway-mcp
|
|
20
|
+
|
|
21
|
+
# Using npm
|
|
22
|
+
npm install @vibe-agent-toolkit/gateway-mcp
|
|
23
|
+
|
|
24
|
+
# Using pnpm
|
|
25
|
+
pnpm add @vibe-agent-toolkit/gateway-mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
### Single Agent Server
|
|
31
|
+
|
|
32
|
+
Expose a single VAT agent via MCP stdio transport:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { StdioMCPGateway, NoOpObservabilityProvider } from '@vibe-agent-toolkit/gateway-mcp';
|
|
36
|
+
import { haikuValidator } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
37
|
+
|
|
38
|
+
const gateway = new StdioMCPGateway({
|
|
39
|
+
name: 'haiku-validator-server',
|
|
40
|
+
version: '1.0.0',
|
|
41
|
+
agents: [
|
|
42
|
+
{
|
|
43
|
+
name: 'haiku-validator',
|
|
44
|
+
agent: haikuValidator,
|
|
45
|
+
runtime: null, // Pure function, no runtime needed
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
observability: new NoOpObservabilityProvider(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
await gateway.start();
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Run with:
|
|
55
|
+
```bash
|
|
56
|
+
bun run my-server.ts
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Multi-Agent Server
|
|
60
|
+
|
|
61
|
+
Expose multiple agents through one MCP server:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { StdioMCPGateway, NoOpObservabilityProvider } from '@vibe-agent-toolkit/gateway-mcp';
|
|
65
|
+
import { haikuValidator, photoAnalyzer } from '@vibe-agent-toolkit/vat-example-cat-agents';
|
|
66
|
+
|
|
67
|
+
const gateway = new StdioMCPGateway({
|
|
68
|
+
name: 'vat-agents',
|
|
69
|
+
version: '1.0.0',
|
|
70
|
+
agents: [
|
|
71
|
+
{
|
|
72
|
+
name: 'haiku-validator',
|
|
73
|
+
agent: haikuValidator,
|
|
74
|
+
runtime: null, // Pure function
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'photo-analyzer',
|
|
78
|
+
agent: photoAnalyzer,
|
|
79
|
+
runtime: null, // Mock mode
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
observability: new NoOpObservabilityProvider(),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
await gateway.start();
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Claude Desktop Configuration
|
|
89
|
+
|
|
90
|
+
Add to `~/.claude/config.json`:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"vat-agents": {
|
|
96
|
+
"command": "bun",
|
|
97
|
+
"args": ["run", "/absolute/path/to/your/server.ts"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Notes:**
|
|
104
|
+
- Use absolute paths (Claude Desktop doesn't expand `~` or relative paths)
|
|
105
|
+
- Restart Claude Desktop after updating config
|
|
106
|
+
- Check logs in Claude Desktop developer console if server doesn't connect
|
|
107
|
+
|
|
108
|
+
## Architecture Overview
|
|
109
|
+
|
|
110
|
+
### Design Principles
|
|
111
|
+
|
|
112
|
+
1. **MCP is an interface, not a runtime** - Gateway exposes agents but doesn't execute them
|
|
113
|
+
2. **Gateway discovers configured agents** - System startup registers agents, gateway provides access
|
|
114
|
+
3. **Respect runtime patterns** - Each runtime manages state its own way (LangGraph checkpointers, OpenAI threads, etc.)
|
|
115
|
+
4. **Archetype-aware** - Different agent types need different interface patterns (stateless vs stateful)
|
|
116
|
+
5. **Separation of concerns** - MCP handles protocol translation and routing, runtimes handle execution and state
|
|
117
|
+
|
|
118
|
+
### Layers
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
┌─────────────────────────────────────────────────┐
|
|
122
|
+
│ External Systems (Claude Desktop, etc.) │
|
|
123
|
+
└─────────────────────────────────────────────────┘
|
|
124
|
+
↓
|
|
125
|
+
┌─────────────────────────────────────────────────┐
|
|
126
|
+
│ Interface Layer (Gateway) │
|
|
127
|
+
│ ├─ MCP Server (stdio/HTTP) │
|
|
128
|
+
│ └─ Stateless Adapter │
|
|
129
|
+
└─────────────────────────────────────────────────┘
|
|
130
|
+
↓
|
|
131
|
+
┌─────────────────────────────────────────────────┐
|
|
132
|
+
│ VAT Agents (business logic) │
|
|
133
|
+
│ ├─ Pure Function Tools │
|
|
134
|
+
│ └─ One-Shot LLM Analyzers │
|
|
135
|
+
└─────────────────────────────────────────────────┘
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Stdio Protocol Compliance
|
|
139
|
+
|
|
140
|
+
**Critical constraint for Claude Desktop integration:**
|
|
141
|
+
|
|
142
|
+
- **stdout** - JSON-RPC protocol messages ONLY (MCP spec requirement)
|
|
143
|
+
- **stderr** - All logs, debug output, errors
|
|
144
|
+
- **Process lifetime** - Server runs until stdin closes (natural stdio connection lifetime)
|
|
145
|
+
|
|
146
|
+
Violating stdout purity breaks MCP clients with JSON parse errors. All logging infrastructure must write to stderr.
|
|
147
|
+
|
|
148
|
+
### Package-Scoped Collections
|
|
149
|
+
|
|
150
|
+
Agents are discovered via npm package exports:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// Package: @my-scope/my-agents
|
|
154
|
+
// Export: /mcp-collections
|
|
155
|
+
|
|
156
|
+
export const myAgents: MCPCollection = {
|
|
157
|
+
name: 'my-agents',
|
|
158
|
+
description: 'My agent collection',
|
|
159
|
+
agents: [
|
|
160
|
+
{ name: 'agent-1', agent: agent1, description: '...' },
|
|
161
|
+
{ name: 'agent-2', agent: agent2, description: '...' },
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const collections: Record<string, MCPCollection> = {
|
|
166
|
+
'my-agents': myAgents,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const defaultCollection = myAgents;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
CLI command: `vat mcp serve @my-scope/my-agents`
|
|
173
|
+
|
|
174
|
+
**Future Enhancement**: Global discovery registry with versioning.
|
|
175
|
+
|
|
176
|
+
### Key Concepts
|
|
177
|
+
|
|
178
|
+
**Gateway is Passive** - Agents are already instantiated with their runtimes. The gateway discovers them and exposes them via MCP protocol.
|
|
179
|
+
|
|
180
|
+
**Archetype-Aware** - Different agent archetypes map to different MCP patterns (stateless tools, conversational agents, orchestrations, etc.)
|
|
181
|
+
|
|
182
|
+
**Runtime Separation** - MCP handles protocol translation and routing. Runtimes handle execution and state management.
|
|
183
|
+
|
|
184
|
+
## Supported Archetypes
|
|
185
|
+
|
|
186
|
+
### Pure Function Tool
|
|
187
|
+
**Archetype:** `pure-function-tool`
|
|
188
|
+
|
|
189
|
+
Direct synchronous functions with no LLM calls or external state.
|
|
190
|
+
|
|
191
|
+
**MCP Mapping:**
|
|
192
|
+
- One MCP tool = One VAT agent
|
|
193
|
+
- No session state
|
|
194
|
+
- Direct pass-through execution
|
|
195
|
+
|
|
196
|
+
**Example:** Haiku validator
|
|
197
|
+
|
|
198
|
+
### One-Shot LLM Analyzer
|
|
199
|
+
**Archetype:** `one-shot-llm-analyzer`
|
|
200
|
+
|
|
201
|
+
Single LLM call to analyze input and return structured output.
|
|
202
|
+
|
|
203
|
+
**MCP Mapping:**
|
|
204
|
+
- One MCP tool = One VAT agent
|
|
205
|
+
- No session state (stateless LLM call)
|
|
206
|
+
- Input → LLM → Structured output
|
|
207
|
+
|
|
208
|
+
**Example:** Photo analyzer
|
|
209
|
+
|
|
210
|
+
## Current Features
|
|
211
|
+
|
|
212
|
+
**Implemented:**
|
|
213
|
+
- ✅ Stdio transport for Claude Desktop
|
|
214
|
+
- ✅ Stateless agent support (Pure Function Tools, One-Shot LLM Analyzers)
|
|
215
|
+
- ✅ Multi-agent servers (multiple tools per server)
|
|
216
|
+
- ✅ Package-scoped collections
|
|
217
|
+
- ✅ CLI integration (`vat mcp serve <package>`)
|
|
218
|
+
- ✅ Observability hooks (console logger included)
|
|
219
|
+
- ✅ System tests for protocol compliance
|
|
220
|
+
|
|
221
|
+
**Current Limitations:**
|
|
222
|
+
- Process-per-server model (no multi-tenancy)
|
|
223
|
+
- Single stdio connection (Claude Desktop spawns dedicated process)
|
|
224
|
+
- No session state management (stateless agents only)
|
|
225
|
+
|
|
226
|
+
## Planned Features
|
|
227
|
+
|
|
228
|
+
**Stateful Agents:**
|
|
229
|
+
- **Conversational Assistants** - Multi-turn conversations with session state
|
|
230
|
+
- **Orchestrations** - Workflow coordination with sub-agents
|
|
231
|
+
- **Event Integrators (HITL)** - Human-in-the-loop approval patterns
|
|
232
|
+
|
|
233
|
+
**Transport & Discovery:**
|
|
234
|
+
- **HTTP Transport** - Remote MCP servers with multiple concurrent connections
|
|
235
|
+
- **Global Discovery Registry** - Namespace management and versioning
|
|
236
|
+
|
|
237
|
+
**Observability:**
|
|
238
|
+
- **Full OpenTelemetry Integration** - Traces, metrics, and structured logs
|
|
239
|
+
|
|
240
|
+
## API Reference
|
|
241
|
+
|
|
242
|
+
### `StdioMCPGateway`
|
|
243
|
+
|
|
244
|
+
Creates an MCP gateway using stdio transport (for Claude Desktop).
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
interface StdioMCPGatewayConfig {
|
|
248
|
+
name: string; // Server name
|
|
249
|
+
version: string; // Server version
|
|
250
|
+
agents: AgentRegistration[]; // Agents to expose
|
|
251
|
+
observability: ObservabilityProvider; // Logging and tracing
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
interface AgentRegistration {
|
|
255
|
+
name: string; // Tool name in MCP
|
|
256
|
+
agent: VATAgent; // VAT agent instance
|
|
257
|
+
runtime: RuntimeAdapter | null; // Runtime adapter (or null for pure functions)
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Methods:**
|
|
262
|
+
- `start(): Promise<void>` - Start the MCP server on stdio
|
|
263
|
+
|
|
264
|
+
**Example:**
|
|
265
|
+
```typescript
|
|
266
|
+
const gateway = new StdioMCPGateway({
|
|
267
|
+
name: 'my-agents',
|
|
268
|
+
version: '1.0.0',
|
|
269
|
+
agents: [{ name: 'my-tool', agent: myAgent, runtime: null }],
|
|
270
|
+
observability: new NoOpObservabilityProvider(),
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
await gateway.start();
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### `NoOpObservabilityProvider`
|
|
277
|
+
|
|
278
|
+
No-op implementation for when observability is not needed.
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
const observability = new NoOpObservabilityProvider();
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### `ConsoleLogger`
|
|
285
|
+
|
|
286
|
+
Console-based logger for development (logs to stderr for MCP compatibility).
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
import { ConsoleLogger } from '@vibe-agent-toolkit/gateway-mcp';
|
|
290
|
+
|
|
291
|
+
const logger = new ConsoleLogger('my-server');
|
|
292
|
+
logger.info('Server started', { port: 3000 });
|
|
293
|
+
logger.error('Error occurred', { error: err });
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Error Handling
|
|
297
|
+
|
|
298
|
+
The gateway translates VAT result envelopes to MCP responses:
|
|
299
|
+
|
|
300
|
+
**VAT Result Envelope:**
|
|
301
|
+
```typescript
|
|
302
|
+
{
|
|
303
|
+
status: 'success' | 'error',
|
|
304
|
+
data?: TOutput,
|
|
305
|
+
error?: { type: string, message: string },
|
|
306
|
+
confidence?: number,
|
|
307
|
+
warnings?: string[]
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**MCP Tool Result:**
|
|
312
|
+
```typescript
|
|
313
|
+
{
|
|
314
|
+
content: [{ type: 'text', text: string }],
|
|
315
|
+
isError?: boolean
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**Error Classification:**
|
|
320
|
+
- Retryable: `llm-rate-limit`, `llm-timeout`, `llm-unavailable`
|
|
321
|
+
- Non-retryable: `llm-refusal`, `llm-invalid-output`, `invalid-input`
|
|
322
|
+
|
|
323
|
+
## Examples
|
|
324
|
+
|
|
325
|
+
See [examples/README.md](./examples/README.md) for:
|
|
326
|
+
- Haiku validator server (Pure Function Tool)
|
|
327
|
+
- Photo analyzer server (One-Shot LLM Analyzer)
|
|
328
|
+
- Combined multi-agent server
|
|
329
|
+
- Claude Desktop configuration examples
|
|
330
|
+
|
|
331
|
+
## Development
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# Install dependencies
|
|
335
|
+
bun install
|
|
336
|
+
|
|
337
|
+
# Build package
|
|
338
|
+
bun run build
|
|
339
|
+
|
|
340
|
+
# Run tests
|
|
341
|
+
bun run test
|
|
342
|
+
|
|
343
|
+
# Run tests in watch mode
|
|
344
|
+
bun run test:watch
|
|
345
|
+
|
|
346
|
+
# Generate coverage report
|
|
347
|
+
bun run test:coverage
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## CLI Integration
|
|
351
|
+
|
|
352
|
+
See [CLI MCP Commands Documentation](../cli/docs/mcp.md) for:
|
|
353
|
+
- `vat mcp list-collections` - List available agent packages
|
|
354
|
+
- `vat mcp serve <package>` - Start MCP server for a package
|
|
355
|
+
- Claude Desktop configuration generation
|
|
356
|
+
- Local development setup with `VAT_ROOT_DIR`
|
|
357
|
+
|
|
358
|
+
## Design Documentation
|
|
359
|
+
|
|
360
|
+
For complete architecture and future phases, see:
|
|
361
|
+
- [State Persistence Patterns](../../docs/research/state-persistence-patterns.md)
|
|
362
|
+
- [VAT Architecture](../../docs/architecture/README.md)
|
|
363
|
+
|
|
364
|
+
**Note:** Detailed design documents (requirements, implementation plans) are kept in `docs/plans/` (gitignored). Architectural decisions and constraints are documented here in the README.
|
|
365
|
+
|
|
366
|
+
## License
|
|
367
|
+
|
|
368
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Agent, OneShotAgentOutput } from '@vibe-agent-toolkit/agent-schema';
|
|
2
|
+
import type { ArchetypeAdapter, ConnectionId, MCPToolDefinition, MCPToolResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Adapter for stateless agents (Pure Function Tool, One-Shot LLM Analyzer)
|
|
5
|
+
*
|
|
6
|
+
* Direct pass-through with no session management.
|
|
7
|
+
* Maps agent.execute() → MCP tool result.
|
|
8
|
+
*/
|
|
9
|
+
export declare class StatelessAdapter implements ArchetypeAdapter {
|
|
10
|
+
readonly name = "stateless";
|
|
11
|
+
private readonly translator;
|
|
12
|
+
/**
|
|
13
|
+
* Create MCP tool definition from agent manifest
|
|
14
|
+
*/
|
|
15
|
+
createToolDefinition(agent: Agent<unknown, unknown>): MCPToolDefinition;
|
|
16
|
+
/**
|
|
17
|
+
* Execute agent and return MCP result
|
|
18
|
+
*/
|
|
19
|
+
execute(agent: Agent<unknown, OneShotAgentOutput<unknown, string>>, args: Record<string, unknown>, _connectionId: ConnectionId): Promise<MCPToolResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Extract input schema from agent (will be enhanced in future)
|
|
22
|
+
*
|
|
23
|
+
* Phase 2: Extract from agent.manifest.interface.input or agent metadata
|
|
24
|
+
*/
|
|
25
|
+
private extractInputSchema;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=stateless-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateless-adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/stateless-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGlF,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEpG;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,gBAAgB;IACvD,QAAQ,CAAC,IAAI,eAAe;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0B;IAErD;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,iBAAiB;IAUvE;;OAEG;IACG,OAAO,CACX,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAC1D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,aAAa,EAAE,YAAY,GAC1B,OAAO,CAAC,aAAa,CAAC;IAQzB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;CAS3B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ResultTranslator } from '../server/result-translator.js';
|
|
2
|
+
/**
|
|
3
|
+
* Adapter for stateless agents (Pure Function Tool, One-Shot LLM Analyzer)
|
|
4
|
+
*
|
|
5
|
+
* Direct pass-through with no session management.
|
|
6
|
+
* Maps agent.execute() → MCP tool result.
|
|
7
|
+
*/
|
|
8
|
+
export class StatelessAdapter {
|
|
9
|
+
name = 'stateless';
|
|
10
|
+
translator = new ResultTranslator();
|
|
11
|
+
/**
|
|
12
|
+
* Create MCP tool definition from agent manifest
|
|
13
|
+
*/
|
|
14
|
+
createToolDefinition(agent) {
|
|
15
|
+
const { manifest } = agent;
|
|
16
|
+
return {
|
|
17
|
+
name: manifest.name,
|
|
18
|
+
description: manifest.description ?? `Agent: ${manifest.name}`,
|
|
19
|
+
inputSchema: this.extractInputSchema(agent),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Execute agent and return MCP result
|
|
24
|
+
*/
|
|
25
|
+
async execute(agent, args, _connectionId) {
|
|
26
|
+
// Direct pass-through, no session state needed
|
|
27
|
+
const output = await agent.execute(args);
|
|
28
|
+
// Translate VAT result envelope to MCP format
|
|
29
|
+
return this.translator.toMCPResult(output);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Extract input schema from agent (will be enhanced in future)
|
|
33
|
+
*
|
|
34
|
+
* Phase 2: Extract from agent.manifest.interface.input or agent metadata
|
|
35
|
+
*/
|
|
36
|
+
extractInputSchema(agent) {
|
|
37
|
+
// For Phase 1, create a generic schema
|
|
38
|
+
return {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {},
|
|
41
|
+
additionalProperties: true,
|
|
42
|
+
description: `Input for ${agent.manifest.name}`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=stateless-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateless-adapter.js","sourceRoot":"","sources":["../../src/adapters/stateless-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGlE;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IAClB,IAAI,GAAG,WAAW,CAAC;IACX,UAAU,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAErD;;OAEG;IACH,oBAAoB,CAAC,KAA8B;QACjD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;QAE3B,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,UAAU,QAAQ,CAAC,IAAI,EAAE;YAC9D,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;SAC5C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,KAA0D,EAC1D,IAA6B,EAC7B,aAA2B;QAE3B,+CAA+C;QAC/C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEzC,8CAA8C;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACK,kBAAkB,CAAC,KAA8B;QACvD,uCAAuC;QACvC,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;YACd,oBAAoB,EAAE,IAAI;YAC1B,WAAW,EAAE,aAAa,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE;SAChD,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibe-agent-toolkit/gateway-mcp
|
|
3
|
+
*
|
|
4
|
+
* MCP Gateway for exposing VAT agents through Model Context Protocol.
|
|
5
|
+
*/
|
|
6
|
+
export * from './types.js';
|
|
7
|
+
export * from './observability/interfaces.js';
|
|
8
|
+
export { NoOpObservabilityProvider } from './observability/no-op-provider.js';
|
|
9
|
+
export { ConsoleLogger } from './observability/console-logger.js';
|
|
10
|
+
export { MCPGateway } from './server/mcp-gateway.js';
|
|
11
|
+
export { StdioMCPGateway } from './server/stdio-transport.js';
|
|
12
|
+
export { StatelessAdapter } from './adapters/stateless-adapter.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibe-agent-toolkit/gateway-mcp
|
|
3
|
+
*
|
|
4
|
+
* MCP Gateway for exposing VAT agents through Model Context Protocol.
|
|
5
|
+
*/
|
|
6
|
+
// Core types
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
// Observability (Task 3)
|
|
9
|
+
export * from './observability/interfaces.js';
|
|
10
|
+
export { NoOpObservabilityProvider } from './observability/no-op-provider.js';
|
|
11
|
+
export { ConsoleLogger } from './observability/console-logger.js';
|
|
12
|
+
// Server (Tasks 4-7)
|
|
13
|
+
export { MCPGateway } from './server/mcp-gateway.js';
|
|
14
|
+
export { StdioMCPGateway } from './server/stdio-transport.js';
|
|
15
|
+
// Adapters (Tasks 5-6)
|
|
16
|
+
export { StatelessAdapter } from './adapters/stateless-adapter.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,yBAAyB;AACzB,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,qBAAqB;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,uBAAuB;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Logger } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Simple console-based logger for development
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConsoleLogger implements Logger {
|
|
6
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
7
|
+
error(message: string, error?: Error, context?: Record<string, unknown>): void;
|
|
8
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
9
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=console-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-logger.d.ts","sourceRoot":"","sources":["../../src/observability/console-logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAQ9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAY9E,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAQ9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAOhE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple console-based logger for development
|
|
3
|
+
*/
|
|
4
|
+
export class ConsoleLogger {
|
|
5
|
+
info(message, context) {
|
|
6
|
+
if (context) {
|
|
7
|
+
console.error(`[INFO] ${message}`, context);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
console.error(`[INFO] ${message}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
error(message, error, context) {
|
|
14
|
+
if (error && context) {
|
|
15
|
+
console.error(`[ERROR] ${message}`, error, context);
|
|
16
|
+
}
|
|
17
|
+
else if (error) {
|
|
18
|
+
console.error(`[ERROR] ${message}`, error);
|
|
19
|
+
}
|
|
20
|
+
else if (context) {
|
|
21
|
+
console.error(`[ERROR] ${message}`, context);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.error(`[ERROR] ${message}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
warn(message, context) {
|
|
28
|
+
if (context) {
|
|
29
|
+
console.warn(`[WARN] ${message}`, context);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.warn(`[WARN] ${message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
debug(message, context) {
|
|
36
|
+
if (context) {
|
|
37
|
+
console.error(`[DEBUG] ${message}`, context);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
console.error(`[DEBUG] ${message}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=console-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-logger.js","sourceRoot":"","sources":["../../src/observability/console-logger.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,IAAI,CAAC,OAAe,EAAE,OAAiC;QACrD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,KAAa,EAAE,OAAiC;QACrE,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACtD,CAAC;aAAM,IAAI,KAAK,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;aAAM,IAAI,OAAO,EAAE,CAAC;YACnB,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,OAAiC;QACrD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,OAAiC;QACtD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/observability/interfaces.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,SAAS,EACT,MAAM,EACN,KAAK,EACL,qBAAqB,EACrB,IAAI,EACJ,MAAM,GACP,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/observability/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-op observability provider
|
|
3
|
+
*
|
|
4
|
+
* This file implements the Null Object pattern for observability.
|
|
5
|
+
* All methods are intentionally empty - they satisfy the interface
|
|
6
|
+
* contract without performing any operations.
|
|
7
|
+
*
|
|
8
|
+
* SonarQube: Empty methods are intentional (no-op pattern)
|
|
9
|
+
*/
|
|
10
|
+
import type { Logger, Meter, ObservabilityProvider, Tracer } from '../types.js';
|
|
11
|
+
/**
|
|
12
|
+
* No-op observability provider (default when observability not configured)
|
|
13
|
+
*/
|
|
14
|
+
export declare class NoOpObservabilityProvider implements ObservabilityProvider {
|
|
15
|
+
private readonly logger;
|
|
16
|
+
private readonly tracer;
|
|
17
|
+
private readonly meter;
|
|
18
|
+
getLogger(): Logger;
|
|
19
|
+
getTracer(): Tracer;
|
|
20
|
+
getMeter(): Meter;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=no-op-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op-provider.d.ts","sourceRoot":"","sources":["../../src/observability/no-op-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAGV,MAAM,EACN,KAAK,EACL,qBAAqB,EAErB,MAAM,EACP,MAAM,aAAa,CAAC;AAyCrB;;GAEG;AACH,qBAAa,yBAA0B,YAAW,qBAAqB;IACrE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IAEzC,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;IAInB,QAAQ,IAAI,KAAK;CAGlB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-op observability provider
|
|
3
|
+
*
|
|
4
|
+
* This file implements the Null Object pattern for observability.
|
|
5
|
+
* All methods are intentionally empty - they satisfy the interface
|
|
6
|
+
* contract without performing any operations.
|
|
7
|
+
*
|
|
8
|
+
* SonarQube: Empty methods are intentional (no-op pattern)
|
|
9
|
+
*/
|
|
10
|
+
class NoOpLogger {
|
|
11
|
+
info() { } // NOSONAR - intentional no-op
|
|
12
|
+
error() { } // NOSONAR - intentional no-op
|
|
13
|
+
warn() { } // NOSONAR - intentional no-op
|
|
14
|
+
debug() { } // NOSONAR - intentional no-op
|
|
15
|
+
}
|
|
16
|
+
class NoOpSpan {
|
|
17
|
+
setAttribute() { } // NOSONAR - intentional no-op
|
|
18
|
+
recordException() { } // NOSONAR - intentional no-op
|
|
19
|
+
setStatus() { } // NOSONAR - intentional no-op
|
|
20
|
+
end() { } // NOSONAR - intentional no-op
|
|
21
|
+
}
|
|
22
|
+
class NoOpTracer {
|
|
23
|
+
async startActiveSpan(_name, fn) {
|
|
24
|
+
const span = new NoOpSpan();
|
|
25
|
+
return fn(span);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
class NoOpCounter {
|
|
29
|
+
add() { } // NOSONAR - intentional no-op
|
|
30
|
+
}
|
|
31
|
+
class NoOpHistogram {
|
|
32
|
+
record() { } // NOSONAR - intentional no-op
|
|
33
|
+
}
|
|
34
|
+
class NoOpMeter {
|
|
35
|
+
createCounter() {
|
|
36
|
+
return new NoOpCounter();
|
|
37
|
+
}
|
|
38
|
+
createHistogram() {
|
|
39
|
+
return new NoOpHistogram();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* No-op observability provider (default when observability not configured)
|
|
44
|
+
*/
|
|
45
|
+
export class NoOpObservabilityProvider {
|
|
46
|
+
logger = new NoOpLogger();
|
|
47
|
+
tracer = new NoOpTracer();
|
|
48
|
+
meter = new NoOpMeter();
|
|
49
|
+
getLogger() {
|
|
50
|
+
return this.logger;
|
|
51
|
+
}
|
|
52
|
+
getTracer() {
|
|
53
|
+
return this.tracer;
|
|
54
|
+
}
|
|
55
|
+
getMeter() {
|
|
56
|
+
return this.meter;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=no-op-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-op-provider.js","sourceRoot":"","sources":["../../src/observability/no-op-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,MAAM,UAAU;IACd,IAAI,KAAU,CAAC,CAAC,8BAA8B;IAC9C,KAAK,KAAU,CAAC,CAAC,8BAA8B;IAC/C,IAAI,KAAU,CAAC,CAAC,8BAA8B;IAC9C,KAAK,KAAU,CAAC,CAAC,8BAA8B;CAChD;AAED,MAAM,QAAQ;IACZ,YAAY,KAAU,CAAC,CAAC,8BAA8B;IACtD,eAAe,KAAU,CAAC,CAAC,8BAA8B;IACzD,SAAS,KAAU,CAAC,CAAC,8BAA8B;IACnD,GAAG,KAAU,CAAC,CAAC,8BAA8B;CAC9C;AAED,MAAM,UAAU;IACd,KAAK,CAAC,eAAe,CAAI,KAAa,EAAE,EAA8B;QACpE,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;CACF;AAED,MAAM,WAAW;IACf,GAAG,KAAU,CAAC,CAAC,8BAA8B;CAC9C;AAED,MAAM,aAAa;IACjB,MAAM,KAAU,CAAC,CAAC,8BAA8B;CACjD;AAED,MAAM,SAAS;IACb,aAAa;QACX,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IAED,eAAe;QACb,OAAO,IAAI,aAAa,EAAE,CAAC;IAC7B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACnB,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAC1B,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAC1B,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;IAEzC,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Agent, OneShotAgentOutput } from '@vibe-agent-toolkit/agent-schema';
|
|
2
|
+
import type { AgentRegistration, ArchetypeAdapter, GatewayConfig, Logger, MCPToolDefinition, ObservabilityProvider } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Internal registration with resolved adapter
|
|
5
|
+
*/
|
|
6
|
+
interface ResolvedToolRegistration {
|
|
7
|
+
name: string;
|
|
8
|
+
agent: Agent<unknown, OneShotAgentOutput<unknown, string>>;
|
|
9
|
+
adapter: ArchetypeAdapter;
|
|
10
|
+
definition: MCPToolDefinition;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* MCP Gateway - exposes VAT agents through Model Context Protocol
|
|
14
|
+
*
|
|
15
|
+
* Phase 1: Stdio transport, stateless agents only
|
|
16
|
+
*/
|
|
17
|
+
export declare class MCPGateway {
|
|
18
|
+
protected readonly tools: Map<string, ResolvedToolRegistration>;
|
|
19
|
+
protected readonly observability: ObservabilityProvider;
|
|
20
|
+
protected readonly logger: Logger;
|
|
21
|
+
protected readonly transport: 'stdio' | 'http';
|
|
22
|
+
constructor(config: GatewayConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Register an agent with the gateway
|
|
25
|
+
*/
|
|
26
|
+
protected registerAgent(registration: AgentRegistration): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get adapter for archetype (Phase 1: stateless only)
|
|
29
|
+
*/
|
|
30
|
+
protected getAdapter(archetype: string): ArchetypeAdapter;
|
|
31
|
+
/**
|
|
32
|
+
* Get all registered tool definitions (for MCP tools/list)
|
|
33
|
+
*/
|
|
34
|
+
getToolDefinitions(): MCPToolDefinition[];
|
|
35
|
+
/**
|
|
36
|
+
* Get tool registration by name
|
|
37
|
+
*/
|
|
38
|
+
protected getToolRegistration(name: string): ResolvedToolRegistration;
|
|
39
|
+
/**
|
|
40
|
+
* Start the gateway (to be implemented by transport-specific subclasses)
|
|
41
|
+
*/
|
|
42
|
+
start(): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=mcp-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-gateway.d.ts","sourceRoot":"","sources":["../../src/server/mcp-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAIlF,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,EAAE,iBAAiB,CAAC;CAC/B;AAED;;;;GAIG;AACH,qBAAa,UAAU;IACrB,SAAS,CAAC,QAAQ,CAAC,KAAK,wCAA+C;IACvE,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IACxD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC;gBAEnC,MAAM,EAAE,aAAa;IAgBjC;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,YAAY,EAAE,iBAAiB,GAAG,IAAI;IAyB9D;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAiBzD;;OAEG;IACH,kBAAkB,IAAI,iBAAiB,EAAE;IAIzC;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB;IAQrE;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { StatelessAdapter } from '../adapters/stateless-adapter.js';
|
|
2
|
+
import { NoOpObservabilityProvider } from '../observability/no-op-provider.js';
|
|
3
|
+
/**
|
|
4
|
+
* MCP Gateway - exposes VAT agents through Model Context Protocol
|
|
5
|
+
*
|
|
6
|
+
* Phase 1: Stdio transport, stateless agents only
|
|
7
|
+
*/
|
|
8
|
+
export class MCPGateway {
|
|
9
|
+
tools = new Map();
|
|
10
|
+
observability;
|
|
11
|
+
logger;
|
|
12
|
+
transport;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.transport = config.transport;
|
|
15
|
+
this.observability = config.observability ?? new NoOpObservabilityProvider();
|
|
16
|
+
this.logger = this.observability.getLogger();
|
|
17
|
+
// Register all agents
|
|
18
|
+
for (const registration of config.agents) {
|
|
19
|
+
this.registerAgent(registration);
|
|
20
|
+
}
|
|
21
|
+
this.logger.info('MCPGateway initialized', {
|
|
22
|
+
transport: this.transport,
|
|
23
|
+
agentCount: this.tools.size,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Register an agent with the gateway
|
|
28
|
+
*/
|
|
29
|
+
registerAgent(registration) {
|
|
30
|
+
const { agent } = registration;
|
|
31
|
+
const { manifest } = agent;
|
|
32
|
+
// Auto-detect adapter from archetype (or use provided adapter)
|
|
33
|
+
const adapter = registration.adapter ?? this.getAdapter(manifest.archetype);
|
|
34
|
+
// Create MCP tool definition
|
|
35
|
+
const definition = adapter.createToolDefinition(agent);
|
|
36
|
+
// Store registration
|
|
37
|
+
this.tools.set(registration.name, {
|
|
38
|
+
name: registration.name,
|
|
39
|
+
agent,
|
|
40
|
+
adapter,
|
|
41
|
+
definition,
|
|
42
|
+
});
|
|
43
|
+
this.logger.debug('Agent registered', {
|
|
44
|
+
name: registration.name,
|
|
45
|
+
archetype: manifest.archetype,
|
|
46
|
+
adapter: adapter.name,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get adapter for archetype (Phase 1: stateless only)
|
|
51
|
+
*/
|
|
52
|
+
getAdapter(archetype) {
|
|
53
|
+
switch (archetype) {
|
|
54
|
+
case 'pure-function':
|
|
55
|
+
case 'one-shot-llm-analyzer':
|
|
56
|
+
return new StatelessAdapter();
|
|
57
|
+
// Phase 2+: Add more archetypes
|
|
58
|
+
case 'conversational':
|
|
59
|
+
case 'orchestration':
|
|
60
|
+
case 'external-event-integrator':
|
|
61
|
+
throw new Error(`Unsupported archetype: ${archetype} (coming in Phase 2+)`);
|
|
62
|
+
default:
|
|
63
|
+
throw new Error(`Unknown archetype: ${archetype}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get all registered tool definitions (for MCP tools/list)
|
|
68
|
+
*/
|
|
69
|
+
getToolDefinitions() {
|
|
70
|
+
return [...this.tools.values()].map((reg) => reg.definition);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get tool registration by name
|
|
74
|
+
*/
|
|
75
|
+
getToolRegistration(name) {
|
|
76
|
+
const registration = this.tools.get(name);
|
|
77
|
+
if (!registration) {
|
|
78
|
+
throw new Error(`Tool not found: ${name}`);
|
|
79
|
+
}
|
|
80
|
+
return registration;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Start the gateway (to be implemented by transport-specific subclasses)
|
|
84
|
+
*/
|
|
85
|
+
async start() {
|
|
86
|
+
throw new Error('start() must be implemented by transport-specific subclass');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=mcp-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-gateway.js","sourceRoot":"","sources":["../../src/server/mcp-gateway.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAoB/E;;;;GAIG;AACH,MAAM,OAAO,UAAU;IACF,KAAK,GAAG,IAAI,GAAG,EAAoC,CAAC;IACpD,aAAa,CAAwB;IACrC,MAAM,CAAS;IACf,SAAS,CAAmB;IAE/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AC;IAED;;OAEG;IACO,UAAU,CAAC,SAAiB;QACpC,QAAQ,SAAS,EAAE,CAAC;YAClB,KAAK,eAAe,CAAC;YACrB,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,gBAAgB,EAAE,CAAC;YAEhC,gCAAgC;YAChC,KAAK,gBAAgB,CAAC;YACtB,KAAK,eAAe,CAAC;YACrB,KAAK,2BAA2B;gBAC9B,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,uBAAuB,CAAC,CAAC;YAE9E;gBACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACO,mBAAmB,CAAC,IAAY;QACxC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type OneShotAgentOutput } from '@vibe-agent-toolkit/agent-schema';
|
|
2
|
+
import type { MCPToolResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Translates VAT agent results to MCP tool results
|
|
5
|
+
*/
|
|
6
|
+
export declare class ResultTranslator {
|
|
7
|
+
/**
|
|
8
|
+
* Convert VAT agent output envelope to MCP tool result
|
|
9
|
+
*/
|
|
10
|
+
toMCPResult(agentOutput: OneShotAgentOutput<unknown, string>): MCPToolResult;
|
|
11
|
+
/**
|
|
12
|
+
* Format success data for MCP text response
|
|
13
|
+
*/
|
|
14
|
+
private formatSuccess;
|
|
15
|
+
/**
|
|
16
|
+
* Format error for MCP text response
|
|
17
|
+
*/
|
|
18
|
+
private formatError;
|
|
19
|
+
/**
|
|
20
|
+
* Type guard for conversational reply data
|
|
21
|
+
*/
|
|
22
|
+
private isReplyData;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=result-translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-translator.d.ts","sourceRoot":"","sources":["../../src/server/result-translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,WAAW,CAAC,WAAW,EAAE,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,aAAa;IA0B5E;;OAEG;IACH,OAAO,CAAC,aAAa;IA8BrB;;OAEG;IACH,OAAO,CAAC,WAAW;IAYnB;;OAEG;IACH,OAAO,CAAC,WAAW;CAQpB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { RESULT_SUCCESS } from '@vibe-agent-toolkit/agent-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Translates VAT agent results to MCP tool results
|
|
4
|
+
*/
|
|
5
|
+
export class ResultTranslator {
|
|
6
|
+
/**
|
|
7
|
+
* Convert VAT agent output envelope to MCP tool result
|
|
8
|
+
*/
|
|
9
|
+
toMCPResult(agentOutput) {
|
|
10
|
+
const { result } = agentOutput;
|
|
11
|
+
if (result.status === RESULT_SUCCESS) {
|
|
12
|
+
return {
|
|
13
|
+
content: [
|
|
14
|
+
{
|
|
15
|
+
type: 'text',
|
|
16
|
+
text: this.formatSuccess(result.data, result.confidence, result.warnings),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
isError: false,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
content: [
|
|
24
|
+
{
|
|
25
|
+
type: 'text',
|
|
26
|
+
text: this.formatError(result.error, result.confidence),
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Format success data for MCP text response
|
|
34
|
+
*/
|
|
35
|
+
formatSuccess(data, confidence, warnings) {
|
|
36
|
+
const lines = [];
|
|
37
|
+
// If data has a reply field, return that directly (conversational)
|
|
38
|
+
if (this.isReplyData(data)) {
|
|
39
|
+
lines.push(data.reply);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Otherwise, return JSON
|
|
43
|
+
lines.push(JSON.stringify(data, null, 2));
|
|
44
|
+
}
|
|
45
|
+
// Add observability metadata if present
|
|
46
|
+
if (confidence !== undefined) {
|
|
47
|
+
lines.push(`\nConfidence: ${confidence}`);
|
|
48
|
+
}
|
|
49
|
+
if (warnings && warnings.length > 0) {
|
|
50
|
+
lines.push('\nWarnings:');
|
|
51
|
+
for (const warning of warnings) {
|
|
52
|
+
lines.push(` • ${warning}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return lines.join('\n');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Format error for MCP text response
|
|
59
|
+
*/
|
|
60
|
+
formatError(errorType, confidence) {
|
|
61
|
+
const lines = [];
|
|
62
|
+
lines.push(`Error: ${errorType}`);
|
|
63
|
+
if (confidence !== undefined) {
|
|
64
|
+
lines.push(`Confidence: ${confidence}`);
|
|
65
|
+
}
|
|
66
|
+
return lines.join('\n');
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Type guard for conversational reply data
|
|
70
|
+
*/
|
|
71
|
+
isReplyData(data) {
|
|
72
|
+
return (typeof data === 'object' &&
|
|
73
|
+
data !== null &&
|
|
74
|
+
'reply' in data &&
|
|
75
|
+
typeof data.reply === 'string');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=result-translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-translator.js","sourceRoot":"","sources":["../../src/server/result-translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2B,MAAM,kCAAkC,CAAC;AAI3F;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACH,WAAW,CAAC,WAAgD;QAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;QAE/B,IAAI,MAAM,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;YACrC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC;qBAC1E;iBACF;gBACD,OAAO,EAAE,KAAK;aACf,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;iBACxD;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,aAAa,CACnB,IAAa,EACb,UAAmB,EACnB,QAAmB;QAEnB,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,mEAAmE;QACnE,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,yBAAyB;YACzB,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
* Process lifetime = connection lifetime
|
|
6
|
+
* Single connection per process
|
|
7
|
+
*/
|
|
8
|
+
export declare class StdioMCPGateway extends MCPGateway {
|
|
9
|
+
private server?;
|
|
10
|
+
private readonly connectionId;
|
|
11
|
+
/**
|
|
12
|
+
* Start the stdio MCP server
|
|
13
|
+
*/
|
|
14
|
+
start(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=stdio-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-transport.d.ts","sourceRoot":"","sources":["../../src/server/stdio-transport.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAE7C,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8C;IAE3E;;OAEG;IACY,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAkGtC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// eslint-disable-next-line sonarjs/deprecation -- Using Server for advanced request handling with stdio transport
|
|
2
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { createConnectionId } from '../types.js';
|
|
6
|
+
import { MCPGateway } from './mcp-gateway.js';
|
|
7
|
+
/**
|
|
8
|
+
* Stdio transport implementation for Claude Desktop
|
|
9
|
+
*
|
|
10
|
+
* Process lifetime = connection lifetime
|
|
11
|
+
* Single connection per process
|
|
12
|
+
*/
|
|
13
|
+
export class StdioMCPGateway extends MCPGateway {
|
|
14
|
+
// eslint-disable-next-line sonarjs/deprecation -- Server needed for request handler API
|
|
15
|
+
server;
|
|
16
|
+
connectionId = createConnectionId(`stdio-${process.pid}`);
|
|
17
|
+
/**
|
|
18
|
+
* Start the stdio MCP server
|
|
19
|
+
*/
|
|
20
|
+
async start() {
|
|
21
|
+
this.logger.info('Starting stdio MCP gateway', {
|
|
22
|
+
connectionId: this.connectionId,
|
|
23
|
+
toolCount: this.tools.size,
|
|
24
|
+
});
|
|
25
|
+
// Create MCP server
|
|
26
|
+
// eslint-disable-next-line sonarjs/deprecation -- Server provides request handler registration API
|
|
27
|
+
this.server = new Server({
|
|
28
|
+
name: 'vat-agents',
|
|
29
|
+
version: '0.1.0',
|
|
30
|
+
}, {
|
|
31
|
+
capabilities: {
|
|
32
|
+
tools: {},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
// Register tools/list handler
|
|
36
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
37
|
+
const tools = this.getToolDefinitions();
|
|
38
|
+
this.logger.debug('tools/list requested', { toolCount: tools.length });
|
|
39
|
+
return { tools };
|
|
40
|
+
});
|
|
41
|
+
// Register tools/call handler
|
|
42
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
43
|
+
const { name, arguments: args } = request.params;
|
|
44
|
+
this.logger.debug('Tool call received', {
|
|
45
|
+
tool: name,
|
|
46
|
+
connectionId: this.connectionId,
|
|
47
|
+
});
|
|
48
|
+
const tracer = this.observability.getTracer();
|
|
49
|
+
return tracer.startActiveSpan('tool.call', async (span) => {
|
|
50
|
+
span.setAttribute('tool', name);
|
|
51
|
+
span.setAttribute('connection', this.connectionId);
|
|
52
|
+
try {
|
|
53
|
+
// Get tool registration
|
|
54
|
+
const registration = this.getToolRegistration(name);
|
|
55
|
+
// Execute via adapter
|
|
56
|
+
const result = await registration.adapter.execute(registration.agent, args ?? {}, this.connectionId);
|
|
57
|
+
span.setAttribute('status', result.isError ? 'error' : 'success');
|
|
58
|
+
span.end();
|
|
59
|
+
this.logger.info('Tool call completed', {
|
|
60
|
+
tool: name,
|
|
61
|
+
isError: result.isError,
|
|
62
|
+
});
|
|
63
|
+
// Return result (MCPToolResult is compatible with CallToolResult)
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
span.recordException(error);
|
|
68
|
+
span.setStatus({ code: 1 }); // Error status
|
|
69
|
+
span.end();
|
|
70
|
+
this.logger.error('Tool call failed', error, {
|
|
71
|
+
tool: name,
|
|
72
|
+
connectionId: this.connectionId,
|
|
73
|
+
});
|
|
74
|
+
// Return error as MCP result
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: 'text',
|
|
79
|
+
text: `Internal error: ${error.message}`,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
isError: true,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
// Connect stdio transport
|
|
88
|
+
const transport = new StdioServerTransport();
|
|
89
|
+
await this.server.connect(transport);
|
|
90
|
+
this.logger.info('Stdio MCP gateway started', {
|
|
91
|
+
connectionId: this.connectionId,
|
|
92
|
+
});
|
|
93
|
+
// Log to stderr (stdout is reserved for MCP protocol)
|
|
94
|
+
console.error('[MCP Gateway] Ready - listening on stdio');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=stdio-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-transport.js","sourceRoot":"","sources":["../../src/server/stdio-transport.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAEnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;GAK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B;oBAC7B,OAAO;wBACL,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,mBAAoB,KAAe,CAAC,OAAO,EAAE;6BACpD;yBACF;wBACD,OAAO,EAAE,IAAI;qBACI,CAAC;gBACtB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,0BAA0B;QAC1B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAErC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;YAC5C,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC,CAAC;QAEH,sDAAsD;QACtD,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Agent, OneShotAgentOutput } from '@vibe-agent-toolkit/agent-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Brand types for session identity (strong typing)
|
|
4
|
+
*/
|
|
5
|
+
export type ConnectionId = string & {
|
|
6
|
+
readonly __brand: 'ConnectionId';
|
|
7
|
+
};
|
|
8
|
+
export type ConversationId = string & {
|
|
9
|
+
readonly __brand: 'ConversationId';
|
|
10
|
+
};
|
|
11
|
+
export type RuntimeSessionId = string & {
|
|
12
|
+
readonly __brand: 'RuntimeSessionId';
|
|
13
|
+
};
|
|
14
|
+
export type TraceId = string & {
|
|
15
|
+
readonly __brand: 'TraceId';
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* MCP tool definition that will be exposed to MCP clients
|
|
19
|
+
*/
|
|
20
|
+
export interface MCPToolDefinition {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
inputSchema: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* MCP tool result (what MCP clients receive)
|
|
27
|
+
*/
|
|
28
|
+
export interface MCPToolResult {
|
|
29
|
+
content: Array<{
|
|
30
|
+
type: 'text';
|
|
31
|
+
text: string;
|
|
32
|
+
}>;
|
|
33
|
+
isError?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Agent registration entry
|
|
37
|
+
*/
|
|
38
|
+
export interface AgentRegistration<TInput = unknown, TOutput = unknown> {
|
|
39
|
+
name: string;
|
|
40
|
+
agent: Agent<TInput, OneShotAgentOutput<TOutput, string>>;
|
|
41
|
+
adapter?: ArchetypeAdapter;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gateway configuration
|
|
45
|
+
*/
|
|
46
|
+
export interface GatewayConfig {
|
|
47
|
+
agents: AgentRegistration[];
|
|
48
|
+
transport: 'stdio' | 'http';
|
|
49
|
+
observability?: ObservabilityProvider;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Archetype adapter interface (stateless for Phase 1)
|
|
53
|
+
*/
|
|
54
|
+
export interface ArchetypeAdapter {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
/**
|
|
57
|
+
* Converts agent to MCP tool definition
|
|
58
|
+
*/
|
|
59
|
+
createToolDefinition(agent: Agent<unknown, unknown>): MCPToolDefinition;
|
|
60
|
+
/**
|
|
61
|
+
* Executes agent and returns MCP-formatted result
|
|
62
|
+
*/
|
|
63
|
+
execute(agent: Agent<unknown, unknown>, args: Record<string, unknown>, connectionId: ConnectionId): Promise<MCPToolResult>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Observability provider interface (OTel-aligned)
|
|
67
|
+
*/
|
|
68
|
+
export interface ObservabilityProvider {
|
|
69
|
+
getLogger(): Logger;
|
|
70
|
+
getTracer(): Tracer;
|
|
71
|
+
getMeter(): Meter;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Logger interface (simplified for Phase 1)
|
|
75
|
+
*/
|
|
76
|
+
export interface Logger {
|
|
77
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
78
|
+
error(message: string, error?: Error, context?: Record<string, unknown>): void;
|
|
79
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
80
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Tracer interface (no-op for Phase 1, OTel-aligned)
|
|
84
|
+
*/
|
|
85
|
+
export interface Tracer {
|
|
86
|
+
startActiveSpan<T>(name: string, fn: (span: Span) => Promise<T>): Promise<T>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Span interface (no-op for Phase 1, OTel-aligned)
|
|
90
|
+
*/
|
|
91
|
+
export interface Span {
|
|
92
|
+
setAttribute(key: string, value: string | number | boolean): void;
|
|
93
|
+
recordException(error: Error): void;
|
|
94
|
+
setStatus(status: {
|
|
95
|
+
code: number;
|
|
96
|
+
}): void;
|
|
97
|
+
end(): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Meter interface (no-op for Phase 1, OTel-aligned)
|
|
101
|
+
*/
|
|
102
|
+
export interface Meter {
|
|
103
|
+
createCounter(name: string): Counter;
|
|
104
|
+
createHistogram(name: string): Histogram;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Counter interface (no-op for Phase 1)
|
|
108
|
+
*/
|
|
109
|
+
export interface Counter {
|
|
110
|
+
add(value: number, attributes?: Record<string, string>): void;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Histogram interface (no-op for Phase 1)
|
|
114
|
+
*/
|
|
115
|
+
export interface Histogram {
|
|
116
|
+
record(value: number, attributes?: Record<string, string>): void;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Helper to create branded ConnectionId
|
|
120
|
+
*/
|
|
121
|
+
export declare function createConnectionId(id: string): ConnectionId;
|
|
122
|
+
/**
|
|
123
|
+
* Helper to create branded ConversationId
|
|
124
|
+
*/
|
|
125
|
+
export declare function createConversationId(id: string): ConversationId;
|
|
126
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AACzE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;CAAE,CAAC;AACjF,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,EAAE,gB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
|
|
4
|
+
export function createConnectionId(id) {
|
|
5
|
+
return id;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Helper to create branded ConversationId
|
|
9
|
+
*/
|
|
10
|
+
export function createConversationId(id) {
|
|
11
|
+
return id;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAkIA;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAU;IAC3C,OAAO,EAAkB,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,EAAU;IAC7C,OAAO,EAAoB,CAAC;AAC9B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibe-agent-toolkit/gateway-mcp",
|
|
3
|
+
"version": "0.1.2-rc.4",
|
|
4
|
+
"description": "MCP Gateway for exposing VAT agents through Model Context Protocol",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"test:coverage": "vitest run --coverage"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
26
|
+
"@vibe-agent-toolkit/agent-schema": "0.1.2-rc.4",
|
|
27
|
+
"@vibe-agent-toolkit/utils": "0.1.2-rc.4",
|
|
28
|
+
"@vibe-agent-toolkit/vat-example-cat-agents": "0.1.2-rc.4",
|
|
29
|
+
"zod": "^3.24.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^22.10.5",
|
|
33
|
+
"@vitest/coverage-v8": "^3.0.5",
|
|
34
|
+
"typescript": "^5.7.3",
|
|
35
|
+
"vitest": "^3.0.5"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"mcp",
|
|
39
|
+
"model-context-protocol",
|
|
40
|
+
"agents",
|
|
41
|
+
"vat"
|
|
42
|
+
],
|
|
43
|
+
"author": "Jeff Dutton",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/jdutton/vibe-agent-toolkit.git",
|
|
48
|
+
"directory": "packages/gateway-mcp"
|
|
49
|
+
}
|
|
50
|
+
}
|