@mcp-ts/sdk 2.3.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -30
- package/dist/adapters/agui-adapter.d.mts +3 -3
- package/dist/adapters/agui-adapter.d.ts +3 -3
- package/dist/adapters/agui-middleware.d.mts +3 -3
- package/dist/adapters/agui-middleware.d.ts +3 -3
- package/dist/adapters/ai-adapter.d.mts +3 -3
- package/dist/adapters/ai-adapter.d.ts +3 -3
- package/dist/adapters/langchain-adapter.d.mts +3 -3
- package/dist/adapters/langchain-adapter.d.ts +3 -3
- package/dist/adapters/mastra-adapter.d.mts +1 -1
- package/dist/adapters/mastra-adapter.d.ts +1 -1
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +2 -2
- package/dist/client/index.mjs.map +1 -1
- package/dist/client/react.d.mts +9 -8
- package/dist/client/react.d.ts +9 -8
- package/dist/client/react.js +66 -26
- package/dist/client/react.js.map +1 -1
- package/dist/client/react.mjs +67 -27
- package/dist/client/react.mjs.map +1 -1
- package/dist/client/vue.d.mts +6 -5
- package/dist/client/vue.d.ts +6 -5
- package/dist/client/vue.js +27 -17
- package/dist/client/vue.js.map +1 -1
- package/dist/client/vue.mjs +27 -17
- package/dist/client/vue.mjs.map +1 -1
- package/dist/{index-Cfjsme-a.d.mts → index-ByIjEReo.d.mts} +2 -2
- package/dist/{index-CmjMd2ac.d.ts → index-CtXvKl8N.d.ts} +2 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +728 -306
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +722 -304
- package/dist/index.mjs.map +1 -1
- package/dist/{multi-session-client-C7hGqzgM.d.mts → multi-session-client-CIMUGF8S.d.mts} +15 -33
- package/dist/{multi-session-client-C_kPHpD5.d.ts → multi-session-client-CnvZEGPY.d.ts} +15 -33
- package/dist/server/index.d.mts +45 -17
- package/dist/server/index.d.ts +45 -17
- package/dist/server/index.js +720 -300
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +716 -299
- package/dist/server/index.mjs.map +1 -1
- package/dist/shared/index.d.mts +9 -8
- package/dist/shared/index.d.ts +9 -8
- package/dist/shared/index.js +7 -5
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +5 -4
- package/dist/shared/index.mjs.map +1 -1
- package/dist/{tool-router-BMzhoNYt.d.ts → tool-router-CZMrOG8J.d.ts} +1 -1
- package/dist/{tool-router-BhHsvBfP.d.mts → tool-router-CuApsDiV.d.mts} +1 -1
- package/dist/{types-CxFaaZrM.d.mts → types-DCk_IF4L.d.mts} +5 -3
- package/dist/{types-CxFaaZrM.d.ts → types-DCk_IF4L.d.ts} +5 -3
- package/migrations/neon/20260513010000_install_mcp_sessions.sql +40 -3
- package/migrations/neon/20260513020000_add_session_cleanup_cron.sql +4 -4
- package/migrations/supabase/20260330195700_install_mcp_sessions.sql +67 -3
- package/migrations/supabase/20260421010000_add_session_cleanup_cron.sql +6 -6
- package/package.json +13 -3
- package/src/client/core/sse-client.ts +2 -2
- package/src/client/react/index.ts +1 -1
- package/src/client/react/oauth-popup.tsx +34 -13
- package/src/client/react/use-mcp.ts +19 -45
- package/src/client/utils/session-state.ts +43 -0
- package/src/client/vue/use-mcp.ts +18 -47
- package/src/server/handlers/sse-handler.ts +9 -4
- package/src/server/mcp/multi-session-client.ts +2 -6
- package/src/server/mcp/oauth-client.ts +73 -101
- package/src/server/mcp/storage-oauth-provider.ts +79 -50
- package/src/server/storage/file-backend.ts +74 -18
- package/src/server/storage/index.ts +2 -4
- package/src/server/storage/memory-backend.ts +49 -13
- package/src/server/storage/neon-backend.ts +201 -68
- package/src/server/storage/redis-backend.ts +81 -23
- package/src/server/storage/session-lifecycle.ts +78 -0
- package/src/server/storage/sqlite-backend.ts +89 -15
- package/src/server/storage/supabase-backend.ts +188 -63
- package/src/server/storage/types.ts +49 -16
- package/src/shared/constants.ts +5 -6
- package/src/shared/types.ts +5 -3
- package/src/shared/utils.ts +26 -0
package/README.md
CHANGED
|
@@ -31,45 +31,79 @@
|
|
|
31
31
|
|
|
32
32
|
<br />
|
|
33
33
|
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
34
|
+
## Why does `mcp-ts or toolkit` even exist?
|
|
35
|
+
|
|
36
|
+
MCP makes it possible for AI applications to talk to tools, prompts, and resources, but building applications on top of MCP quickly becomes more than calling `listTools()` and `callTool()`.
|
|
37
|
+
|
|
38
|
+
You need to manage user sessions, OAuth flows, reconnects, storage, browser updates, framework adapters, and on-demand tool discovery so agents can load and call only what they need instead of flooding the model context, similar to Claude Code's [advanced tool use](https://www.anthropic.com/engineering/advanced-tool-use).
|
|
39
|
+
|
|
40
|
+
`mcp-ts/toolkit` exists to handle that application layer while keeping your MCP data in infrastructure you own or choose. See [storage backends](https://docs.mcp-assistant.in/storage-backends/overview) and [framework adapters](https://docs.mcp-assistant.in/ai-adapters/overview).
|
|
41
|
+
|
|
42
|
+
It gives you a practical foundation for building MCP-native apps:
|
|
43
|
+
|
|
44
|
+
- Have multiple users using your application
|
|
45
|
+
- Already using AI SDK, LangChain, Mastra, and AG-UI Protocol where handling oauth, tokens management for mcp clients seems overhead
|
|
46
|
+
- Reduce large model context with on-demand tool discovery through `ToolRouter`
|
|
47
|
+
- Render interactive MCP Apps in your application.
|
|
48
|
+
- Run programmatic tool calling inside a secure sandbox with `CodeMode`
|
|
49
|
+
|
|
50
|
+
In short: the official MCP SDK gives you the protocol building blocks. `mcp-ts/toolkit` gives you the application layer for building MCP applications around them.
|
|
51
|
+
|
|
52
|
+
### When you may not need it
|
|
53
|
+
|
|
54
|
+
If you already use a managed service/platform such as Smithery, Strata, Composio, or a similar SDK, you may not need `mcp-ts/toolkit`.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 📑 Table of Contents
|
|
59
|
+
|
|
60
|
+
- [Features](#features)
|
|
61
|
+
- [Packages](#packages)
|
|
62
|
+
- [SDK Setup (@mcp-ts/sdk)](#sdk-setup-mcp-tssdk)
|
|
63
|
+
- [Installation](#installation)
|
|
64
|
+
- [Quick Start](#quick-start)
|
|
65
|
+
- [Gateway Setup (mcpassistant-gateway)](#gateway-setup-mcpassistant-gateway)
|
|
66
|
+
- [Installation](#installation-1)
|
|
67
|
+
- [Usage](#usage)
|
|
68
|
+
- [Documentation](#documentation)
|
|
69
|
+
- [Environment Setup](#environment-setup)
|
|
70
|
+
- [Architecture](#architecture)
|
|
71
|
+
- [Examples](#examples)
|
|
72
|
+
- [Inspiration](#inspiration)
|
|
73
|
+
- [Contributing](#contributing)
|
|
49
74
|
|
|
50
75
|
---
|
|
51
76
|
|
|
77
|
+
<a id="packages"></a>
|
|
78
|
+
|
|
52
79
|
## 📦 Packages
|
|
53
80
|
|
|
54
81
|
| Package | Description | Install |
|
|
55
82
|
| :--- | :--- | :--- |
|
|
56
|
-
| **[@mcp-ts/sdk](src)** | TypeScript/JavaScript SDK for
|
|
57
|
-
| **[
|
|
83
|
+
| **[@mcp-ts/sdk](src)** | Core TypeScript/JavaScript SDK for client applications. | `npm i @mcp-ts/sdk` |
|
|
84
|
+
| **[@mcp-ts/tool-router](packages/tool-router)** | ToolRouter for dynamic tool discovery across many MCP servers. | `npm i @mcp-ts/tool-router` |
|
|
85
|
+
| **[@mcp-ts/codemode](packages/code-mode)** | CodeMode: sandboxed program execution for tool calling. | `npm i @mcp-ts/codemode` |
|
|
86
|
+
| **[mcpassistant-gateway](packages/local-gateway)** | Python bridge for local MCP support in remote apps. | `pip install mcpassistant-gateway` |
|
|
58
87
|
|
|
59
88
|
---
|
|
60
89
|
|
|
90
|
+
<a id="features"></a>
|
|
91
|
+
|
|
61
92
|
## ✨ Features
|
|
62
93
|
|
|
63
94
|
Most features are available out-of-the-box in the **TypeScript SDK**:
|
|
64
95
|
|
|
65
|
-
- **
|
|
66
|
-
- **Flexible Storage** - Redis, SQLite, File System, or In-Memory backends
|
|
96
|
+
- **Storage Backends** - Redis, SQLite, File System, or In-Memory backends
|
|
67
97
|
- **Serverless** - Works in serverless environments (Vercel, AWS Lambda, etc.)
|
|
68
98
|
- **React Hook** - `useMcp` hook for easy React integration
|
|
69
99
|
- **Vue Composable** - `useMcp` composable for Vue applications
|
|
100
|
+
- **SSE** - Server-Sent Events for connection state and observability updates
|
|
70
101
|
- **MCP Protocol** - Support for tools, prompts, and resources
|
|
71
102
|
- **Agent Adapters** - Built-in adapters for AI SDK, LangChain, Mastra, and AG-UI
|
|
72
103
|
- **MCP Apps Extension (SEP-1865)** - Interactive UI-driven tool interfaces
|
|
104
|
+
- **ToolRouter** - Discover tools on-demand across multiple MCP servers (reduces context bloat)
|
|
105
|
+
|
|
106
|
+
<a id="examples"></a>
|
|
73
107
|
|
|
74
108
|
## 🧪 Examples
|
|
75
109
|
|
|
@@ -91,9 +125,11 @@ Check out working examples demonstrating the MCP Apps extension and agent integr
|
|
|
91
125
|
<p><em>Interactive UIs for MCP tools</em></p>
|
|
92
126
|
</div>
|
|
93
127
|
|
|
128
|
+
<a id="inspiration"></a>
|
|
129
|
+
|
|
94
130
|
## 💡 Inspiration
|
|
95
131
|
|
|
96
|
-
> I got the idea for `@mcp-ts` while working on
|
|
132
|
+
> I got the idea for `@mcp-ts` while working on **[MCP Assistant](https://mcp-assistant.in)**.
|
|
97
133
|
As the project grew, I had a few problems: storage, using different AI frameworks like LangGraph and ADK for different use cases, and figuring out how to get progressive SSE updates at each step so I could see what was happening.
|
|
98
134
|
So with that idea in mind, I built this SDK to make setup easier and keep the user experience smooth.
|
|
99
135
|
That’s how `@mcp-ts` started.
|
|
@@ -106,6 +142,8 @@ That’s how `@mcp-ts` started.
|
|
|
106
142
|
|
|
107
143
|
<br/>
|
|
108
144
|
|
|
145
|
+
<a id="sdk-setup-mcp-tssdk"></a>
|
|
146
|
+
|
|
109
147
|
## 🛠️ SDK Setup (@mcp-ts/sdk)
|
|
110
148
|
|
|
111
149
|
### 📦 Installation
|
|
@@ -122,7 +160,10 @@ The SDK supports multiple storage backends out of the box:
|
|
|
122
160
|
|
|
123
161
|
### 🚀 Quick Start
|
|
124
162
|
|
|
125
|
-
|
|
163
|
+
Working reference: [examples/next](examples/next)
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary><strong>Server-Side (Next.js)</strong></summary>
|
|
126
167
|
|
|
127
168
|
```typescript
|
|
128
169
|
// app/api/mcp/route.ts
|
|
@@ -138,7 +179,10 @@ export const { GET, POST } = createNextMcpHandler({
|
|
|
138
179
|
});
|
|
139
180
|
```
|
|
140
181
|
|
|
141
|
-
|
|
182
|
+
</details>
|
|
183
|
+
|
|
184
|
+
<details>
|
|
185
|
+
<summary><strong>Client-Side (React)</strong></summary>
|
|
142
186
|
|
|
143
187
|
```typescript
|
|
144
188
|
'use client';
|
|
@@ -177,6 +221,36 @@ function App() {
|
|
|
177
221
|
}
|
|
178
222
|
```
|
|
179
223
|
|
|
224
|
+
</details>
|
|
225
|
+
|
|
226
|
+
### 🌐 MCP Endpoint (Hosted)
|
|
227
|
+
|
|
228
|
+
- **Endpoint**: `https://api.mcp-assistant.in/mcp`
|
|
229
|
+
|
|
230
|
+
#### Antigravity
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"mcpServers": {
|
|
235
|
+
"mcp-assistant": {
|
|
236
|
+
"url": "https://api.mcp-assistant.in/mcp"
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### VS Code
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"mcpServers": {
|
|
247
|
+
"mcp-assistant": {
|
|
248
|
+
"url": "https://api.mcp-assistant.in/mcp"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
180
254
|
### 🔌 Adapters
|
|
181
255
|
|
|
182
256
|
Integrating with agent frameworks is simple using built-in adapters.
|
|
@@ -314,11 +388,13 @@ export function ToolRenderer() {
|
|
|
314
388
|
|
|
315
389
|
</details>
|
|
316
390
|
|
|
391
|
+
<a id="documentation"></a>
|
|
392
|
+
|
|
317
393
|
## 📚 Documentation
|
|
318
394
|
|
|
319
395
|
Full documentation is available at: **[Docs](https://docs.mcp-assistant.in/)**
|
|
320
396
|
|
|
321
|
-
### 🗂️ Topics Covered
|
|
397
|
+
### 🗂️ Topics Covered
|
|
322
398
|
|
|
323
399
|
- **[Getting Started](https://docs.mcp-assistant.in/get-started)** - Quick setup and overview
|
|
324
400
|
- **[Installation](https://docs.mcp-assistant.in/install)** - Detailed installation guide
|
|
@@ -327,6 +403,8 @@ Full documentation is available at: **[Docs](https://docs.mcp-assistant.in/)**
|
|
|
327
403
|
- **[React Hook Guide](https://docs.mcp-assistant.in/react)** - Using the useMcp hook
|
|
328
404
|
- **[API Reference](https://docs.mcp-assistant.in/api-reference/server)** - Complete API documentation
|
|
329
405
|
|
|
406
|
+
<a id="environment-setup"></a>
|
|
407
|
+
|
|
330
408
|
## ⚙️ Environment Setup
|
|
331
409
|
|
|
332
410
|
The library supports multiple storage backends. You can explicitly select one using `MCP_TS_STORAGE_TYPE` or rely on automatic detection.
|
|
@@ -335,13 +413,13 @@ The library supports multiple storage backends. You can explicitly select one us
|
|
|
335
413
|
|
|
336
414
|
### 🧷 Configuration Examples
|
|
337
415
|
|
|
338
|
-
1.
|
|
416
|
+
1. **Redis** (Recommended for production)
|
|
339
417
|
```bash
|
|
340
418
|
MCP_TS_STORAGE_TYPE=redis
|
|
341
419
|
REDIS_URL=redis://localhost:6379
|
|
342
420
|
```
|
|
343
421
|
|
|
344
|
-
2.
|
|
422
|
+
2. **SQLite** (Fast & Persistent)
|
|
345
423
|
```bash
|
|
346
424
|
MCP_TS_STORAGE_TYPE=sqlite
|
|
347
425
|
# Optional path
|
|
@@ -354,19 +432,21 @@ The library supports multiple storage backends. You can explicitly select one us
|
|
|
354
432
|
NEON_DATABASE_URL=postgresql://user:password@host.neon.tech/dbname?sslmode=verify-full&channel_binding=require
|
|
355
433
|
```
|
|
356
434
|
|
|
357
|
-
4.
|
|
435
|
+
4. **File System** (Great for local dev)
|
|
358
436
|
```bash
|
|
359
437
|
MCP_TS_STORAGE_TYPE=file
|
|
360
438
|
MCP_TS_STORAGE_FILE=./sessions.json
|
|
361
439
|
```
|
|
362
440
|
|
|
363
|
-
5.
|
|
441
|
+
5. **In-Memory** (Default for testing)
|
|
364
442
|
```bash
|
|
365
443
|
MCP_TS_STORAGE_TYPE=memory
|
|
366
444
|
```
|
|
367
445
|
|
|
368
446
|
---
|
|
369
447
|
|
|
448
|
+
<a id="gateway-setup-mcpassistant-gateway"></a>
|
|
449
|
+
|
|
370
450
|
## 🐍 Gateway Setup (mcpassistant-gateway)
|
|
371
451
|
|
|
372
452
|
The **MCP Gateway** is a Python-based bridge that allows local MCP servers to be accessed by remote applications via an outbound connection. This is useful for providing local context (like your filesystem) to a hosted AI agent.
|
|
@@ -391,6 +471,8 @@ uvx mcpassistant-gateway run --name "local-files"
|
|
|
391
471
|
|
|
392
472
|
---
|
|
393
473
|
|
|
474
|
+
<a id="architecture"></a>
|
|
475
|
+
|
|
394
476
|
## 🏗️ Architecture
|
|
395
477
|
|
|
396
478
|
The MCP Toolkit supports two common runtime topologies:
|
|
@@ -434,7 +516,7 @@ graph LR
|
|
|
434
516
|
> [!NOTE]
|
|
435
517
|
> This package (`@mcp-ts/sdk`) provides a unified MCP client with support for adapters and storage backends such as AI SDK, Mastra, LangChain, and Redis.
|
|
436
518
|
> Adapters and storage backends are loaded via **optional peer dependencies** and must be installed independently. This ensures your application only includes the integrations you explicitly choose, keeping bundle size small and avoiding unnecessary dependencies.
|
|
437
|
-
> The SDK includes built-in support for **Memory** and **File** storage, while additional backends (such as Redis) and adapters can be added without impacting users who don
|
|
519
|
+
> The SDK includes built-in support for **Memory** and **File** storage, while additional backends (such as Redis) and adapters can be added without impacting users who don't need them.
|
|
438
520
|
|
|
439
521
|
For more details, refer to the documentation and follow the **installation guide for each adapter or storage backend**.
|
|
440
522
|
|
|
@@ -444,6 +526,8 @@ For more details, refer to the documentation and follow the **installation guide
|
|
|
444
526
|
- [Redis Storage Installation Guide](https://docs.mcp-assistant.in/storage/redis)
|
|
445
527
|
|
|
446
528
|
|
|
529
|
+
<a id="contributing"></a>
|
|
530
|
+
|
|
447
531
|
## 🤝 Contributing
|
|
448
532
|
|
|
449
533
|
Contributions are welcome! Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on how to contribute.
|
|
@@ -452,7 +536,6 @@ Contributions are welcome! Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for
|
|
|
452
536
|
<br />
|
|
453
537
|
|
|
454
538
|
<p align="center">
|
|
455
|
-
<em>
|
|
456
|
-
<img src="https://visitor-badge.laobi.icu/badge?page_id=zonlabs.mcp-ts&style=for-the-badge&color=00d4ff" alt="Views">
|
|
539
|
+
<em>Thanks for visiting @mcp-ts!</em>
|
|
457
540
|
</p>
|
|
458
541
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-
|
|
2
|
-
import { d as ToolRouter } from '../tool-router-
|
|
1
|
+
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-CIMUGF8S.mjs';
|
|
2
|
+
import { d as ToolRouter } from '../tool-router-CuApsDiV.mjs';
|
|
3
3
|
import '../events-CK3N--3g.mjs';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
7
|
-
import '../types-
|
|
7
|
+
import '../types-DCk_IF4L.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* MCP Adapter for AG-UI Integration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-
|
|
2
|
-
import { d as ToolRouter } from '../tool-router-
|
|
1
|
+
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-CnvZEGPY.js';
|
|
2
|
+
import { d as ToolRouter } from '../tool-router-CZMrOG8J.js';
|
|
3
3
|
import '../events-CK3N--3g.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
7
|
-
import '../types-
|
|
7
|
+
import '../types-DCk_IF4L.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* MCP Adapter for AG-UI Integration
|
|
@@ -2,13 +2,13 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { Middleware, RunAgentInput, AbstractAgent, BaseEvent } from '@ag-ui/client';
|
|
3
3
|
export { AbstractAgent, BaseEvent, EventType, Middleware, RunAgentInput, Tool, ToolCallEndEvent } from '@ag-ui/client';
|
|
4
4
|
import { AguiTool } from './agui-adapter.mjs';
|
|
5
|
-
import '../multi-session-client-
|
|
5
|
+
import '../multi-session-client-CIMUGF8S.mjs';
|
|
6
6
|
import '../events-CK3N--3g.mjs';
|
|
7
7
|
import '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
9
9
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
10
|
-
import '../tool-router-
|
|
11
|
-
import '../types-
|
|
10
|
+
import '../tool-router-CuApsDiV.mjs';
|
|
11
|
+
import '../types-DCk_IF4L.mjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* AG-UI Middleware for MCP Tool Execution
|
|
@@ -2,13 +2,13 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { Middleware, RunAgentInput, AbstractAgent, BaseEvent } from '@ag-ui/client';
|
|
3
3
|
export { AbstractAgent, BaseEvent, EventType, Middleware, RunAgentInput, Tool, ToolCallEndEvent } from '@ag-ui/client';
|
|
4
4
|
import { AguiTool } from './agui-adapter.js';
|
|
5
|
-
import '../multi-session-client-
|
|
5
|
+
import '../multi-session-client-CnvZEGPY.js';
|
|
6
6
|
import '../events-CK3N--3g.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
9
9
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
10
|
-
import '../tool-router-
|
|
11
|
-
import '../types-
|
|
10
|
+
import '../tool-router-CZMrOG8J.js';
|
|
11
|
+
import '../types-DCk_IF4L.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* AG-UI Middleware for MCP Tool Execution
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-
|
|
1
|
+
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-CIMUGF8S.mjs';
|
|
2
2
|
import { ToolSet } from 'ai';
|
|
3
|
-
import { d as ToolRouter } from '../tool-router-
|
|
3
|
+
import { d as ToolRouter } from '../tool-router-CuApsDiV.mjs';
|
|
4
4
|
import '../events-CK3N--3g.mjs';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
8
|
-
import '../types-
|
|
8
|
+
import '../types-DCk_IF4L.mjs';
|
|
9
9
|
|
|
10
10
|
interface AIAdapterOptions {
|
|
11
11
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-
|
|
1
|
+
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-CnvZEGPY.js';
|
|
2
2
|
import { ToolSet } from 'ai';
|
|
3
|
-
import { d as ToolRouter } from '../tool-router-
|
|
3
|
+
import { d as ToolRouter } from '../tool-router-CZMrOG8J.js';
|
|
4
4
|
import '../events-CK3N--3g.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
8
|
-
import '../types-
|
|
8
|
+
import '../types-DCk_IF4L.js';
|
|
9
9
|
|
|
10
10
|
interface AIAdapterOptions {
|
|
11
11
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-
|
|
1
|
+
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-CIMUGF8S.mjs';
|
|
2
2
|
import { StructuredTool } from '@langchain/core/tools';
|
|
3
|
-
import { d as ToolRouter } from '../tool-router-
|
|
3
|
+
import { d as ToolRouter } from '../tool-router-CuApsDiV.mjs';
|
|
4
4
|
import '../events-CK3N--3g.mjs';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
8
|
-
import '../types-
|
|
8
|
+
import '../types-DCk_IF4L.mjs';
|
|
9
9
|
|
|
10
10
|
interface LangChainAdapterOptions {
|
|
11
11
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-
|
|
1
|
+
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-CnvZEGPY.js';
|
|
2
2
|
import { StructuredTool } from '@langchain/core/tools';
|
|
3
|
-
import { d as ToolRouter } from '../tool-router-
|
|
3
|
+
import { d as ToolRouter } from '../tool-router-CZMrOG8J.js';
|
|
4
4
|
import '../events-CK3N--3g.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
8
|
-
import '../types-
|
|
8
|
+
import '../types-DCk_IF4L.js';
|
|
9
9
|
|
|
10
10
|
interface LangChainAdapterOptions {
|
|
11
11
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-
|
|
1
|
+
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-CIMUGF8S.mjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import '../events-CK3N--3g.mjs';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-
|
|
1
|
+
import { M as MCPClient, a as MultiSessionClient } from '../multi-session-client-CnvZEGPY.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import '../events-CK3N--3g.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from '../index-
|
|
1
|
+
export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from '../index-ByIjEReo.mjs';
|
|
2
2
|
export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, M as McpConnectionEvent, c as McpConnectionState, d as McpObservabilityEvent } from '../events-CK3N--3g.mjs';
|
|
3
|
-
export { q as McpRpcRequest, r as McpRpcResponse, v as ToolInfo } from '../types-
|
|
3
|
+
export { q as McpRpcRequest, r as McpRpcResponse, v as ToolInfo } from '../types-DCk_IF4L.mjs';
|
|
4
4
|
import '@modelcontextprotocol/ext-apps/app-bridge';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from '../index-
|
|
1
|
+
export { A as APP_HOST_DEFAULTS, a as AppHost, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, c as SSEClient, d as SSEClientOptions } from '../index-CtXvKl8N.js';
|
|
2
2
|
export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, M as McpConnectionEvent, c as McpConnectionState, d as McpObservabilityEvent } from '../events-CK3N--3g.js';
|
|
3
|
-
export { q as McpRpcRequest, r as McpRpcResponse, v as ToolInfo } from '../types-
|
|
3
|
+
export { q as McpRpcRequest, r as McpRpcResponse, v as ToolInfo } from '../types-DCk_IF4L.js';
|
|
4
4
|
import '@modelcontextprotocol/ext-apps/app-bridge';
|
|
5
5
|
import '@modelcontextprotocol/sdk/types.js';
|
package/dist/client/index.js
CHANGED
|
@@ -48,8 +48,8 @@ var SSEClient = class {
|
|
|
48
48
|
async getSession(sessionId) {
|
|
49
49
|
return this.sendRequest("getSession", { sessionId });
|
|
50
50
|
}
|
|
51
|
-
async finishAuth(
|
|
52
|
-
return this.sendRequest("finishAuth", {
|
|
51
|
+
async finishAuth(state, code) {
|
|
52
|
+
return this.sendRequest("finishAuth", { state, code });
|
|
53
53
|
}
|
|
54
54
|
async listPrompts(sessionId) {
|
|
55
55
|
return this.sendRequest("listPrompts", { sessionId });
|