Get Started with MCP
Follow these steps to start building with Model Context Protocol servers and clients.
- 1
Install MCP SDK
Install the official Model Context Protocol SDK to start building servers or clients.
npm install @modelcontextprotocol/sdk # Or with other package managers yarn add @modelcontextprotocol/sdk pnpm add @modelcontextprotocol/sdk - 2
Create an MCP Server
Build a simple MCP server that can provide tools or resources to AI agents.
import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; const server = new Server( { name: "my-server", version: "1.0.0" }, { capabilities: { tools: {} } } ); - 3
Create an MCP Client
Connect to MCP servers from your AI application or agent.
import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; const client = new Client( { name: "my-client", version: "1.0.0" }, { capabilities: {} } ); - 4
Connect and Use Tools
Connect your client to the server and start using available tools.
// Connect to server await client.connect(transport); // List available tools const { tools } = await client.listTools(); // Call a tool const result = await client.callTool({ name: 'read_file', arguments: { path: '/path/to/file.txt' } }); - 5
Explore More
Discover more MCP servers and learn advanced concepts from our documentation.
Need Help?
Get support and learn more about Model Context Protocol.