55 * in the built-in/ directory. To modify built-in skills, edit the corresponding
66 * SKILL.md file and run: pnpm generate:skills
77 *
8- * Generated at: 2026-01-28T23:09:14.137Z
8+ * Generated at: 2026-02-13T16:07:37.922Z
99 */
1010
1111import { SkillMetadata , SkillContent } from "../../shared/skills"
@@ -32,6 +32,7 @@ Unless the user specifies otherwise, new local MCP servers should be created in
3232MCP servers can be configured in two ways in the MCP settings file:
3333
34341. Local (Stdio) Server Configuration:
35+
3536\`\`\`json
3637{
3738 "mcpServers": {
@@ -47,6 +48,7 @@ MCP servers can be configured in two ways in the MCP settings file:
4748\`\`\`
4849
49502. Remote (SSE) Server Configuration:
51+
5052\`\`\`json
5153{
5254 "mcpServers": {
@@ -61,6 +63,7 @@ MCP servers can be configured in two ways in the MCP settings file:
6163\`\`\`
6264
6365Common configuration options for both types:
66+
6467- \`disabled\`: (optional) Set to true to temporarily disable the server
6568- \`timeout\`: (optional) Maximum time in seconds to wait for server responses (default: 60)
6669- \`alwaysAllow\`: (optional) Array of tool names that don't require user confirmation
@@ -105,178 +108,170 @@ weather-server/
105108
106109\`\`\`typescript
107110#!/usr/bin/env node
108- import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
109- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
110- import { z } from "zod";
111- import axios from ' axios';
111+ import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"
112+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
113+ import { z } from "zod"
114+ import axios from " axios"
112115
113- const API_KEY = process.env.OPENWEATHER_API_KEY; // provided by MCP config
116+ const API_KEY = process.env.OPENWEATHER_API_KEY // provided by MCP config
114117if (!API_KEY) {
115- throw new Error(' OPENWEATHER_API_KEY environment variable is required');
118+ throw new Error(" OPENWEATHER_API_KEY environment variable is required")
116119}
117120
118121// Define types for OpenWeather API responses
119122interface WeatherData {
120- main: {
121- temp: number;
122- humidity: number;
123- };
124- weather: Array<{
125- description: string;
126- }>;
127- wind: {
128- speed: number;
129- };
123+ main: {
124+ temp: number
125+ humidity: number
126+ }
127+ weather: Array<{
128+ description: string
129+ }>
130+ wind: {
131+ speed: number
132+ }
130133}
131134
132135interface ForecastData {
133- list: Array<WeatherData & {
134- dt_txt: string;
135- }>;
136+ list: Array<
137+ WeatherData & {
138+ dt_txt: string
139+ }
140+ >
136141}
137142
138143// Create an MCP server
139144const server = new McpServer({
140- name: "weather-server",
141- version: "0.1.0"
142- });
145+ name: "weather-server",
146+ version: "0.1.0",
147+ })
143148
144149// Create axios instance for OpenWeather API
145150const weatherApi = axios.create({
146- baseURL: ' http://api.openweathermap.org/data/2.5' ,
147- params: {
148- appid: API_KEY,
149- units: ' metric' ,
150- },
151- });
151+ baseURL: " http://api.openweathermap.org/data/2.5" ,
152+ params: {
153+ appid: API_KEY,
154+ units: " metric" ,
155+ },
156+ })
152157
153158// Add a tool for getting weather forecasts
154159server.tool(
155- "get_forecast",
156- {
157- city: z.string().describe("City name"),
158- days: z.number().min(1).max(5).optional().describe("Number of days (1-5)"),
159- },
160- async ({ city, days = 3 }) => {
161- try {
162- const response = await weatherApi.get<ForecastData>('forecast', {
163- params: {
164- q: city,
165- cnt: Math.min(days, 5) * 8,
166- },
167- });
168-
169- return {
170- content: [
171- {
172- type: "text",
173- text: JSON.stringify(response.data.list, null, 2),
174- },
175- ],
176- };
177- } catch (error) {
178- if (axios.isAxiosError(error)) {
179- return {
180- content: [
181- {
182- type: "text",
183- text: \`Weather API error: \${
184- error.response?.data.message ?? error.message
185- }\`,
186- },
187- ],
188- isError: true,
189- };
190- }
191- throw error;
192- }
193- }
194- );
160+ "get_forecast",
161+ {
162+ city: z.string().describe("City name"),
163+ days: z.number().min(1).max(5).optional().describe("Number of days (1-5)"),
164+ },
165+ async ({ city, days = 3 }) => {
166+ try {
167+ const response = await weatherApi.get<ForecastData>("forecast", {
168+ params: {
169+ q: city,
170+ cnt: Math.min(days, 5) * 8,
171+ },
172+ })
173+
174+ return {
175+ content: [
176+ {
177+ type: "text",
178+ text: JSON.stringify(response.data.list, null, 2),
179+ },
180+ ],
181+ }
182+ } catch (error) {
183+ if (axios.isAxiosError(error)) {
184+ return {
185+ content: [
186+ {
187+ type: "text",
188+ text: \`Weather API error: \${error.response?.data.message ?? error.message}\`,
189+ },
190+ ],
191+ isError: true,
192+ }
193+ }
194+ throw error
195+ }
196+ },
197+ )
195198
196199// Add a resource for current weather in San Francisco
197- server.resource(
198- "sf_weather",
199- { uri: "weather://San Francisco/current", list: true },
200- async (uri) => {
201- try {
202- const response = weatherApi.get<WeatherData>('weather', {
203- params: { q: "San Francisco" },
204- });
205-
206- return {
207- contents: [
208- {
209- uri: uri.href,
210- mimeType: "application/json",
211- text: JSON.stringify(
212- {
213- temperature: response.data.main.temp,
214- conditions: response.data.weather[0].description,
215- humidity: response.data.main.humidity,
216- wind_speed: response.data.wind.speed,
217- timestamp: new Date().toISOString(),
218- },
219- null,
220- 2
221- ),
222- },
223- ],
224- };
225- } catch (error) {
226- if (axios.isAxiosError(error)) {
227- throw new Error(\`Weather API error: \${
228- error.response?.data.message ?? error.message
229- }\`);
230- }
231- throw error;
232- }
233- }
234- );
200+ server.resource("sf_weather", { uri: "weather://San Francisco/current", list: true }, async (uri) => {
201+ try {
202+ const response = weatherApi.get<WeatherData>("weather", {
203+ params: { q: "San Francisco" },
204+ })
205+
206+ return {
207+ contents: [
208+ {
209+ uri: uri.href,
210+ mimeType: "application/json",
211+ text: JSON.stringify(
212+ {
213+ temperature: response.data.main.temp,
214+ conditions: response.data.weather[0].description,
215+ humidity: response.data.main.humidity,
216+ wind_speed: response.data.wind.speed,
217+ timestamp: new Date().toISOString(),
218+ },
219+ null,
220+ 2,
221+ ),
222+ },
223+ ],
224+ }
225+ } catch (error) {
226+ if (axios.isAxiosError(error)) {
227+ throw new Error(\`Weather API error: \${error.response?.data.message ?? error.message}\`)
228+ }
229+ throw error
230+ }
231+ })
235232
236233// Add a dynamic resource template for current weather by city
237234server.resource(
238- "current_weather",
239- new ResourceTemplate("weather://{city}/current", { list: true }),
240- async (uri, { city }) => {
241- try {
242- const response = await weatherApi.get('weather', {
243- params: { q: city },
244- });
245-
246- return {
247- contents: [
248- {
249- uri: uri.href,
250- mimeType: "application/json",
251- text: JSON.stringify(
252- {
253- temperature: response.data.main.temp,
254- conditions: response.data.weather[0].description,
255- humidity: response.data.main.humidity,
256- wind_speed: response.data.wind.speed,
257- timestamp: new Date().toISOString(),
258- },
259- null,
260- 2
261- ),
262- },
263- ],
264- };
265- } catch (error) {
266- if (axios.isAxiosError(error)) {
267- throw new Error(\`Weather API error: \${
268- error.response?.data.message ?? error.message
269- }\`);
270- }
271- throw error;
272- }
273- }
274- );
235+ "current_weather",
236+ new ResourceTemplate("weather://{city}/current", { list: true }),
237+ async (uri, { city }) => {
238+ try {
239+ const response = await weatherApi.get("weather", {
240+ params: { q: city },
241+ })
242+
243+ return {
244+ contents: [
245+ {
246+ uri: uri.href,
247+ mimeType: "application/json",
248+ text: JSON.stringify(
249+ {
250+ temperature: response.data.main.temp,
251+ conditions: response.data.weather[0].description,
252+ humidity: response.data.main.humidity,
253+ wind_speed: response.data.wind.speed,
254+ timestamp: new Date().toISOString(),
255+ },
256+ null,
257+ 2,
258+ ),
259+ },
260+ ],
261+ }
262+ } catch (error) {
263+ if (axios.isAxiosError(error)) {
264+ throw new Error(\`Weather API error: \${error.response?.data.message ?? error.message}\`)
265+ }
266+ throw error
267+ }
268+ },
269+ )
275270
276271// Start receiving messages on stdin and sending messages on stdout
277- const transport = new StdioServerTransport();
278- await server.connect(transport);
279- console.error(' Weather MCP server running on stdio');
272+ const transport = new StdioServerTransport()
273+ await server.connect(transport)
274+ console.error(" Weather MCP server running on stdio")
280275\`\`\`
281276
282277(Remember: This is just an example–you may use different dependencies, break the implementation up into multiple files, etc.)
0 commit comments