@prefecthq/fastmcp-ts 0.0.2-alpha.0 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/dist/cli/index.cjs +3879 -9436
- package/dist/cli/index.cjs.map +1 -1
- package/dist/client.d.ts +101 -11
- package/dist/client.js +252 -61
- package/dist/client.js.map +1 -1
- package/dist/server.d.ts +27 -20
- package/dist/server.js +7 -7
- package/dist/server.js.map +1 -1
- package/dist/{zod-P5QUYVPB.js → zod-JRPBLP6C.js} +1171 -423
- package/dist/zod-JRPBLP6C.js.map +1 -0
- package/package.json +43 -7
- package/dist/zod-P5QUYVPB.js.map +0 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Built on the official [`@modelcontextprotocol/sdk`](https://github.com/modelcont
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install fastmcp-ts
|
|
10
|
+
npm install @prefecthq/fastmcp-ts
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
---
|
|
@@ -17,7 +17,7 @@ npm install fastmcp-ts
|
|
|
17
17
|
Turn TypeScript functions into MCP tools, resources, and prompts. Input schemas are inferred automatically from any [Standard Schema](https://standardschema.dev)-compatible library: Zod, Valibot, ArkType, and others.
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
|
-
import { FastMCP } from 'fastmcp-ts/server'
|
|
20
|
+
import { FastMCP } from '@prefecthq/fastmcp-ts/server'
|
|
21
21
|
import { z } from 'zod'
|
|
22
22
|
|
|
23
23
|
const server = new FastMCP({ name: 'my-server', version: '1.0.0' })
|
|
@@ -63,7 +63,7 @@ await server.run() // stdio (default)
|
|
|
63
63
|
Handlers access logging, progress, LLM sampling, user elicitation, and per-session state through an ambient context with no prop-drilling.
|
|
64
64
|
|
|
65
65
|
```typescript
|
|
66
|
-
import { FastMCP } from 'fastmcp-ts/server'
|
|
66
|
+
import { FastMCP } from '@prefecthq/fastmcp-ts/server'
|
|
67
67
|
import { z } from 'zod'
|
|
68
68
|
|
|
69
69
|
const server = new FastMCP({ name: 'assistant' })
|
|
@@ -93,7 +93,7 @@ server.tool(
|
|
|
93
93
|
### Middleware & Auth
|
|
94
94
|
|
|
95
95
|
```typescript
|
|
96
|
-
import { FastMCP, LoggingMiddleware, RateLimitingMiddleware, jwtVerifier } from 'fastmcp-ts/server'
|
|
96
|
+
import { FastMCP, LoggingMiddleware, RateLimitingMiddleware, jwtVerifier } from '@prefecthq/fastmcp-ts/server'
|
|
97
97
|
|
|
98
98
|
const server = new FastMCP({
|
|
99
99
|
name: 'secure-server',
|
|
@@ -115,7 +115,7 @@ await server.run({ transport: 'http', port: 3000 })
|
|
|
115
115
|
Mount child servers onto a parent with optional name-prefix namespacing.
|
|
116
116
|
|
|
117
117
|
```typescript
|
|
118
|
-
import { FastMCP, createProxy } from 'fastmcp-ts/server'
|
|
118
|
+
import { FastMCP, createProxy } from '@prefecthq/fastmcp-ts/server'
|
|
119
119
|
|
|
120
120
|
const weather = new FastMCP({ name: 'weather' })
|
|
121
121
|
weather.tool({ name: 'forecast', description: 'Get a forecast', input: z.object({ city: z.string() }) }, ({ city }) => `Forecast for ${city}`)
|
|
@@ -135,7 +135,7 @@ await gateway.run({ transport: 'http', port: 3000 })
|
|
|
135
135
|
## Clients
|
|
136
136
|
|
|
137
137
|
```typescript
|
|
138
|
-
import { Client } from 'fastmcp-ts/client'
|
|
138
|
+
import { Client } from '@prefecthq/fastmcp-ts/client'
|
|
139
139
|
|
|
140
140
|
const client = await Client.connect('http://localhost:3000')
|
|
141
141
|
|
|
@@ -163,7 +163,7 @@ const result = await client.callTool('add', { a: 1, b: 2 })
|
|
|
163
163
|
Forward LLM sampling requests from servers to your AI provider with a single line:
|
|
164
164
|
|
|
165
165
|
```typescript
|
|
166
|
-
import { Client, AnthropicSamplingAdapter } from 'fastmcp-ts/client'
|
|
166
|
+
import { Client, AnthropicSamplingAdapter } from '@prefecthq/fastmcp-ts/client'
|
|
167
167
|
import Anthropic from '@anthropic-ai/sdk'
|
|
168
168
|
|
|
169
169
|
const client = await Client.connect('http://localhost:3000', {
|
|
@@ -180,7 +180,7 @@ Also ships with `OpenAISamplingAdapter` and `GoogleSamplingAdapter`.
|
|
|
180
180
|
Connect to multiple servers from a single client. Tools, resources, and prompts are namespaced by server name automatically.
|
|
181
181
|
|
|
182
182
|
```typescript
|
|
183
|
-
import { Client } from 'fastmcp-ts/client'
|
|
183
|
+
import { Client } from '@prefecthq/fastmcp-ts/client'
|
|
184
184
|
|
|
185
185
|
const client = await Client.connect({
|
|
186
186
|
mcpServers: {
|
|
@@ -200,7 +200,7 @@ const forecast = await client.callTool('weather_forecast', { city: 'New York' })
|
|
|
200
200
|
FastMCP ships a server-side component library for building interactive UIs rendered directly in MCP host conversations.
|
|
201
201
|
|
|
202
202
|
```typescript
|
|
203
|
-
import { FastMCPApp, Column, Row, Text, Input, Button, Table } from 'fastmcp-ts/server'
|
|
203
|
+
import { FastMCPApp, Column, Row, Text, Input, Button, Table } from '@prefecthq/fastmcp-ts/server'
|
|
204
204
|
import { z } from 'zod'
|
|
205
205
|
|
|
206
206
|
const app = new FastMCPApp({ name: 'search-app', version: '1.0.0' })
|
|
@@ -239,7 +239,7 @@ await app.server.run({ transport: 'http', port: 3000 })
|
|
|
239
239
|
Ready-to-mount interactive primitives:
|
|
240
240
|
|
|
241
241
|
```typescript
|
|
242
|
-
import { FastMCP, Approval, Choice, FileUpload, FormInput } from 'fastmcp-ts/server'
|
|
242
|
+
import { FastMCP, Approval, Choice, FileUpload, FormInput } from '@prefecthq/fastmcp-ts/server'
|
|
243
243
|
import { z } from 'zod'
|
|
244
244
|
|
|
245
245
|
const server = new FastMCP({ name: 'my-server' })
|
|
@@ -255,7 +255,7 @@ server.addProvider(new FormInput()) // auto-generated validated form from any
|
|
|
255
255
|
Let the LLM compose component trees at runtime:
|
|
256
256
|
|
|
257
257
|
```typescript
|
|
258
|
-
import { FastMCP, GenerativeUI } from 'fastmcp-ts/server'
|
|
258
|
+
import { FastMCP, GenerativeUI } from '@prefecthq/fastmcp-ts/server'
|
|
259
259
|
|
|
260
260
|
const server = new FastMCP({ name: 'my-server' })
|
|
261
261
|
server.addProvider(new GenerativeUI())
|