diff --git a/build/deployments/typescript.mdx b/build/deployments/typescript.mdx index dc66644..3b99d40 100644 --- a/build/deployments/typescript.mdx +++ b/build/deployments/typescript.mdx @@ -117,6 +117,47 @@ This opens the **Smithery interactive playground** where you can: - Validate your configuration schema - Experiment with different inputs +## Advanced Build Configuration + +For advanced use cases, you can customize the build process using a `smithery.config.js` file. This is useful for: + +- Marking packages as external (to avoid bundling issues) +- Configuring minification, targets, and other build options +- Adding custom esbuild plugins + +### Configuration File + +Create `smithery.config.js` in your project root: + +```javascript +export default { + esbuild: { + // Mark problematic packages as external + external: ["playwright-core", "puppeteer-core"], + + // Enable minification for production + minify: true, + + // Set Node.js target version + target: "node18", + }, +}; +``` + +### Common Use Cases + +**External Dependencies**: If you encounter bundling issues with packages like Playwright or native modules: + +```javascript +export default { + esbuild: { + external: ["playwright-core", "sharp", "@grpc/grpc-js"], + }, +}; +``` + +Configuration applies to both `build` and `dev` commands. + ## Deploy 1. Push your code (including `smithery.yaml`) to GitHub diff --git a/cookbooks/python_custom_container.mdx b/cookbooks/python_custom_container.mdx index 32f9127..0671723 100644 --- a/cookbooks/python_custom_container.mdx +++ b/cookbooks/python_custom_container.mdx @@ -1,5 +1,5 @@ --- -title: "Build a Python MCP Server with FastMCP and Docker" +title: "Build Python MCP Server with FastMCP" description: "Build and deploy a Python MCP server using Docker containers with step-by-step instructions" --- diff --git a/cookbooks/python_custom_container_advanced.mdx b/cookbooks/python_custom_container_advanced.mdx index 27844f8..c5ce538 100644 --- a/cookbooks/python_custom_container_advanced.mdx +++ b/cookbooks/python_custom_container_advanced.mdx @@ -1,5 +1,5 @@ --- -title: "Build a Python MCP Server with FastMCP and Docker" +title: "Host a Python MCP Server with FastMCP and Docker" description: "Build and deploy a Python MCP server using Docker containers with step-by-step instructions" --- diff --git a/getting_started/quickstart_build.mdx b/getting_started/quickstart_build.mdx index 2b8d1a8..0f83775 100644 --- a/getting_started/quickstart_build.mdx +++ b/getting_started/quickstart_build.mdx @@ -1,90 +1,80 @@ --- -title: "Quickstart: Build your first MCP server" +title: "Quickstart: Build and deploy MCP servers" +icon: "rocket" description: "Build and deploy your first Streamable HTTP MCP server in 10 minutes" --- ![npm create smithery](../images/npm-create-smithery.png) -In this quickstart, we'll build a simple MCP server that says hello to users. You'll learn how to create tools, handle requests, and deploy your server with automatic CI/CD. We'll use the TypeScript MCP SDK with the Smithery CLI for the fastest development experience. For other languages like Python, check out our [Python custom container guide](/cookbooks/python_custom_container). +In this quickstart, we'll build a simple MCP server that says hello to users. We'll use the official TypeScript MCP SDK with the Smithery CLI. + +For other languages like Python, check out our [custom container guide](/cookbooks/python_custom_container). ### Prerequisites - [Node.js](https://nodejs.org/) >18 (includes npm) - A [Smithery API key](https://smithery.ai) for development features -### 1. Initialize Project +### 1. Initialize the Server ```bash npm create smithery ``` -### 2. Edit Your Server +This sets up a TypeScript MCP server scaffold with example code and all necessary dependencies. + +### 2. Edit the Server + +In `src/index.ts`, you'll see a default server that says hello to a given name. Edit it to add your own tools, resources, and prompts. -In `src/index.ts`, you'll see a default server that says hello to a given name. Edit it to add your own tools. For more information on the MCP spec, check out the [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk?tab=readme-ov-file#quick-start). +Here's the basic structure: ```typescript import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; -// Optional: Define configuration schema to require configuration at connection time +// Optional: Configuration schema for session // export const configSchema = z.object({ -// debug: z.boolean().default(false).describe("Enable debug logging") +// debug: z.boolean().default(false).describe("Enable debug logging"), // }); -export default function ({ config }: { config: z.infer }) { - // Create a new MCP server per MCP spec +export default function createServer({ config }) { const server = new McpServer({ - name: "My MCP Server", + name: "Say Hello", version: "1.0.0", }); // Add a tool - server.tool( - "hello", - "Say hello to someone", - { - name: z.string().describe("Name to greet"), - }, - async ({ name }) => { - return { - content: [{ type: "text", text: `Hello, ${name}!` }], - }; - } - ); + server.registerTool("hello", { // [!code highlight] + title: "Hello Tool", // [!code highlight] + description: "Say hello to someone", // [!code highlight] + inputSchema: { name: z.string().describe("Name to greet") }, // [!code highlight] + }, async ({ name }) => ({ // [!code highlight] + content: [{ type: "text", text: `Hello, ${name}!` }], // [!code highlight] + })); // [!code highlight] + + // The scaffold also includes example resources and prompts + // server.registerResource(...) + // server.registerPrompt(...) return server.server; } ``` - -### Configuration Schema + +**Adding config schema (optional)** -MCP servers can accept [session configurations](/build/session-config) to customize their behavior for each client session. This allows users to provide API keys, adjust settings, or modify how your server operates when they connect. - -Export a `configSchema` using Zod to define what configuration your server accepts: +Smithery allows users to customize server behavior for each session by providing API keys, adjusting settings, or modifying operational parameters. Optionally export a `configSchema` using Zod to define what configuration your server accepts: ```typescript export const configSchema = z.object({ - myApiKey: z.string().describe("Required API key"), - options: z - .object({ - timeout: z.number().default(5000), - retries: z.number().default(3), - }) - .optional(), + apiKey: z.string().describe("Weather API key"), + temperatureUnit: z.enum(["celsius", "fahrenheit"]).default("celsius").describe("Temperature unit preference"), }); ``` + -Benefits: - -- **Type safety**: Use `z.infer` for TypeScript types -- **Runtime validation**: Automatically validate configuration at connection time -- **Auto-generated UI**: Smithery creates configuration forms based on your schema -- **Documentation**: Schema descriptions become help text for users - - - -### 3. Start Development Server +### 3. Testing the Server ```bash npm run dev @@ -92,49 +82,13 @@ npm run dev This will port-forward your local server to the Smithery Playground via ngrok. You can now test your server by prompting something like "Say hello to Henry". You can also reference the [Smithery CLI](https://github.com/smithery-ai/cli) for more controls. -### 4. Deploy +### 4. Deploy the Server -![Deployment](../images/deploy.png) +Deployment Deployment is a one-click process. Just [make a GitHub repo](https://github.com/new) and [click "Deploy" on the Smithery home page](https://smithery.ai/new). -## Advanced: Build Configuration - -For advanced use cases, you can customize the build process using a `smithery.config.js` file. This is useful for: - -- Marking packages as external (to avoid bundling issues) -- Configuring minification, targets, and other build options -- Adding custom esbuild plugins - -### Configuration File - -Create `smithery.config.js` in your project root: - -```javascript -export default { - esbuild: { - // Mark problematic packages as external - external: ["playwright-core", "puppeteer-core"], - - // Enable minification for production - minify: true, - - // Set Node.js target version - target: "node18", - }, -}; -``` - -### Common Use Cases - -**External Dependencies**: If you encounter bundling issues with packages like Playwright or native modules: - -```javascript -export default { - esbuild: { - external: ["playwright-core", "sharp", "@grpc/grpc-js"], - }, -}; -``` -Configuration applies to both `build` and `dev` commands. diff --git a/getting_started/quickstart_connect.mdx b/getting_started/quickstart_connect.mdx index 44c7da0..bff4ef0 100644 --- a/getting_started/quickstart_connect.mdx +++ b/getting_started/quickstart_connect.mdx @@ -1,5 +1,6 @@ --- -title: "Quickstart: Use an MCP server" +title: "Quickstart: Use MCP servers" +icon: "zap" description: "Connect to an MCP server" --- diff --git a/images/context7-smithery-2-og.png b/images/context7-smithery-2-og.png new file mode 100644 index 0000000..03ea11e Binary files /dev/null and b/images/context7-smithery-2-og.png differ diff --git a/images/context7-smithery-2.png b/images/context7-smithery-2.png new file mode 100644 index 0000000..c9e2be3 Binary files /dev/null and b/images/context7-smithery-2.png differ diff --git a/images/deploy-2-og.png b/images/deploy-2-og.png new file mode 100644 index 0000000..e163549 Binary files /dev/null and b/images/deploy-2-og.png differ diff --git a/images/deploy-2.png b/images/deploy-2.png new file mode 100644 index 0000000..d7c2bd2 Binary files /dev/null and b/images/deploy-2.png differ diff --git a/index.mdx b/index.mdx index 9060cfb..bf4aca4 100644 --- a/index.mdx +++ b/index.mdx @@ -1,6 +1,7 @@ --- title: "Introduction" -description: "Smithery is the largest open marketplace of Model Context Protocol (MCP) servers. We enable LLMs to do things like search the web, access databases, and more." +icon: "book-open" +description: "Smithery is the largest open marketplace of [Model Context Protocol](https://modelcontextprotocol.io/docs/getting-started/intro) (MCP) servers. Discover and deploy MCP servers that enable LLMs to search the web, access databases, and more." --- ## What can I do with Smithery? @@ -13,33 +14,31 @@ You can use Smithery to build, find, and use MCP servers. We host popular MCP se Learn more about MCP and how to use Smithery in our concepts section -You can also build and host your own MCP servers on Smithery, see the quickstarts below! - ## Quickstarts Install the [Context7 MCP server](https://smithery.ai/server/@upstash/context7-mcp) and use this prompt: ``` /context7 how do I build an MCP server using smithery? ``` ![Context7 - Smithery Integration](/images/context7-smithery.png) + Smithery Integration](/images/context7-smithery-2.png) Learn how to integrate Smithery MCP servers into your apps and agents