diff --git a/README.md b/README.md index 1c5d037a..cfa91d48 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,11 @@ server.resource( }] }) ); + +// Connect to a transport +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +const transport = new StdioServerTransport(); +await server.connect(transport); ``` ## What is MCP? @@ -385,7 +390,6 @@ const client = new Client( resources: {}, tools: {} } - } ); await client.connect(transport); @@ -410,6 +414,58 @@ const result = await client.callTool("example-tool", { }); ``` +## Running Your Server + +### Development Mode + +To run your server in development mode, you can use the following command: + +```bash +npm run dev +``` + +This will start your server with hot-reloading enabled, so any changes you make to your code will automatically restart the server. + +### Claude Desktop Integration + +To integrate your server with Claude Desktop, follow these steps: + +1. Install Claude Desktop from the official website. +2. Configure Claude Desktop to connect to your MCP server by specifying the server's address and port. +3. Start your MCP server and ensure it is running. +4. Launch Claude Desktop and verify the connection to your MCP server. + +### Direct Execution + +To run your server directly, use the following command: + +```bash +node dist/index.js +``` + +This will start your server using the compiled JavaScript files in the `dist` directory. + +### Running with MCP Inspector + +To run your server with the MCP Inspector, follow these steps: + +1. Install the MCP Inspector globally using npm: + ```bash + npm install -g @modelcontextprotocol/inspector + ``` + +2. Start your MCP server: + ```bash + npm run start + ``` + +3. In a separate terminal, start the MCP Inspector and connect it to your running server: + ```bash + npx @modelcontextprotocol/inspector npm run -s start + ``` + +This will start the MCP Inspector and connect it to your running server, allowing you to inspect and interact with your server's resources, tools, and prompts. + ## Documentation - [Model Context Protocol documentation](https://modelcontextprotocol.io)