You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Description
xmcp now features prompts on its latest release, would be great to bump
to v0.2 so it initializes with it by default
### Type of Change
- [ ] New Example
- [X] Example updates (Bug fixes, new features, etc.)
- [ ] Other (changes to the codebase, but not to examples)
@@ -18,39 +18,90 @@ This will start the MCP server with the selected transport method.
18
18
19
19
## Project Structure
20
20
21
-
This project uses the structured approach where tools are automatically discovered from the `src/tools` directory. Each tool is defined in its own file with the following structure:
21
+
This project uses the structured approach where tools, prompts, and resources are automatically discovered from their respective directories:
22
+
23
+
-`src/tools` - Tool definitions
24
+
-`src/prompts` - Prompt templates
25
+
-`src/resources` - Resource handlers
26
+
27
+
### Tools
28
+
29
+
Each tool is defined in its own file with the following structure:
3. Export a `metadata` object with tool information
60
111
4. Export a default function that implements the tool logic
61
112
113
+
### Adding New Prompts
114
+
115
+
To add a new prompt:
116
+
117
+
1. Create a new `.ts` file in the `src/prompts` directory
118
+
2. Export a `schema` object defining the prompt parameters using Zod
119
+
3. Export a `metadata` object with prompt information and role
120
+
4. Export a default function that returns the prompt text
121
+
122
+
### Adding New Resources
123
+
124
+
To add a new resource:
125
+
126
+
1. Create a new `.ts` file in the `src/resources` directory
127
+
2. Use folder structure to define the URI (e.g., `(users)/[userId]/profile.ts` → `users://{userId}/profile`)
128
+
3. Export a `schema` object for dynamic parameters (optional for static resources)
129
+
4. Export a `metadata` object with resource information
130
+
5. Export a default function that returns the resource content
131
+
62
132
## Building for Production
63
133
64
134
To build your project for production:
@@ -80,17 +150,27 @@ You can run the server for the transport built with:
80
150
- HTTP: `node dist/http.js`
81
151
- STDIO: `node dist/stdio.js`
82
152
83
-
Alternatively, you can use the script which will automatically start the appropriate transport based on your project configuration:
153
+
Given the selected transport method, you will have a custom start script added to the `package.json` file.
84
154
85
-
```
86
-
npm run start
155
+
For HTTP:
156
+
157
+
```bash
158
+
npm run start-http
87
159
# or
88
-
yarn start
160
+
yarn start-http
89
161
# or
90
-
pnpm start
162
+
pnpm start-http
91
163
```
92
164
93
-
The start script will automatically run either the HTTP or STDIO transport depending on which transport method was selected when you initialized the project.
0 commit comments