opalserve 0.1.0 → 0.1.2

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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +103 -65
  3. package/dist/cli/discover.js +9 -9
  4. package/dist/cli/discover.js.map +1 -1
  5. package/dist/cli/index.js +3 -2
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/registry/server.d.ts.map +1 -1
  8. package/dist/registry/server.js +9 -5
  9. package/dist/registry/server.js.map +1 -1
  10. package/package.json +9 -7
  11. package/AGENTS.md +0 -23
  12. package/src/cli/discover.ts +0 -223
  13. package/src/cli/index.ts +0 -40
  14. package/src/connectors/base.ts +0 -75
  15. package/src/connectors/custom.ts +0 -139
  16. package/src/connectors/github.ts +0 -195
  17. package/src/connectors/google-drive.ts +0 -217
  18. package/src/connectors/index.ts +0 -86
  19. package/src/connectors/postgres.ts +0 -148
  20. package/src/connectors/slack.ts +0 -188
  21. package/src/core/auth.ts +0 -109
  22. package/src/core/registry.ts +0 -301
  23. package/src/core/tokenizer.ts +0 -40
  24. package/src/governance/audit.ts +0 -182
  25. package/src/governance/index.ts +0 -4
  26. package/src/governance/policy.ts +0 -187
  27. package/src/governance/rate-limiter.ts +0 -95
  28. package/src/governance/types.ts +0 -100
  29. package/src/identity/access-control.ts +0 -119
  30. package/src/identity/index.ts +0 -3
  31. package/src/identity/manager.ts +0 -207
  32. package/src/identity/types.ts +0 -91
  33. package/src/index.ts +0 -16
  34. package/src/registry/server.ts +0 -195
  35. package/src/types/index.ts +0 -128
  36. package/src/utils/config.ts +0 -78
  37. package/src/utils/index.ts +0 -47
  38. package/src/workflow/engine.ts +0 -187
  39. package/src/workflow/index.ts +0 -3
  40. package/src/workflow/templates.ts +0 -220
  41. package/src/workflow/types.ts +0 -89
  42. package/tsconfig.json +0 -25
@@ -1,207 +0,0 @@
1
- import jwt from 'jsonwebtoken';
2
- import type { Identity, Role, Permission, IdentityContext } from './types.js';
3
-
4
- export class IdentityManager {
5
- private identities: Map<string, Identity> = new Map();
6
- private roles: Map<string, Role> = new Map();
7
- private jwtSecret: string;
8
-
9
- constructor(jwtSecret: string) {
10
- this.jwtSecret = jwtSecret;
11
- this.initializeDefaultRoles();
12
- }
13
-
14
- private initializeDefaultRoles(): void {
15
- const defaultRoles: Role[] = [
16
- {
17
- id: 'admin',
18
- name: 'Administrator',
19
- description: 'Full access to all resources',
20
- permissions: ['admin', 'tools:read', 'tools:write', 'tools:execute', 'servers:read', 'servers:write', 'workflows:read', 'workflows:write', 'workflows:execute'],
21
- createdAt: new Date().toISOString(),
22
- updatedAt: new Date().toISOString(),
23
- },
24
- {
25
- id: 'developer',
26
- name: 'Developer',
27
- description: 'Can read and execute tools, manage workflows',
28
- permissions: ['tools:read', 'tools:execute', 'servers:read', 'workflows:read', 'workflows:write', 'workflows:execute'],
29
- createdAt: new Date().toISOString(),
30
- updatedAt: new Date().toISOString(),
31
- },
32
- {
33
- id: 'viewer',
34
- name: 'Viewer',
35
- description: 'Read-only access to tools and workflows',
36
- permissions: ['tools:read', 'servers:read', 'workflows:read'],
37
- createdAt: new Date().toISOString(),
38
- updatedAt: new Date().toISOString(),
39
- },
40
- {
41
- id: 'service',
42
- name: 'Service Account',
43
- description: 'Automated service with limited permissions',
44
- permissions: ['tools:read', 'tools:execute', 'workflows:read', 'workflows:execute'],
45
- createdAt: new Date().toISOString(),
46
- updatedAt: new Date().toISOString(),
47
- },
48
- ];
49
-
50
- for (const role of defaultRoles) {
51
- this.roles.set(role.id, role);
52
- }
53
- }
54
-
55
- registerIdentity(identity: Identity): void {
56
- this.identities.set(identity.id, identity);
57
- }
58
-
59
- getIdentity(id: string): Identity | undefined {
60
- return this.identities.get(id);
61
- }
62
-
63
- getAllIdentities(): Identity[] {
64
- return Array.from(this.identities.values());
65
- }
66
-
67
- deleteIdentity(id: string): boolean {
68
- return this.identities.delete(id);
69
- }
70
-
71
- registerRole(role: Role): void {
72
- this.roles.set(role.id, role);
73
- }
74
-
75
- getRole(id: string): Role | undefined {
76
- return this.roles.get(id);
77
- }
78
-
79
- getAllRoles(): Role[] {
80
- return Array.from(this.roles.values());
81
- }
82
-
83
- getEffectivePermissions(identityId: string): Permission[] {
84
- const identity = this.identities.get(identityId);
85
- if (!identity) return [];
86
-
87
- const permissions = new Set<Permission>(identity.permissions);
88
-
89
- for (const roleId of identity.roleIds) {
90
- const role = this.roles.get(roleId);
91
- if (role) {
92
- for (const permission of role.permissions) {
93
- permissions.add(permission);
94
- }
95
- }
96
- }
97
-
98
- return Array.from(permissions);
99
- }
100
-
101
- hasPermission(identityId: string, permission: Permission): boolean {
102
- const permissions = this.getEffectivePermissions(identityId);
103
- if (permissions.includes('admin')) return true;
104
- return permissions.includes(permission);
105
- }
106
-
107
- canAccessTool(identityId: string, toolId: string): boolean {
108
- const identity = this.identities.get(identityId);
109
- if (!identity) return false;
110
-
111
- if (identity.constraints.allowedTools?.length) {
112
- return identity.constraints.allowedTools.some(pattern =>
113
- toolId === pattern || toolId.includes(pattern.replace('*', ''))
114
- );
115
- }
116
-
117
- if (identity.constraints.deniedTools?.length) {
118
- return !identity.constraints.deniedTools.some(pattern =>
119
- toolId === pattern || toolId.includes(pattern.replace('*', ''))
120
- );
121
- }
122
-
123
- return true;
124
- }
125
-
126
- canAccessServer(identityId: string, serverId: string): boolean {
127
- const identity = this.identities.get(identityId);
128
- if (!identity) return false;
129
-
130
- if (identity.constraints.allowedServers?.length) {
131
- return identity.constraints.allowedServers.includes(serverId);
132
- }
133
-
134
- if (identity.constraints.deniedServers?.length) {
135
- return !identity.constraints.deniedServers.includes(serverId);
136
- }
137
-
138
- return true;
139
- }
140
-
141
- createContext(identityId: string, options?: { sessionId?: string; requestId?: string }): IdentityContext | null {
142
- const identity = this.identities.get(identityId);
143
- if (!identity) return null;
144
-
145
- const permissions = this.getEffectivePermissions(identityId);
146
- const now = new Date().toISOString();
147
-
148
- return {
149
- agentId: identity.id,
150
- agentName: identity.name,
151
- agentType: identity.type,
152
- requestId: options?.requestId || `req-${Date.now()}`,
153
- permissions,
154
- constraints: identity.constraints as IdentityContext['constraints'],
155
- metadata: identity.metadata,
156
- issuedAt: now,
157
- expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
158
- };
159
- }
160
-
161
- generateToken(identityId: string, options?: { sessionId?: string; expiresInSeconds?: number }): string | null {
162
- const context = this.createContext(identityId, { sessionId: options?.sessionId });
163
- if (!context) return null;
164
-
165
- const expiresIn = options?.expiresInSeconds || 86400;
166
-
167
- return jwt.sign(
168
- {
169
- agentId: context.agentId,
170
- agentName: context.agentName,
171
- agentType: context.agentType,
172
- permissions: context.permissions,
173
- constraints: context.constraints,
174
- metadata: context.metadata,
175
- },
176
- this.jwtSecret,
177
- { expiresIn }
178
- );
179
- }
180
-
181
- verifyToken(token: string): IdentityContext | null {
182
- try {
183
- const payload = jwt.verify(token, this.jwtSecret) as jwt.JwtPayload & {
184
- agentId: string;
185
- agentName: string;
186
- agentType: 'user' | 'agent' | 'service' | 'system';
187
- permissions: Permission[];
188
- constraints: Record<string, unknown>;
189
- metadata: Record<string, unknown>;
190
- };
191
-
192
- return {
193
- agentId: payload.agentId,
194
- agentName: payload.agentName,
195
- agentType: payload.agentType,
196
- requestId: payload.iat ? `req-${payload.iat}` : `req-${Date.now()}`,
197
- permissions: payload.permissions,
198
- constraints: payload.constraints as IdentityContext['constraints'],
199
- metadata: payload.metadata,
200
- issuedAt: new Date(payload.iat! * 1000).toISOString(),
201
- expiresAt: new Date(payload.exp! * 1000).toISOString(),
202
- };
203
- } catch {
204
- return null;
205
- }
206
- }
207
- }
@@ -1,91 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export const PermissionSchema = z.enum([
4
- 'tools:read',
5
- 'tools:write',
6
- 'tools:execute',
7
- 'servers:read',
8
- 'servers:write',
9
- 'workflows:read',
10
- 'workflows:write',
11
- 'workflows:execute',
12
- 'admin',
13
- ]);
14
-
15
- export const RoleSchema = z.object({
16
- id: z.string(),
17
- name: z.string(),
18
- description: z.string(),
19
- permissions: z.array(PermissionSchema).default([]),
20
- parentRoleId: z.string().optional(),
21
- createdAt: z.string(),
22
- updatedAt: z.string(),
23
- });
24
-
25
- export const AgentIdentitySchema = z.object({
26
- id: z.string(),
27
- name: z.string(),
28
- type: z.enum(['user', 'agent', 'service', 'system']),
29
- description: z.string().optional(),
30
- roleIds: z.array(z.string()).default([]),
31
- permissions: z.array(PermissionSchema).default([]),
32
- constraints: z.object({
33
- maxToolsPerRequest: z.number().default(10),
34
- maxConcurrentExecutions: z.number().default(5),
35
- allowedServers: z.array(z.string()).optional(),
36
- deniedServers: z.array(z.string()).optional(),
37
- allowedTools: z.array(z.string()).optional(),
38
- deniedTools: z.array(z.string()).optional(),
39
- rateLimitPerMinute: z.number().optional(),
40
- rateLimitPerHour: z.number().optional(),
41
- }).default({}),
42
- metadata: z.record(z.any()).default({}),
43
- trustLevel: z.enum(['untrusted', 'low', 'medium', 'high', 'fully-trusted']).default('medium'),
44
- createdAt: z.string(),
45
- updatedAt: z.string(),
46
- lastActiveAt: z.string().optional(),
47
- });
48
-
49
- export const IdentityContextSchema = z.object({
50
- agentId: z.string(),
51
- agentName: z.string(),
52
- agentType: z.enum(['user', 'agent', 'service', 'system']),
53
- sessionId: z.string().optional(),
54
- requestId: z.string(),
55
- permissions: z.array(PermissionSchema).default([]),
56
- constraints: z.record(z.any()).default({}),
57
- metadata: z.record(z.any()).default({}),
58
- issuedAt: z.string(),
59
- expiresAt: z.string().optional(),
60
- });
61
-
62
- export type Permission = z.infer<typeof PermissionSchema>;
63
- export type Role = z.infer<typeof RoleSchema>;
64
- export type AgentIdentity = z.infer<typeof IdentitySchema>;
65
- export type IdentityContext = z.infer<typeof IdentityContextSchema>;
66
-
67
- export const IdentitySchema = z.object({
68
- id: z.string(),
69
- name: z.string(),
70
- type: z.enum(['user', 'agent', 'service', 'system']),
71
- description: z.string().optional(),
72
- roleIds: z.array(z.string()).default([]),
73
- permissions: z.array(PermissionSchema).default([]),
74
- constraints: z.object({
75
- maxToolsPerRequest: z.number().default(10),
76
- maxConcurrentExecutions: z.number().default(5),
77
- allowedServers: z.array(z.string()).optional(),
78
- deniedServers: z.array(z.string()).optional(),
79
- allowedTools: z.array(z.string()).optional(),
80
- deniedTools: z.array(z.string()).optional(),
81
- rateLimitPerMinute: z.number().optional(),
82
- rateLimitPerHour: z.number().optional(),
83
- }).default({}),
84
- metadata: z.record(z.any()).default({}),
85
- trustLevel: z.enum(['untrusted', 'low', 'medium', 'high', 'fully-trusted']).default('medium'),
86
- createdAt: z.string(),
87
- updatedAt: z.string(),
88
- lastActiveAt: z.string().optional(),
89
- });
90
-
91
- export type Identity = z.infer<typeof IdentitySchema>;
package/src/index.ts DELETED
@@ -1,16 +0,0 @@
1
- export { ToolRegistry } from './core/registry.js';
2
- export { AuthService, type AuthContext, type JWTPayload } from './core/auth.js';
3
- export { TokenCounter } from './core/tokenizer.js';
4
- export { RegistryServer } from './registry/server.js';
5
-
6
- export { WorkflowEngine, WORKFLOW_TEMPLATES, createWorkflowFromTemplate } from './workflow/index.js';
7
- export type { Workflow, Node, Edge, WorkflowExecution, WorkflowTemplate, ExecutionLog, NodeType } from './workflow/types.js';
8
-
9
- export { IdentityManager, AccessControl, type AccessDecision } from './identity/index.js';
10
- export type { Identity, Role, Permission, IdentityContext } from './identity/types.js';
11
-
12
- export { AuditLogger, PolicyEngine, RateLimiter } from './governance/index.js';
13
- export type { AuditEvent, GovernancePolicy, PolicyRule, ComplianceReport } from './governance/types.js';
14
-
15
- export * from './types/index.js';
16
- export * from './connectors/index.js';
@@ -1,195 +0,0 @@
1
- import express from 'express';
2
- import type { Request, Response, NextFunction } from 'express';
3
- import cors from 'cors';
4
- import helmet from 'helmet';
5
- import { ToolRegistry } from '../core/registry.js';
6
- import { AuthService } from '../core/auth.js';
7
- import { DiscoveryQuerySchema } from '../types/index.js';
8
- import { createAllConnectors, createServerFromConnector } from '../connectors/index.js';
9
- import type { RegistryConfig } from '../types/index.js';
10
-
11
- export class RegistryServer {
12
- private app: express.Application;
13
- private registry: ToolRegistry;
14
- private auth: AuthService;
15
- private config: RegistryConfig;
16
-
17
- constructor(config: RegistryConfig) {
18
- this.config = config;
19
- this.registry = new ToolRegistry(config.contextTokenBudget);
20
- this.auth = new AuthService(config.jwtSecret, config.apiKey);
21
- this.app = express();
22
- this.setupMiddleware();
23
- this.setupRoutes();
24
- this.initializeConnectors();
25
- }
26
-
27
- private setupMiddleware(): void {
28
- this.app.use(helmet());
29
- this.app.use(cors());
30
- this.app.use(express.json());
31
-
32
- this.app.use((req: Request, _res: Response, next: NextFunction) => {
33
- console.log(`${new Date().toISOString()} ${req.method} ${req.path}`);
34
- next();
35
- });
36
- }
37
-
38
- private setupRoutes(): void {
39
- this.app.get('/api/v1/health', (_req: Request, res: Response) => {
40
- res.json({
41
- name: 'OpalServe',
42
- status: 'healthy',
43
- version: '1.0.0',
44
- timestamp: new Date().toISOString(),
45
- uptime: process.uptime(),
46
- });
47
- });
48
-
49
- this.app.get('/api/v1/discover', async (req: Request, res: Response) => {
50
- try {
51
- const queryResult = DiscoveryQuerySchema.safeParse(req.query);
52
- if (!queryResult.success) {
53
- res.status(400).json({ error: 'Invalid query', details: queryResult.error.issues });
54
- return;
55
- }
56
-
57
- const result = await this.registry.discover(queryResult.data);
58
- res.json(result);
59
- } catch (error) {
60
- console.error('Discovery error:', error);
61
- res.status(500).json({ error: 'Discovery failed' });
62
- }
63
- });
64
-
65
- this.app.get('/api/v1/tools', (_req: Request, res: Response) => {
66
- const tools = this.registry.getAllTools();
67
- res.json({
68
- tools,
69
- total: tools.length,
70
- });
71
- });
72
-
73
- this.app.get('/api/v1/tools/:id', (req: Request, res: Response) => {
74
- const toolId = String(req.params.id || '');
75
- const tool = this.registry.getTool(toolId);
76
- if (!tool) {
77
- res.status(404).json({ error: 'Tool not found' });
78
- return;
79
- }
80
- res.json(tool);
81
- });
82
-
83
- this.app.get('/api/v1/servers', (_req: Request, res: Response) => {
84
- const servers = this.registry.getAllServers();
85
- res.json({
86
- servers,
87
- total: servers.length,
88
- });
89
- });
90
-
91
- this.app.get('/api/v1/servers/:id', (req: Request, res: Response) => {
92
- const serverId = String(req.params.id || '');
93
- const server = this.registry.getServer(serverId);
94
- if (!server) {
95
- res.status(404).json({ error: 'Server not found' });
96
- return;
97
- }
98
- res.json(server);
99
- });
100
-
101
- this.app.post('/api/v1/servers/:id/refresh', async (req: Request, res: Response) => {
102
- try {
103
- const serverId = String(req.params.id || '');
104
- await this.registry.refreshServer(serverId);
105
- const server = this.registry.getServer(serverId);
106
- res.json(server);
107
- } catch {
108
- res.status(500).json({ error: 'Refresh failed' });
109
- }
110
- });
111
-
112
- this.app.post('/api/v1/servers/register', async (req: Request, res: Response) => {
113
- try {
114
- const { server, tools } = req.body;
115
- if (server) {
116
- this.registry.registerServer(server);
117
- }
118
- if (tools && Array.isArray(tools)) {
119
- for (const tool of tools) {
120
- this.registry.registerTool(tool);
121
- }
122
- }
123
- res.json({ success: true });
124
- } catch {
125
- res.status(500).json({ error: 'Registration failed' });
126
- }
127
- });
128
-
129
- if (this.config.enableAuth) {
130
- this.app.post('/api/v1/auth/token', (req: Request, res: Response) => {
131
- const { agentId, permissions, context } = req.body;
132
- if (!agentId) {
133
- res.status(400).json({ error: 'agentId required' });
134
- return;
135
- }
136
- const token = this.auth.generateToken({
137
- agentId,
138
- permissions: permissions || ['read', 'discover'],
139
- context: context || {},
140
- });
141
- res.json({ token });
142
- });
143
-
144
- this.app.use('/api/v1/discover', this.auth.middleware());
145
- this.app.use('/api/v1/tools', this.auth.middleware());
146
- this.app.use('/api/v1/servers', this.auth.middleware());
147
- }
148
- }
149
-
150
- private async initializeConnectors(): Promise<void> {
151
- const connectors = createAllConnectors();
152
-
153
- for (const [id, connector] of connectors) {
154
- try {
155
- await connector.connect();
156
- const server = createServerFromConnector(connector);
157
- this.registry.registerServer(server);
158
- this.registry.registerServerInstance(connector);
159
-
160
- const tools = connector.getTools();
161
- for (const tool of tools) {
162
- this.registry.registerTool(tool);
163
- }
164
-
165
- console.log(`[${id}] Connected with ${tools.length} tools`);
166
- } catch (error) {
167
- console.error(`[${id}] Connection failed:`, error);
168
- }
169
- }
170
- }
171
-
172
- async start(): Promise<void> {
173
- return new Promise((resolve) => {
174
- this.app.listen(this.config.port, this.config.host, () => {
175
- console.log(`
176
- ╔══════════════════════════════════════════════════════════════╗
177
- ║ OpalServe Registry Server ║
178
- ╠══════════════════════════════════════════════════════════════╣
179
- ║ Name: OpalServe MCP Registry ║
180
- ║ HTTP: http://${this.config.host}:${this.config.port} ║
181
- ║ Health: http://${this.config.host}:${this.config.port}/api/v1/health ║
182
- ║ Discover: http://${this.config.host}:${this.config.port}/api/v1/discover ║
183
- ║ Tools API: http://${this.config.host}:${this.config.port}/api/v1/tools ║
184
- ║ Servers API:http://${this.config.host}:${this.config.port}/api/v1/servers ║
185
- ╚══════════════════════════════════════════════════════════════╝
186
- `);
187
- resolve();
188
- });
189
- });
190
- }
191
-
192
- async stop(): Promise<void> {
193
- console.log('Shutting down OpalServe registry...');
194
- }
195
- }
@@ -1,128 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export const ToolSchema = z.object({
4
- id: z.string(),
5
- name: z.string(),
6
- description: z.string(),
7
- serverId: z.string(),
8
- serverName: z.string(),
9
- inputSchema: z.record(z.any()),
10
- outputSchema: z.record(z.any()).optional(),
11
- tags: z.array(z.string()).default([]),
12
- capabilities: z.array(z.string()).default([]),
13
- authRequirements: z.object({
14
- required: z.array(z.string()).default([]),
15
- optional: z.array(z.string()).default([]),
16
- }).default({}),
17
- rateLimits: z.object({
18
- requestsPerMinute: z.number().optional(),
19
- requestsPerHour: z.number().optional(),
20
- }).optional(),
21
- contextRequirements: z.object({
22
- minTokens: z.number().default(0),
23
- maxTokens: z.number().default(1000),
24
- }).default({}),
25
- metadata: z.record(z.any()).default({}),
26
- createdAt: z.string(),
27
- updatedAt: z.string(),
28
- });
29
-
30
- export type Tool = z.infer<typeof ToolSchema>;
31
-
32
- export const ServerSchema = z.object({
33
- id: z.string(),
34
- name: z.string(),
35
- type: z.enum(['github', 'slack', 'postgres', 'google-drive', 'custom', 'http']),
36
- status: z.enum(['active', 'inactive', 'error', 'connecting']),
37
- endpoint: z.string().optional(),
38
- localCommand: z.string().optional(),
39
- description: z.string(),
40
- version: z.string().default('1.0.0'),
41
- capabilities: z.array(z.string()).default([]),
42
- tags: z.array(z.string()).default([]),
43
- health: z.object({
44
- status: z.enum(['healthy', 'degraded', 'unhealthy']),
45
- lastChecked: z.string(),
46
- responseTimeMs: z.number().optional(),
47
- errorCount: z.number().default(0),
48
- }).default({ status: 'healthy', lastChecked: new Date().toISOString() }),
49
- auth: z.object({
50
- type: z.enum(['none', 'api-key', 'oauth', 'jwt', 'basic']),
51
- configured: z.boolean().default(false),
52
- }).default({ type: 'none', configured: false }),
53
- metadata: z.record(z.any()).default({}),
54
- registeredAt: z.string(),
55
- lastSeen: z.string(),
56
- });
57
-
58
- export type Server = z.infer<typeof ServerSchema>;
59
-
60
- export const DiscoveryQuerySchema = z.object({
61
- query: z.string().optional(),
62
- capabilities: z.array(z.string()).optional(),
63
- tags: z.array(z.string()).optional(),
64
- limit: z.coerce.number().min(1).max(100).default(20),
65
- offset: z.coerce.number().min(0).default(0),
66
- contextBudget: z.coerce.number().min(1000).max(200000).default(128000),
67
- includeServers: z.coerce.boolean().default(true),
68
- });
69
-
70
- export type DiscoveryQuery = z.infer<typeof DiscoveryQuerySchema>;
71
-
72
- export const DiscoveryResultSchema = z.object({
73
- tools: z.array(z.object({
74
- tool: ToolSchema,
75
- relevanceScore: z.number().min(0).max(1),
76
- matchReasons: z.array(z.string()).default([]),
77
- tokenEstimate: z.number(),
78
- })),
79
- servers: z.array(ServerSchema),
80
- totalMatches: z.number(),
81
- contextUsed: z.number(),
82
- contextBudget: z.number(),
83
- suggestions: z.array(z.string()).default([]),
84
- queryInterpretation: z.string(),
85
- });
86
-
87
- export type DiscoveryResult = z.infer<typeof DiscoveryResultSchema>;
88
-
89
- export interface MCPServer {
90
- id: string;
91
- name: string;
92
- type: string;
93
- getTools(): Tool[];
94
- connect(): Promise<void>;
95
- disconnect(): Promise<void>;
96
- healthCheck(): Promise<{ healthy: boolean; latencyMs?: number }>;
97
- }
98
-
99
- export interface ConnectorConfig {
100
- serverId: string;
101
- endpoint?: string;
102
- auth?: {
103
- type: 'none' | 'api-key' | 'oauth' | 'jwt' | 'basic';
104
- credentials?: Record<string, string>;
105
- };
106
- options?: Record<string, unknown>;
107
- }
108
-
109
- export interface RegistryConfig {
110
- port: number;
111
- host: string;
112
- jwtSecret: string;
113
- apiKey?: string;
114
- maxToolsPerResponse: number;
115
- contextTokenBudget: number;
116
- enableAuth: boolean;
117
- }
118
-
119
- export interface ToolDefinition {
120
- name: string;
121
- description: string;
122
- inputSchema: Record<string, unknown>;
123
- tags?: string[];
124
- capabilities?: string[];
125
- authRequirements?: { required?: string[]; optional?: string[] };
126
- contextRequirements?: { minTokens?: number; maxTokens?: number };
127
- metadata?: Record<string, unknown>;
128
- }