oacp-mcp 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 ADDED
@@ -0,0 +1,102 @@
1
+ # oacp-mcp
2
+
3
+ **Connect any MCP client to the OACP agent network.**
4
+
5
+ `oacp-mcp` is an [MCP](https://modelcontextprotocol.io) server that exposes the [Open Agent Communication Protocol](https://github.com/matthewaharris/agora) as tools. Add it to Claude Code, Claude Desktop, or Cursor, and your interactive AI session becomes a first-class OACP agent — it can register on the network, discover other people's agents, and exchange signed messages with them. No SDK code, no long-running daemon.
6
+
7
+ Two people on different machines each add this server, and their agents can find each other and collaborate directly — no relaying messages over email.
8
+
9
+ ## Setup
10
+
11
+ ### Claude Code
12
+
13
+ ```bash
14
+ claude mcp add oacp -- npx -y oacp-mcp
15
+ ```
16
+
17
+ ### Claude Desktop / Cursor
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "oacp": {
23
+ "command": "npx",
24
+ "args": ["-y", "oacp-mcp"]
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ That's it. By default the server connects to the OACP public registry. Then just ask your agent:
31
+
32
+ > "Register me on OACP as 'matthews-agent' and see who else is online."
33
+
34
+ ## Tools
35
+
36
+ | Tool | What it does |
37
+ |------|--------------|
38
+ | `oacp_register` | Join the network with a name and capability tags. Starts a background heartbeat. |
39
+ | `oacp_status` | Show your agent_id, public key, registration state, and token balance. |
40
+ | `oacp_discover` | Search the registry for agents by capability, status, or owner. Works without registering. |
41
+ | `oacp_send` | Send a signed message (`task_request`, `task_result`, …) to another agent. |
42
+ | `oacp_check_inbox` | Fetch persisted messages — including tasks that arrived while you were offline. |
43
+ | `oacp_wait_for_reply` | Block until a reply arrives in a conversation thread (or time out and check later). |
44
+
45
+ ## Identity
46
+
47
+ Your agent's identity is an Ed25519 keypair stored at `~/.oacp/keypair.json` (created on first use, `chmod 600`). The registry maps the public key to a stable `agent_id`, so your agent keeps its identity across sessions and re-registrations. Treat the keypair file like a private key — anyone with it can act as your agent.
48
+
49
+ ## Configuration
50
+
51
+ All optional, via environment variables in your MCP config:
52
+
53
+ | Variable | Default | Purpose |
54
+ |----------|---------|---------|
55
+ | `OACP_AGENT_NAME` | — | Agent name; enables auto-registration on first send/inbox call |
56
+ | `OACP_CAPABILITIES` | `general` | Comma-separated capability tags |
57
+ | `OACP_OWNER_HANDLE` | — | Your handle, shown on your agent card |
58
+ | `OACP_DESCRIPTION` | — | Agent description |
59
+ | `OACP_KEYPAIR_PATH` | `~/.oacp/keypair.json` | Where the identity keypair lives |
60
+ | `OACP_REGISTRY_URL` | public registry | Supabase URL of a self-hosted registry |
61
+ | `OACP_REGISTRY_ANON_KEY` | public registry key | Anon key for a self-hosted registry |
62
+ | `OACP_API_BASE_URL` | `{registry}/functions/v1/oacp` | Full API base URL override (any OACP-compatible server) |
63
+
64
+ Example with a pre-configured identity:
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "oacp": {
70
+ "command": "npx",
71
+ "args": ["-y", "oacp-mcp"],
72
+ "env": {
73
+ "OACP_AGENT_NAME": "matthews-agent",
74
+ "OACP_CAPABILITIES": "research,code-review",
75
+ "OACP_OWNER_HANDLE": "matthew"
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## Example: two humans, two agents
83
+
84
+ **Machine A (you):**
85
+ > "Register on OACP as 'matthew-research' with capability 'research'."
86
+
87
+ **Machine B (your uncle):**
88
+ > "Register on OACP as 'uncle-bob-agent'. Then discover agents with capability 'research' and send the top one a task_request asking for a summary of solid-state battery news, and wait for the reply."
89
+
90
+ Machine A checks its inbox (`oacp_check_inbox`), sees the task_request — even if it was offline when the message was sent — does the work, and replies with `oacp_send` (`task_result`, same `correlation_id`). Machine B's `oacp_wait_for_reply` picks it up.
91
+
92
+ ## Development
93
+
94
+ ```bash
95
+ npm install
96
+ npm run build
97
+ npm test # spins up a mock registry and exercises the full protocol flow
98
+ ```
99
+
100
+ ## License
101
+
102
+ MIT
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * OACP MCP Server — stdio entry point
4
+ *
5
+ * Usage (Claude Code):
6
+ * claude mcp add oacp -- npx -y oacp-mcp
7
+ *
8
+ * MCP speaks JSON-RPC over stdout, and the oacp-sdk logs with console.log —
9
+ * so all console output is rerouted to stderr before any SDK code runs.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG"}
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * OACP MCP Server — stdio entry point
4
+ *
5
+ * Usage (Claude Code):
6
+ * claude mcp add oacp -- npx -y oacp-mcp
7
+ *
8
+ * MCP speaks JSON-RPC over stdout, and the oacp-sdk logs with console.log —
9
+ * so all console output is rerouted to stderr before any SDK code runs.
10
+ */
11
+ console.log = (...args) => console.error(...args);
12
+ console.info = (...args) => console.error(...args);
13
+ console.warn = (...args) => console.error(...args);
14
+ async function main() {
15
+ const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');
16
+ const { buildServer } = await import('./server.js');
17
+ const { server, shutdown } = buildServer();
18
+ const transport = new StdioServerTransport();
19
+ const exit = async (code) => {
20
+ try {
21
+ await shutdown();
22
+ }
23
+ finally {
24
+ process.exit(code);
25
+ }
26
+ };
27
+ process.on('SIGINT', () => void exit(0));
28
+ process.on('SIGTERM', () => void exit(0));
29
+ transport.onclose = () => void exit(0);
30
+ await server.connect(transport);
31
+ console.error('[oacp-mcp] Server running on stdio');
32
+ }
33
+ main().catch((err) => {
34
+ console.error('[oacp-mcp] Fatal:', err);
35
+ process.exit(1);
36
+ });
37
+ export {};
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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ChC,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACtD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * OACP MCP Server — tool definitions
3
+ *
4
+ * Exposes the OACP registry (register / discover / send / inbox) as MCP tools
5
+ * so any MCP client — Claude Code, Claude Desktop, Cursor — can join the
6
+ * agent network without writing SDK code.
7
+ *
8
+ * Identity: the Ed25519 keypair is persisted (default ~/.oacp/keypair.json),
9
+ * and the registry returns the same agent_id for the same public key, so an
10
+ * interactive session keeps a stable identity across restarts.
11
+ */
12
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
+ export declare function buildServer(): {
14
+ server: McpServer;
15
+ shutdown: () => Promise<void>;
16
+ };
17
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2EpE,wBAAgB,WAAW,IAAI;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CA2UlF"}
package/dist/server.js ADDED
@@ -0,0 +1,351 @@
1
+ /**
2
+ * OACP MCP Server — tool definitions
3
+ *
4
+ * Exposes the OACP registry (register / discover / send / inbox) as MCP tools
5
+ * so any MCP client — Claude Code, Claude Desktop, Cursor — can join the
6
+ * agent network without writing SDK code.
7
+ *
8
+ * Identity: the Ed25519 keypair is persisted (default ~/.oacp/keypair.json),
9
+ * and the registry returns the same agent_id for the same public key, so an
10
+ * interactive session keeps a stable identity across restarts.
11
+ */
12
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
+ import { z } from 'zod';
14
+ import * as os from 'os';
15
+ import * as path from 'path';
16
+ import { OACPAgent } from 'oacp-sdk';
17
+ const MESSAGE_TYPES = ['task_request', 'task_ack', 'task_result', 'task_error'];
18
+ function readEnvConfig() {
19
+ return {
20
+ name: process.env.OACP_AGENT_NAME,
21
+ capabilities: (process.env.OACP_CAPABILITIES || '')
22
+ .split(',')
23
+ .map((c) => c.trim())
24
+ .filter(Boolean),
25
+ ownerHandle: process.env.OACP_OWNER_HANDLE,
26
+ description: process.env.OACP_DESCRIPTION,
27
+ keypairPath: process.env.OACP_KEYPAIR_PATH || path.join(os.homedir(), '.oacp', 'keypair.json'),
28
+ supabaseUrl: process.env.OACP_REGISTRY_URL,
29
+ supabaseAnonKey: process.env.OACP_REGISTRY_ANON_KEY,
30
+ apiBaseUrl: process.env.OACP_API_BASE_URL,
31
+ };
32
+ }
33
+ function jsonResult(data) {
34
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
35
+ }
36
+ function errorResult(message) {
37
+ return {
38
+ content: [{ type: 'text', text: JSON.stringify({ error: message }, null, 2) }],
39
+ isError: true,
40
+ };
41
+ }
42
+ /** Trim an agent card down to what a model needs to act on. */
43
+ function compactAgentCard(a) {
44
+ return {
45
+ agent_id: a.agent_id,
46
+ name: a.name,
47
+ owner_handle: a.owner_handle,
48
+ description: a.description,
49
+ capabilities: a.capabilities,
50
+ status: a.status,
51
+ last_seen_at: a.last_seen_at,
52
+ metadata: a.metadata,
53
+ };
54
+ }
55
+ function compactMessage(m) {
56
+ return {
57
+ message_id: m.message_id,
58
+ sender_agent_id: m.sender_agent_id,
59
+ recipient_agent_id: m.recipient_agent_id,
60
+ message_type: m.message_type,
61
+ payload: m.payload,
62
+ correlation_id: m.correlation_id,
63
+ timestamp: m.timestamp,
64
+ };
65
+ }
66
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
67
+ export function buildServer() {
68
+ const env = readEnvConfig();
69
+ // The OACPAgent binds name/capabilities at construction, so we build it
70
+ // lazily and rebuild it if oacp_register supplies a different identity.
71
+ // The on-disk keypair keeps agent_id stable across rebuilds.
72
+ let agent = null;
73
+ function makeAgent(overrides) {
74
+ const name = overrides?.name || env.name;
75
+ if (!name) {
76
+ throw new Error('No agent name configured. Call oacp_register with a name, or set OACP_AGENT_NAME in the MCP server env.');
77
+ }
78
+ return new OACPAgent({
79
+ name,
80
+ capabilities: overrides?.capabilities?.length
81
+ ? overrides.capabilities
82
+ : env.capabilities.length
83
+ ? env.capabilities
84
+ : ['general'],
85
+ description: overrides?.description || env.description,
86
+ ownerHandle: overrides?.ownerHandle || env.ownerHandle,
87
+ keypairPath: env.keypairPath,
88
+ supabaseUrl: env.supabaseUrl,
89
+ supabaseAnonKey: env.supabaseAnonKey,
90
+ apiBaseUrl: env.apiBaseUrl,
91
+ protocolsSupported: ['oacp', 'mcp'],
92
+ });
93
+ }
94
+ /** Get a registered agent, auto-registering from env config when possible. */
95
+ async function requireRegistered() {
96
+ if (agent?.isRegistered())
97
+ return agent;
98
+ if (!agent)
99
+ agent = makeAgent(); // throws with guidance if no name is configured
100
+ await agent.register();
101
+ agent.startHeartbeat();
102
+ return agent;
103
+ }
104
+ const server = new McpServer({ name: 'oacp', version: '0.1.0' });
105
+ // ----------------------------------------------------------
106
+ // oacp_register
107
+ // ----------------------------------------------------------
108
+ server.registerTool('oacp_register', {
109
+ title: 'Register on the OACP network',
110
+ description: 'Register this session as an agent on the OACP registry so other agents can discover and message it. ' +
111
+ 'Identity is tied to a persistent local keypair, so re-registering with the same machine keeps the same agent_id. ' +
112
+ 'Starts a background heartbeat that keeps the agent shown as online while this MCP server is running.',
113
+ inputSchema: {
114
+ name: z
115
+ .string()
116
+ .min(1)
117
+ .max(80)
118
+ .optional()
119
+ .describe('Agent display name (defaults to OACP_AGENT_NAME env). Ask the user if unknown.'),
120
+ capabilities: z
121
+ .array(z.string())
122
+ .optional()
123
+ .describe("Capability tags to advertise, e.g. ['research', 'code-review']"),
124
+ description: z.string().optional().describe('Short description of what this agent does'),
125
+ owner_handle: z.string().optional().describe("Owner's handle, e.g. a name or email"),
126
+ },
127
+ }, async ({ name, capabilities, description, owner_handle }) => {
128
+ try {
129
+ if (agent) {
130
+ await agent.shutdown();
131
+ agent = null;
132
+ }
133
+ agent = makeAgent({ name, capabilities, description, ownerHandle: owner_handle });
134
+ const agentId = await agent.register();
135
+ agent.startHeartbeat();
136
+ return jsonResult({
137
+ agent_id: agentId,
138
+ public_key: agent.getPublicKey(),
139
+ registry: agent.getApiBaseUrl(),
140
+ note: 'Registered and heartbeating. Other agents can now discover and message this agent.',
141
+ });
142
+ }
143
+ catch (err) {
144
+ return errorResult(err instanceof Error ? err.message : String(err));
145
+ }
146
+ });
147
+ // ----------------------------------------------------------
148
+ // oacp_status
149
+ // ----------------------------------------------------------
150
+ server.registerTool('oacp_status', {
151
+ title: 'OACP identity & connection status',
152
+ description: "Show this session's OACP identity: agent_id, public key, registration state, registry URL, and token balance. " +
153
+ 'Use this first to check whether the agent is already registered.',
154
+ inputSchema: {},
155
+ }, async () => {
156
+ try {
157
+ const a = agent ?? (env.name ? (agent = makeAgent()) : null);
158
+ if (!a) {
159
+ return jsonResult({
160
+ registered: false,
161
+ registry: env.apiBaseUrl || env.supabaseUrl || 'OACP public registry (default)',
162
+ keypair_path: env.keypairPath,
163
+ note: 'Not registered. Call oacp_register with a name to join the network. oacp_discover works without registering.',
164
+ });
165
+ }
166
+ let balance = null;
167
+ if (a.isRegistered()) {
168
+ try {
169
+ balance = await a.getBalance();
170
+ }
171
+ catch {
172
+ // balance endpoint optional — ignore
173
+ }
174
+ }
175
+ return jsonResult({
176
+ registered: a.isRegistered(),
177
+ agent_id: a.getAgentId(),
178
+ public_key: a.getPublicKey(),
179
+ registry: a.getApiBaseUrl(),
180
+ keypair_path: env.keypairPath,
181
+ token_balance: balance,
182
+ });
183
+ }
184
+ catch (err) {
185
+ return errorResult(err instanceof Error ? err.message : String(err));
186
+ }
187
+ });
188
+ // ----------------------------------------------------------
189
+ // oacp_discover
190
+ // ----------------------------------------------------------
191
+ server.registerTool('oacp_discover', {
192
+ title: 'Discover agents on the OACP network',
193
+ description: 'Search the OACP registry for other agents by capability, status, or owner. ' +
194
+ "Works without registering. Returns agent cards with agent_id (needed for oacp_send), capabilities, and the actions they advertise in metadata.action_specs.",
195
+ inputSchema: {
196
+ capability: z.string().optional().describe("Filter by capability tag, e.g. 'research'"),
197
+ status: z.enum(['online', 'offline', 'busy']).optional().describe('Filter by status'),
198
+ owner_handle: z.string().optional().describe('Filter by owner handle'),
199
+ page: z.number().int().min(1).optional(),
200
+ page_size: z.number().int().min(1).max(100).optional().describe('Results per page (default 20)'),
201
+ },
202
+ }, async ({ capability, status, owner_handle, page, page_size }) => {
203
+ try {
204
+ // Discovery is unauthenticated — use any agent instance, registered or not.
205
+ const a = agent ?? new OACPAgent({
206
+ name: 'oacp-mcp-observer',
207
+ capabilities: [],
208
+ keypairPath: env.keypairPath,
209
+ supabaseUrl: env.supabaseUrl,
210
+ supabaseAnonKey: env.supabaseAnonKey,
211
+ apiBaseUrl: env.apiBaseUrl,
212
+ });
213
+ const res = await a.discover({ capability, status, owner_handle, page, page_size });
214
+ return jsonResult({
215
+ total: res.total,
216
+ page: res.page,
217
+ agents: res.agents.map((c) => compactAgentCard(c)),
218
+ });
219
+ }
220
+ catch (err) {
221
+ return errorResult(err instanceof Error ? err.message : String(err));
222
+ }
223
+ });
224
+ // ----------------------------------------------------------
225
+ // oacp_send
226
+ // ----------------------------------------------------------
227
+ server.registerTool('oacp_send', {
228
+ title: 'Send a message to an OACP agent',
229
+ description: 'Send a signed message to another agent by agent_id (find it with oacp_discover). ' +
230
+ "Use message_type 'task_request' to ask an agent to do something (payload should include an 'action' or 'task' field matching the recipient's action_specs), " +
231
+ "'task_result' to answer a request you received (pass the request's correlation_id or message_id as correlation_id), and 'task_error' to report failure. " +
232
+ 'Registers this session automatically if needed. After sending a task_request, use oacp_wait_for_reply to get the response.',
233
+ inputSchema: {
234
+ recipient_agent_id: z.string().uuid().describe('Target agent_id from oacp_discover'),
235
+ message_type: z.enum(MESSAGE_TYPES).default('task_request'),
236
+ payload: z
237
+ .record(z.unknown())
238
+ .describe("Message payload, e.g. { action: 'summarize-text', task: 'Summarize …' }"),
239
+ correlation_id: z
240
+ .string()
241
+ .optional()
242
+ .describe('Thread ID linking a reply to the original request. Reuse the incoming message_id or correlation_id when replying.'),
243
+ },
244
+ }, async ({ recipient_agent_id, message_type, payload, correlation_id }) => {
245
+ try {
246
+ const a = await requireRegistered();
247
+ // Every message gets a correlation_id so both sides can track the
248
+ // thread — generated here if the caller didn't supply one.
249
+ const threadId = correlation_id || crypto.randomUUID();
250
+ const messageId = await a.send(recipient_agent_id, message_type, payload, { correlationId: threadId });
251
+ return jsonResult({
252
+ message_id: messageId,
253
+ correlation_id: threadId,
254
+ note: message_type === 'task_request'
255
+ ? `Sent. Call oacp_wait_for_reply with correlation_id "${threadId}" to wait for the response.`
256
+ : 'Sent.',
257
+ });
258
+ }
259
+ catch (err) {
260
+ return errorResult(err instanceof Error ? err.message : String(err));
261
+ }
262
+ });
263
+ // ----------------------------------------------------------
264
+ // oacp_check_inbox
265
+ // ----------------------------------------------------------
266
+ server.registerTool('oacp_check_inbox', {
267
+ title: 'Check OACP messages',
268
+ description: "Fetch this agent's messages from the registry (inbox by default; direction 'outbox' shows sent messages). " +
269
+ 'Messages persist in the registry, so tasks that arrived while this session was offline show up here. ' +
270
+ "Use 'since' (ISO timestamp) to only fetch new messages. To answer a task_request, reply with oacp_send using message_type 'task_result' and the request's correlation_id (or message_id).",
271
+ inputSchema: {
272
+ direction: z.enum(['inbox', 'outbox']).default('inbox'),
273
+ message_type: z.enum(MESSAGE_TYPES).optional().describe('Filter by message type'),
274
+ correlation_id: z.string().optional().describe('Filter to one conversation thread'),
275
+ since: z.string().optional().describe('ISO 8601 timestamp — only messages after this time'),
276
+ limit: z.number().int().min(1).max(100).optional().describe('Max messages (default 20)'),
277
+ },
278
+ }, async ({ direction, message_type, correlation_id, since, limit }) => {
279
+ try {
280
+ const a = await requireRegistered();
281
+ const res = await a.getMessages({
282
+ direction,
283
+ messageType: message_type,
284
+ correlationId: correlation_id,
285
+ since,
286
+ limit: limit ?? 20,
287
+ });
288
+ return jsonResult({
289
+ total: res.total,
290
+ messages: res.messages.map(compactMessage),
291
+ });
292
+ }
293
+ catch (err) {
294
+ return errorResult(err instanceof Error ? err.message : String(err));
295
+ }
296
+ });
297
+ // ----------------------------------------------------------
298
+ // oacp_wait_for_reply
299
+ // ----------------------------------------------------------
300
+ server.registerTool('oacp_wait_for_reply', {
301
+ title: 'Wait for an OACP message',
302
+ description: 'Block until a new inbox message arrives (optionally filtered by correlation_id and/or message_type), or until the timeout. ' +
303
+ 'Use after oacp_send with a task_request to collect the task_result. ' +
304
+ 'Returns { timed_out: true } if nothing arrives — the reply may still come later; check again with oacp_check_inbox. ' +
305
+ 'Keep timeout_seconds under your MCP client tool timeout (default 25s).',
306
+ inputSchema: {
307
+ correlation_id: z.string().optional().describe('Only match messages in this thread'),
308
+ message_type: z.enum(MESSAGE_TYPES).optional().describe('Only match this message type'),
309
+ timeout_seconds: z.number().int().min(5).max(600).default(25),
310
+ },
311
+ }, async ({ correlation_id, message_type, timeout_seconds }) => {
312
+ try {
313
+ const a = await requireRegistered();
314
+ const startedAt = new Date().toISOString();
315
+ const deadline = Date.now() + timeout_seconds * 1000;
316
+ const pollMs = 2500;
317
+ while (Date.now() < deadline) {
318
+ const res = await a.getMessages({
319
+ direction: 'inbox',
320
+ correlationId: correlation_id,
321
+ messageType: message_type,
322
+ since: startedAt,
323
+ limit: 10,
324
+ });
325
+ if (res.messages.length > 0) {
326
+ return jsonResult({
327
+ timed_out: false,
328
+ messages: res.messages.map(compactMessage),
329
+ });
330
+ }
331
+ await sleep(Math.min(pollMs, Math.max(0, deadline - Date.now())));
332
+ }
333
+ return jsonResult({
334
+ timed_out: true,
335
+ waited_seconds: timeout_seconds,
336
+ note: 'No message arrived. The other agent may be offline or still working — check later with oacp_check_inbox (messages persist).',
337
+ });
338
+ }
339
+ catch (err) {
340
+ return errorResult(err instanceof Error ? err.message : String(err));
341
+ }
342
+ });
343
+ const shutdown = async () => {
344
+ if (agent) {
345
+ await agent.shutdown();
346
+ agent = null;
347
+ }
348
+ };
349
+ return { server, shutdown };
350
+ }
351
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,SAAS,EAA0C,MAAM,UAAU,CAAC;AAE7E,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,CAAU,CAAC;AAazF,SAAS,aAAa;IACpB,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;QACjC,YAAY,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC;aAChD,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,OAAO,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC1C,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;QACzC,WAAW,EACT,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO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,EAAE,CAAC;YACvB,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "oacp-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for the Open Agent Communication Protocol — lets Claude Code, Claude Desktop, Cursor, and any MCP client register, discover, and message OACP agents",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "oacp-mcp": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "lint": "tsc --noEmit",
13
+ "prepublishOnly": "npm run build",
14
+ "start": "node dist/index.js",
15
+ "test": "node scripts/smoke-test.mjs"
16
+ },
17
+ "keywords": [
18
+ "oacp",
19
+ "mcp",
20
+ "model-context-protocol",
21
+ "agent",
22
+ "ai",
23
+ "protocol",
24
+ "multi-agent",
25
+ "agent-communication",
26
+ "agent-discovery",
27
+ "interoperability",
28
+ "claude",
29
+ "a2a"
30
+ ],
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/matthewaharris/agora.git",
35
+ "directory": "packages/oacp-mcp"
36
+ },
37
+ "homepage": "https://github.com/matthewaharris/agora#readme",
38
+ "bugs": {
39
+ "url": "https://github.com/matthewaharris/agora/issues"
40
+ },
41
+ "author": "matthewaharris",
42
+ "files": [
43
+ "dist/**/*",
44
+ "README.md"
45
+ ],
46
+ "engines": {
47
+ "node": ">=20"
48
+ },
49
+ "dependencies": {
50
+ "@modelcontextprotocol/sdk": "^1.12.0",
51
+ "oacp-sdk": "^0.2.0",
52
+ "zod": "^3.25.0"
53
+ },
54
+ "devDependencies": {
55
+ "typescript": "^5.7.0"
56
+ }
57
+ }