Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.

Commit 0be7fc8

Browse files
committed
docs: update
1 parent f866d63 commit 0be7fc8

File tree

10 files changed

+231
-4
lines changed

10 files changed

+231
-4
lines changed

docs/components/awake.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Hey you, you're finally awake.
2+
3+
It's {new Date().getFullYear()},
4+
5+
and we've been able to [Move on to ESM-only](https://antfu.me/posts/move-on-to-esm-only),
6+
7+
built on [Web Standards](https://hono.dev/docs/concepts/web-standard) and [Standard Schema](https://standardschema.dev/)...
8+
9+
No, wait, why are there [CommonJS](https://github.com/modelcontextprotocol/typescript-sdk/issues/90), [Zod, AJV and Express](https://pkg-size.dev/@modelcontextprotocol/sdk)?
10+
11+
## If you don't want to see that either, then xsMCP is for you.
12+
13+
### Independent implementation
14+
15+
xsMCP does not depend on `@modelcontextprotocol/sdk`, but reimplement with reference to it.
16+
17+
This allows us to significantly reduce the size.
18+
19+
### Client/Server Code Separation
20+
21+
Usually you should only want to use one of them.
22+
23+
If you wish to use both, don't worry, just install them together.
24+
25+
### Modern target, Runtime-agnostic, Schema library-agnostic
26+
27+
xsMCP is built as ES Module for the ESNext target.
28+
29+
We try not to rely on Node.js built-in modules wherever possible, so it works well in the browser, Deno, Bun, and edge runtimes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Usage
3+
---
4+
5+
```package-install
6+
npm i @xsmcp/client-http
7+
```
8+
9+
## createHttpTransport
10+
11+
```ts
12+
import { createClient } from '@xsmcp/server-shared'
13+
import { createHttpTransport } from '@xsmcp/client-http' // [!code highlight]
14+
15+
const client = createClient({
16+
name: 'example-client',
17+
version: '1.0.0',
18+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }), // [!code highlight]
19+
})
20+
```
21+
22+
## createHttpClient
23+
24+
```ts
25+
import { createClient } from '@xsmcp/server-shared' // [!code --]
26+
import { createHttpTransport } from '@xsmcp/client-http' // [!code --]
27+
import { createHttpClient } from '@xsmcp/client-http' // [!code ++]
28+
29+
const client = createClient({ // [!code --]
30+
const client = createHttpClient({
31+
name: 'example-client',
32+
version: '1.0.0',
33+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }), // [!code --]
34+
}) // [!code --]
35+
}, { url: 'http://localhost:3001' }) // [!code ++]
36+
```

docs/content/docs/client/index.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,11 @@ title: Intro
33
description: maintain 1:1 connections with servers, inside the host application
44
---
55

6-
> TODO
6+
import Awake from '../../../components/awake.mdx'
7+
8+
<Awake />
9+
10+
<Cards>
11+
<Card href="client/shared/overview" title="Shared" />
12+
<Card href="client/http/usage" title="HTTP" />
13+
</Cards>

docs/content/docs/client/meta.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{
22
"title": "Client",
33
"icon": "MonitorSmartphone",
4-
"root": true
4+
"root": true,
5+
"pages": [
6+
"index",
7+
"---Shared---",
8+
"...shared",
9+
"---HTTP---",
10+
"...http"
11+
]
512
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Overview
3+
# description: Your first document
4+
---
5+
6+
`@xsmcp/client-shared` is the basis for all clients and implements a common client architecture.
7+
8+
```package-install
9+
npm i @xsmcp/client-shared
10+
```
11+
12+
You can create a client like this:
13+
14+
```ts
15+
import { createClient } from '@xsmcp/server-shared'
16+
import { createHttpTransport } from '@xsmcp/client-http' // [!code highlight]
17+
18+
const client = createClient({
19+
name: 'example-client',
20+
version: '1.0.0',
21+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }), // [!code highlight]
22+
})
23+
```
24+
25+
All subsequent content is based on this client.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Prompts
3+
description: Create reusable prompt templates and workflows
4+
---
5+
6+
## client.listPrompts
7+
8+
```ts
9+
import { createClient } from '@xsmcp/server-shared'
10+
import { createHttpTransport } from '@xsmcp/client-http'
11+
12+
const client = createClient({
13+
name: 'example-client',
14+
version: '1.0.0',
15+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }),
16+
})
17+
18+
await client.listPrompts()
19+
```
20+
21+
## client.getPrompt
22+
23+
```ts
24+
import { createClient } from '@xsmcp/server-shared'
25+
import { createHttpTransport } from '@xsmcp/client-http'
26+
27+
const client = createClient({
28+
name: 'example-client',
29+
version: '1.0.0',
30+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }),
31+
})
32+
33+
await client.getPrompt('simple_prompt')
34+
await client.getPrompt('complex_prompt', { style: 'dark', temperature: 42 })
35+
await client.getPrompt('resource_prompt', { resourceId: 2 })
36+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Resources
3+
description: Expose data and content from your servers to LLMs
4+
---
5+
6+
## client.listResources
7+
8+
```ts
9+
import { createClient } from '@xsmcp/server-shared'
10+
import { createHttpTransport } from '@xsmcp/client-http'
11+
12+
const client = createClient({
13+
name: 'example-client',
14+
version: '1.0.0',
15+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }),
16+
})
17+
18+
await client.listResources()
19+
```
20+
21+
## client.readResource
22+
23+
```ts
24+
import { createClient } from '@xsmcp/server-shared'
25+
import { createHttpTransport } from '@xsmcp/client-http'
26+
27+
const client = createClient({
28+
name: 'example-client',
29+
version: '1.0.0',
30+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }),
31+
})
32+
33+
await client.readResource('test://static/resource/1')
34+
await client.readResource('test://static/resource/2')
35+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Tools
3+
description: Enable LLMs to perform actions through your server
4+
---
5+
6+
<Callout>
7+
With [xsSchema](https://xsai.js.org/docs/packages-top/xsschema), the `parameters` here can support multiple libraries such as Zod, Valibot, ArkType, Effect Schema, Sury... at the same time.
8+
</Callout>
9+
10+
## client.listTools
11+
12+
```ts
13+
import { createClient } from '@xsmcp/server-shared'
14+
import { createHttpTransport } from '@xsmcp/client-http'
15+
16+
const client = createClient({
17+
name: 'example-client',
18+
version: '1.0.0',
19+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }),
20+
})
21+
22+
await client.listTools()
23+
```
24+
25+
## client.callTool
26+
27+
```ts
28+
import { createClient } from '@xsmcp/server-shared'
29+
import { createHttpTransport } from '@xsmcp/client-http'
30+
31+
const client = createClient({
32+
name: 'example-client',
33+
version: '1.0.0',
34+
transport: createHttpTransport({ url: 'http://localhost:3000/mcp' }),
35+
})
36+
37+
await client.callTool('add', { a: 1, b: 1 })
38+
await client.callTool('echo', { message: 'Hello, World!' })
39+
await client.callTool('getTinyImage', {})
40+
```

docs/content/docs/server/index.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,15 @@ title: Intro
33
description: provide context, tools, and prompts to clients
44
---
55

6-
> TODO, please read [Shared](./shared/overview.mdx) first
6+
import Awake from '../../../components/awake.mdx'
7+
8+
<Awake />
9+
10+
---
11+
12+
For the server, we currently have the following modules:
13+
14+
<Cards>
15+
<Card href="server/shared/overview" title="Shared" />
16+
<Card href="server/http" title="HTTP" />
17+
</Cards>

docs/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"**/*.ts",
3939
"**/*.tsx",
4040
".next/types/**/*.ts",
41-
"next-env.d.ts"
41+
"next-env.d.ts",
42+
"dist/types/**/*.ts"
4243
],
4344
"exclude": [
4445
"node_modules"

0 commit comments

Comments
 (0)