@agenium/mcp-server 0.1.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/README.md +164 -0
- package/dist/bridge.d.ts +66 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +380 -0
- package/dist/bridge.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +122 -0
- package/dist/cli.js.map +1 -0
- package/dist/discovery.d.ts +82 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +154 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-transport.d.ts +63 -0
- package/dist/mcp-transport.d.ts.map +1 -0
- package/dist/mcp-transport.js +180 -0
- package/dist/mcp-transport.js.map +1 -0
- package/dist/types.d.ts +132 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +18 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @agenium/mcp-server CLI
|
|
4
|
+
*
|
|
5
|
+
* Quick way to bridge an MCP server to the AGENIUM network.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx @agenium/mcp-server --name weather-tools --command npx --args "-y @modelcontextprotocol/server-weather"
|
|
9
|
+
* npx @agenium/mcp-server --name my-tools --sse http://localhost:3001/sse
|
|
10
|
+
*/
|
|
11
|
+
import { MCPBridge } from './bridge.js';
|
|
12
|
+
function usage() {
|
|
13
|
+
console.log(`
|
|
14
|
+
@agenium/mcp-server — Bridge MCP servers to the AGENIUM agent:// network
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
agenium-mcp [options]
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
--name <name> Agent name (required)
|
|
21
|
+
--command <cmd> Stdio MCP server command
|
|
22
|
+
--args <args> Command arguments (space-separated, quote if needed)
|
|
23
|
+
--cwd <dir> Working directory for stdio server
|
|
24
|
+
--sse <url> SSE endpoint URL (instead of stdio)
|
|
25
|
+
--host <ip> Public host for DNS registration
|
|
26
|
+
--port <port> Listen port (default: auto)
|
|
27
|
+
--dns <server> DNS server (default: 185.204.169.26)
|
|
28
|
+
--no-register Skip DNS registration
|
|
29
|
+
--log <level> Log level: debug|info|warn|error|silent (default: info)
|
|
30
|
+
-h, --help Show this help
|
|
31
|
+
|
|
32
|
+
Examples:
|
|
33
|
+
# Bridge a weather MCP server
|
|
34
|
+
agenium-mcp --name weather --command npx --args "-y @modelcontextprotocol/server-weather" --host 1.2.3.4
|
|
35
|
+
|
|
36
|
+
# Bridge a running SSE server
|
|
37
|
+
agenium-mcp --name my-tools --sse http://localhost:3001/sse --host 1.2.3.4
|
|
38
|
+
`);
|
|
39
|
+
}
|
|
40
|
+
function parseArgs(argv) {
|
|
41
|
+
const result = {};
|
|
42
|
+
let i = 0;
|
|
43
|
+
while (i < argv.length) {
|
|
44
|
+
const arg = argv[i];
|
|
45
|
+
if (arg === '-h' || arg === '--help') {
|
|
46
|
+
result['help'] = true;
|
|
47
|
+
}
|
|
48
|
+
else if (arg === '--no-register') {
|
|
49
|
+
result['noRegister'] = true;
|
|
50
|
+
}
|
|
51
|
+
else if (arg?.startsWith('--') && i + 1 < argv.length) {
|
|
52
|
+
result[arg.slice(2)] = argv[i + 1];
|
|
53
|
+
i++;
|
|
54
|
+
}
|
|
55
|
+
i++;
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
async function main() {
|
|
60
|
+
const args = parseArgs(process.argv.slice(2));
|
|
61
|
+
if (args['help'] || !args['name']) {
|
|
62
|
+
usage();
|
|
63
|
+
process.exit(args['help'] ? 0 : 1);
|
|
64
|
+
}
|
|
65
|
+
const name = args['name'];
|
|
66
|
+
// Determine MCP config
|
|
67
|
+
let mcp;
|
|
68
|
+
if (args['sse']) {
|
|
69
|
+
mcp = { transport: 'sse', url: args['sse'] };
|
|
70
|
+
}
|
|
71
|
+
else if (args['command']) {
|
|
72
|
+
mcp = {
|
|
73
|
+
transport: 'stdio',
|
|
74
|
+
command: args['command'],
|
|
75
|
+
args: args['args'] ? args['args'].split(/\s+/) : undefined,
|
|
76
|
+
cwd: args['cwd'],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
console.error('Error: Either --command or --sse is required');
|
|
81
|
+
usage();
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
const bridge = new MCPBridge({
|
|
85
|
+
name,
|
|
86
|
+
mcp,
|
|
87
|
+
agent: {
|
|
88
|
+
publicHost: args['host'],
|
|
89
|
+
port: args['port'] ? parseInt(args['port']) : undefined,
|
|
90
|
+
dnsServer: args['dns'],
|
|
91
|
+
autoRegister: !args['noRegister'],
|
|
92
|
+
},
|
|
93
|
+
bridge: {
|
|
94
|
+
logLevel: args['log'] ?? 'info',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
// Handle graceful shutdown
|
|
98
|
+
const shutdown = async () => {
|
|
99
|
+
console.log('\nShutting down...');
|
|
100
|
+
await bridge.stop();
|
|
101
|
+
process.exit(0);
|
|
102
|
+
};
|
|
103
|
+
process.on('SIGINT', shutdown);
|
|
104
|
+
process.on('SIGTERM', shutdown);
|
|
105
|
+
// Start
|
|
106
|
+
try {
|
|
107
|
+
await bridge.start();
|
|
108
|
+
const tools = bridge.getTools();
|
|
109
|
+
console.log(`\n✅ Bridge running as agent://${name}`);
|
|
110
|
+
console.log(` Tools: ${tools.map((t) => t.name).join(', ') || 'none'}`);
|
|
111
|
+
console.log(` Press Ctrl+C to stop\n`);
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
console.error('Failed to start bridge:', err.message);
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
main().catch((err) => {
|
|
119
|
+
console.error('Fatal:', err);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,SAAS,KAAK;IACZ,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyBb,CAAC,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,MAAM,GAAqC,EAAE,CAAC;IACpD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YACrC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACxB,CAAC;aAAM,IAAI,GAAG,KAAK,eAAe,EAAE,CAAC;YACnC,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;QAC9B,CAAC;aAAM,IAAI,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YACxD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC;YACpC,CAAC,EAAE,CAAC;QACN,CAAC;QACD,CAAC,EAAE,CAAC;IACN,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,IAAI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,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenium/mcp-server — Discovery
|
|
3
|
+
*
|
|
4
|
+
* Discover MCP-bridged agents on the AGENIUM network and call their tools.
|
|
5
|
+
*/
|
|
6
|
+
import { MCPToolInfo, MCPResourceInfo, MCPPromptInfo } from './types.js';
|
|
7
|
+
export interface MCPDiscoveryConfig {
|
|
8
|
+
/** DNS server address */
|
|
9
|
+
dnsServer?: string;
|
|
10
|
+
/** DNS server port */
|
|
11
|
+
dnsPort?: number;
|
|
12
|
+
/** Request timeout in ms */
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DiscoveredMCPAgent {
|
|
16
|
+
/** Agent name */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Agent URI */
|
|
19
|
+
uri: string;
|
|
20
|
+
/** Endpoint URL */
|
|
21
|
+
endpoint: string;
|
|
22
|
+
/** Available tools */
|
|
23
|
+
tools: MCPToolInfo[];
|
|
24
|
+
/** Available resources */
|
|
25
|
+
resources: MCPResourceInfo[];
|
|
26
|
+
/** Available prompts */
|
|
27
|
+
prompts: MCPPromptInfo[];
|
|
28
|
+
/** Raw capabilities list */
|
|
29
|
+
capabilities: string[];
|
|
30
|
+
}
|
|
31
|
+
export declare class MCPAgentClient {
|
|
32
|
+
private agent;
|
|
33
|
+
private config;
|
|
34
|
+
private started;
|
|
35
|
+
constructor(clientName: string, config?: MCPDiscoveryConfig);
|
|
36
|
+
/** Start the client agent */
|
|
37
|
+
start(): Promise<void>;
|
|
38
|
+
/** Stop the client agent */
|
|
39
|
+
stop(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Connect to an MCP-bridged agent and discover its capabilities
|
|
42
|
+
*/
|
|
43
|
+
discover(agentUri: string): Promise<DiscoveredMCPAgent | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Call a tool on a remote MCP-bridged agent
|
|
46
|
+
*/
|
|
47
|
+
callTool(agentUri: string, toolName: string, args?: Record<string, unknown>): Promise<{
|
|
48
|
+
content: Array<{
|
|
49
|
+
type: string;
|
|
50
|
+
text?: string;
|
|
51
|
+
data?: string;
|
|
52
|
+
mimeType?: string;
|
|
53
|
+
}>;
|
|
54
|
+
isError?: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Read a resource from a remote MCP-bridged agent
|
|
58
|
+
*/
|
|
59
|
+
readResource(agentUri: string, resourceUri: string): Promise<{
|
|
60
|
+
contents: Array<{
|
|
61
|
+
uri: string;
|
|
62
|
+
text?: string;
|
|
63
|
+
blob?: string;
|
|
64
|
+
mimeType?: string;
|
|
65
|
+
}>;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Get a prompt from a remote MCP-bridged agent
|
|
69
|
+
*/
|
|
70
|
+
getPrompt(agentUri: string, promptName: string, args?: Record<string, string>): Promise<{
|
|
71
|
+
description?: string;
|
|
72
|
+
messages: Array<{
|
|
73
|
+
role: string;
|
|
74
|
+
content: {
|
|
75
|
+
type: string;
|
|
76
|
+
text?: string;
|
|
77
|
+
};
|
|
78
|
+
}>;
|
|
79
|
+
}>;
|
|
80
|
+
private ensureStarted;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAMzE,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,SAAS,CAAC,EAAE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CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IAuBF;;OAEG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;QACT,QAAQ,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACnF,CAAC;IAmBF;;OAEG;IACG,SAAS,CACb,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC;QACT,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAC,CAAC;KAC7E,CAAC;IAuBF,OAAO,CAAC,aAAa;CAKtB"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenium/mcp-server — Discovery
|
|
3
|
+
*
|
|
4
|
+
* Discover MCP-bridged agents on the AGENIUM network and call their tools.
|
|
5
|
+
*/
|
|
6
|
+
import { createAgent } from 'agenium';
|
|
7
|
+
const DEFAULTS = {
|
|
8
|
+
dnsServer: '185.204.169.26',
|
|
9
|
+
dnsPort: 3000,
|
|
10
|
+
timeoutMs: 15_000,
|
|
11
|
+
};
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// MCP Client (for calling remote MCP-bridged agents)
|
|
14
|
+
// ============================================================================
|
|
15
|
+
export class MCPAgentClient {
|
|
16
|
+
agent;
|
|
17
|
+
config;
|
|
18
|
+
started = false;
|
|
19
|
+
constructor(clientName, config) {
|
|
20
|
+
this.config = { ...DEFAULTS, ...config };
|
|
21
|
+
this.agent = createAgent(clientName, {
|
|
22
|
+
dnsServer: this.config.dnsServer,
|
|
23
|
+
listenPort: 0,
|
|
24
|
+
persistence: false,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Start the client agent */
|
|
28
|
+
async start() {
|
|
29
|
+
if (this.started)
|
|
30
|
+
return;
|
|
31
|
+
await this.agent.start();
|
|
32
|
+
this.started = true;
|
|
33
|
+
}
|
|
34
|
+
/** Stop the client agent */
|
|
35
|
+
async stop() {
|
|
36
|
+
if (!this.started)
|
|
37
|
+
return;
|
|
38
|
+
await this.agent.stop();
|
|
39
|
+
this.started = false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Connect to an MCP-bridged agent and discover its capabilities
|
|
43
|
+
*/
|
|
44
|
+
async discover(agentUri) {
|
|
45
|
+
this.ensureStarted();
|
|
46
|
+
const result = await this.agent.connect(agentUri);
|
|
47
|
+
if (!result.success || !result.session) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const sessionId = result.session.id;
|
|
51
|
+
try {
|
|
52
|
+
// Get capabilities
|
|
53
|
+
const caps = await this.agent.request(sessionId, 'capabilities');
|
|
54
|
+
// Get tools
|
|
55
|
+
const toolsResult = await this.agent.request(sessionId, 'tools/list');
|
|
56
|
+
const tools = toolsResult?.tools ?? [];
|
|
57
|
+
// Get resources
|
|
58
|
+
let resources = [];
|
|
59
|
+
try {
|
|
60
|
+
const resourcesResult = await this.agent.request(sessionId, 'resources/list');
|
|
61
|
+
resources = resourcesResult?.resources ?? [];
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// May not support resources
|
|
65
|
+
}
|
|
66
|
+
// Get prompts
|
|
67
|
+
let prompts = [];
|
|
68
|
+
try {
|
|
69
|
+
const promptsResult = await this.agent.request(sessionId, 'prompts/list');
|
|
70
|
+
prompts = promptsResult?.prompts ?? [];
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// May not support prompts
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
name: caps?.agent ?? agentUri.replace('agent://', ''),
|
|
77
|
+
uri: agentUri,
|
|
78
|
+
endpoint: '',
|
|
79
|
+
tools,
|
|
80
|
+
resources,
|
|
81
|
+
prompts,
|
|
82
|
+
capabilities: caps?.tools ?? [],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Call a tool on a remote MCP-bridged agent
|
|
91
|
+
*/
|
|
92
|
+
async callTool(agentUri, toolName, args) {
|
|
93
|
+
this.ensureStarted();
|
|
94
|
+
const result = await this.agent.connect(agentUri);
|
|
95
|
+
if (!result.success || !result.session) {
|
|
96
|
+
throw new Error(`Failed to connect to ${agentUri}: ${result.error}`);
|
|
97
|
+
}
|
|
98
|
+
const response = await this.agent.request(result.session.id, 'tools/call', {
|
|
99
|
+
name: toolName,
|
|
100
|
+
arguments: args,
|
|
101
|
+
});
|
|
102
|
+
if (response?.error) {
|
|
103
|
+
throw new Error(`Tool call failed: ${response.error.message}`);
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
content: response?.content ?? [],
|
|
107
|
+
isError: response?.isError,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Read a resource from a remote MCP-bridged agent
|
|
112
|
+
*/
|
|
113
|
+
async readResource(agentUri, resourceUri) {
|
|
114
|
+
this.ensureStarted();
|
|
115
|
+
const result = await this.agent.connect(agentUri);
|
|
116
|
+
if (!result.success || !result.session) {
|
|
117
|
+
throw new Error(`Failed to connect to ${agentUri}: ${result.error}`);
|
|
118
|
+
}
|
|
119
|
+
const response = await this.agent.request(result.session.id, 'resources/read', {
|
|
120
|
+
uri: resourceUri,
|
|
121
|
+
});
|
|
122
|
+
if (response?.error) {
|
|
123
|
+
throw new Error(`Resource read failed: ${response.error.message}`);
|
|
124
|
+
}
|
|
125
|
+
return { contents: response?.contents ?? [] };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get a prompt from a remote MCP-bridged agent
|
|
129
|
+
*/
|
|
130
|
+
async getPrompt(agentUri, promptName, args) {
|
|
131
|
+
this.ensureStarted();
|
|
132
|
+
const result = await this.agent.connect(agentUri);
|
|
133
|
+
if (!result.success || !result.session) {
|
|
134
|
+
throw new Error(`Failed to connect to ${agentUri}: ${result.error}`);
|
|
135
|
+
}
|
|
136
|
+
const response = await this.agent.request(result.session.id, 'prompts/get', {
|
|
137
|
+
name: promptName,
|
|
138
|
+
arguments: args,
|
|
139
|
+
});
|
|
140
|
+
if (response?.error) {
|
|
141
|
+
throw new Error(`Prompt get failed: ${response.error.message}`);
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
description: response?.description,
|
|
145
|
+
messages: response?.messages ?? [],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
ensureStarted() {
|
|
149
|
+
if (!this.started) {
|
|
150
|
+
throw new Error('MCPAgentClient not started. Call start() first.');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAe,WAAW,EAAuB,MAAM,SAAS,CAAC;AAgBxE,MAAM,QAAQ,GAAG;IACf,SAAS,EAAE,gBAAgB;IAC3B,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,MAAM;CAClB,CAAC;AAuBF,+EAA+E;AAC/E,qDAAqD;AACrD,+EAA+E;AAE/E,MAAM,OAAO,cAAc;IACjB,KAAK,CAAQ;IACb,MAAM,CAAqB;IAC3B,OAAO,GAAG,KAAK,CAAC;IAExB,YAAY,UAAkB,EAAE,MAA2B;QAC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|
+
* import { MCPBridge } from '@agenium/mcp-server';
|
|
9
|
+
*
|
|
10
|
+
* const bridge = new MCPBridge({
|
|
11
|
+
* name: 'weather-tools',
|
|
12
|
+
* mcp: {
|
|
13
|
+
* transport: 'stdio',
|
|
14
|
+
* command: 'npx',
|
|
15
|
+
* args: ['-y', '@modelcontextprotocol/server-weather'],
|
|
16
|
+
* },
|
|
17
|
+
* agent: {
|
|
18
|
+
* publicHost: '203.0.113.1',
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* await bridge.start();
|
|
23
|
+
* // Now registered as agent://weather-tools on the AGENIUM network
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export { MCPBridge } from './bridge.js';
|
|
27
|
+
export { MCPAgentClient, type DiscoveredMCPAgent, type MCPDiscoveryConfig } from './discovery.js';
|
|
28
|
+
export { MCPTransportManager } from './mcp-transport.js';
|
|
29
|
+
export { type MCPBridgeConfig, type MCPStdioConfig, type MCPHttpConfig, type MCPStreamableHttpConfig, type MCPServerConfig, type MCPToolInfo, type MCPResourceInfo, type MCPPromptInfo, BridgeState, } from './types.js';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGlG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenium/mcp-server
|
|
3
|
+
*
|
|
4
|
+
* Bridge MCP (Model Context Protocol) servers to the AGENIUM agent:// network.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { MCPBridge } from '@agenium/mcp-server';
|
|
9
|
+
*
|
|
10
|
+
* const bridge = new MCPBridge({
|
|
11
|
+
* name: 'weather-tools',
|
|
12
|
+
* mcp: {
|
|
13
|
+
* transport: 'stdio',
|
|
14
|
+
* command: 'npx',
|
|
15
|
+
* args: ['-y', '@modelcontextprotocol/server-weather'],
|
|
16
|
+
* },
|
|
17
|
+
* agent: {
|
|
18
|
+
* publicHost: '203.0.113.1',
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* await bridge.start();
|
|
23
|
+
* // Now registered as agent://weather-tools on the AGENIUM network
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
// Main bridge
|
|
27
|
+
export { MCPBridge } from './bridge.js';
|
|
28
|
+
// Discovery client
|
|
29
|
+
export { MCPAgentClient } from './discovery.js';
|
|
30
|
+
// Transport manager (for advanced use)
|
|
31
|
+
export { MCPTransportManager } from './mcp-transport.js';
|
|
32
|
+
// Types
|
|
33
|
+
export { BridgeState, } from './types.js';
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,mBAAmB;AACnB,OAAO,EAAE,cAAc,EAAoD,MAAM,gBAAgB,CAAC;AAElG,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,QAAQ;AACR,OAAO,EASL,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenium/mcp-server — MCP Transport Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages the connection to an MCP server (stdio, SSE, or streamable HTTP).
|
|
5
|
+
* Provides a unified interface for listing tools, calling tools, etc.
|
|
6
|
+
*/
|
|
7
|
+
import { MCPServerConfig, MCPToolInfo, MCPResourceInfo, MCPPromptInfo } from './types.js';
|
|
8
|
+
export declare class MCPTransportManager {
|
|
9
|
+
private client;
|
|
10
|
+
private transport;
|
|
11
|
+
private config;
|
|
12
|
+
private connected;
|
|
13
|
+
constructor(config: MCPServerConfig);
|
|
14
|
+
/** Connect to the MCP server */
|
|
15
|
+
connect(): Promise<void>;
|
|
16
|
+
/** Disconnect from the MCP server */
|
|
17
|
+
disconnect(): Promise<void>;
|
|
18
|
+
/** Check if connected */
|
|
19
|
+
isConnected(): boolean;
|
|
20
|
+
/** List all tools exposed by the MCP server */
|
|
21
|
+
listTools(): Promise<MCPToolInfo[]>;
|
|
22
|
+
/** Call a tool on the MCP server */
|
|
23
|
+
callTool(name: string, args?: Record<string, unknown>): Promise<{
|
|
24
|
+
content: Array<{
|
|
25
|
+
type: string;
|
|
26
|
+
text?: string;
|
|
27
|
+
data?: string;
|
|
28
|
+
mimeType?: string;
|
|
29
|
+
}>;
|
|
30
|
+
isError?: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
/** List all resources */
|
|
33
|
+
listResources(): Promise<MCPResourceInfo[]>;
|
|
34
|
+
/** Read a resource */
|
|
35
|
+
readResource(uri: string): Promise<{
|
|
36
|
+
contents: Array<{
|
|
37
|
+
uri: string;
|
|
38
|
+
text?: string;
|
|
39
|
+
blob?: string;
|
|
40
|
+
mimeType?: string;
|
|
41
|
+
}>;
|
|
42
|
+
}>;
|
|
43
|
+
/** List all prompts */
|
|
44
|
+
listPrompts(): Promise<MCPPromptInfo[]>;
|
|
45
|
+
/** Get a prompt */
|
|
46
|
+
getPrompt(name: string, args?: Record<string, string>): Promise<{
|
|
47
|
+
description?: string;
|
|
48
|
+
messages: Array<{
|
|
49
|
+
role: string;
|
|
50
|
+
content: {
|
|
51
|
+
type: string;
|
|
52
|
+
text?: string;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
56
|
+
/** Get MCP server info (if available after connect) */
|
|
57
|
+
getServerInfo(): {
|
|
58
|
+
name?: string;
|
|
59
|
+
version?: string;
|
|
60
|
+
} | null;
|
|
61
|
+
private ensureConnected;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=mcp-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-transport.d.ts","sourceRoot":"","sources":["../src/mcp-transport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EACL,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACd,MAAM,YAAY,CAAC;AAMpB,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAA0D;IAC3E,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,eAAe;IAQnC,gCAAgC;IAC1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA+C9B,qCAAqC;IAC/B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAWjC,yBAAyB;IACzB,WAAW,IAAI,OAAO;IAQtB,+CAA+C;IACzC,SAAS,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAUzC,oCAAoC;IAC9B,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC;QACT,OAAO,EAAE,KAAK,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