kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
Merge pull request #721 from phuctm97/docs/add-modelfetch-guide
commit
35d0d54f0a
|
@ -86,6 +86,7 @@
|
||||||
"pages": [
|
"pages": [
|
||||||
"publishing/guides/existing-mcp-server",
|
"publishing/guides/existing-mcp-server",
|
||||||
"publishing/guides/existing-openapi-service",
|
"publishing/guides/existing-openapi-service",
|
||||||
|
"publishing/guides/ts-modelfetch",
|
||||||
"publishing/guides/ts-fastmcp",
|
"publishing/guides/ts-fastmcp",
|
||||||
"publishing/guides/ts-mcp-hono",
|
"publishing/guides/ts-mcp-hono",
|
||||||
"publishing/guides/ts-openapi-hono",
|
"publishing/guides/ts-openapi-hono",
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
---
|
||||||
|
title: TypeScript ModelFetch
|
||||||
|
description: This guide will show you how to publish an MCP server to Agentic using ModelFetch.
|
||||||
|
---
|
||||||
|
|
||||||
|
[ModelFetch](https://www.modelfetch.com) is a TypeScript/JavaScript SDK designed for building and deploying MCP servers across multiple runtime environments.
|
||||||
|
|
||||||
|
## 1. Create a ModelFetch MCP server
|
||||||
|
|
||||||
|
<Info>
|
||||||
|
**Prerequisite**: Please install [Node.js](https://nodejs.org) before
|
||||||
|
proceeding.
|
||||||
|
</Info>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx -y create-modelfetch@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Follow the interactive prompts to:
|
||||||
|
1. **Choosing a runtime** - Node.js, Bun, Deno, Cloudflare Workers, or Vercel Functions
|
||||||
|
2. **Selecting a language** - TypeScript or JavaScript
|
||||||
|
3. **Picking a package manager** - npm, pnpm, bun, or yarn
|
||||||
|
|
||||||
|
Then navigate to your project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd my-mcp-server
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. Implement your MCP server
|
||||||
|
|
||||||
|
Edit the server file to add your MCP tools, resources, and prompts:
|
||||||
|
|
||||||
|
```ts server.ts
|
||||||
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||||
|
import { z } from 'zod'
|
||||||
|
|
||||||
|
const server = new McpServer({
|
||||||
|
title: 'My MCP Server',
|
||||||
|
name: 'my-mcp-server',
|
||||||
|
version: '1.0.0',
|
||||||
|
})
|
||||||
|
|
||||||
|
server.registerTool(
|
||||||
|
'add',
|
||||||
|
{
|
||||||
|
title: 'Add Numbers',
|
||||||
|
description: 'Add two numbers together',
|
||||||
|
inputSchema: {
|
||||||
|
a: z.number(),
|
||||||
|
b: z.number(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
({ a, b }) => ({
|
||||||
|
content: [{
|
||||||
|
type: 'text',
|
||||||
|
text: `${a} + ${b} = ${a + b}`,
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
export default server
|
||||||
|
```
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
[ModelFetch](https://www.modelfetch.com) uses the [official MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) and provides runtime-specific handlers for different platforms.
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
## 3. Deploy your MCP server remotely
|
||||||
|
|
||||||
|
ModelFetch supports multiple deployment targets. Deploy your server to any platforms that support these runtimes:
|
||||||
|
|
||||||
|
- [Node.js](https://www.modelfetch.com/docs/runtimes/node)
|
||||||
|
- [Bun](https://www.modelfetch.com/docs/runtimes/bun)
|
||||||
|
- [Deno](https://www.modelfetch.com/docs/runtimes/deno)
|
||||||
|
- [Cloudflare](https://www.modelfetch.com/docs/runtimes/cloudflare)
|
||||||
|
- [Vercel](https://www.modelfetch.com/docs/runtimes/vercel)
|
||||||
|
|
||||||
|
<Warning>
|
||||||
|
For development, you can use [ngrok](https://ngrok.com) to temporarily expose your local server. Only
|
||||||
|
use this in a safe environment as it exposes your server to the internet.
|
||||||
|
</Warning>
|
||||||
|
|
||||||
|
## 4. Deploy your origin MCP server to Agentic
|
||||||
|
|
||||||
|
Now that you have a publicly available MCP server, you can follow the [existing MCP server guide](/publishing/guides/existing-mcp-server) to deploy it to Agentic.
|
|
@ -28,6 +28,14 @@ description: Deploy your first MCP product to Agentic in minutes.
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab title="TypeScript">
|
<Tab title="TypeScript">
|
||||||
<Columns cols={2}>
|
<Columns cols={2}>
|
||||||
|
<Card
|
||||||
|
title='TS ModelFetch'
|
||||||
|
href='/publishing/guides/ts-modelfetch'
|
||||||
|
icon='cube-transparent'
|
||||||
|
>
|
||||||
|
Create a new MCP server and deploy it to Agentic using ModelFetch SDK.
|
||||||
|
</Card>
|
||||||
|
|
||||||
<Card
|
<Card
|
||||||
title='TS FastMCP Server'
|
title='TS FastMCP Server'
|
||||||
href='/publishing/guides/ts-fastmcp'
|
href='/publishing/guides/ts-fastmcp'
|
||||||
|
|
Ładowanie…
Reference in New Issue