What is MCP TypeScript SDK?
The MCP TypeScript SDK is a library that implements the full Model Context Protocol (MCP) specification, enabling developers to build MCP clients and servers in TypeScript. It exposes data and functionality to LLM applications through resources, tools, and prompts, using standard transports like stdio and SSE.
How to use MCP TypeScript SDK?
Install via npm install @modelcontextprotocol/sdk. Create an McpServer instance, add resources, tools, or prompts, then connect it to a transport (e.g., StdioServerTransport). For clients, use the Client class with a StdioClientTransport. Examples and the MCP Inspector help with testing and debugging.
Key features of MCP TypeScript SDK
- Full implementation of the MCP specification in TypeScript
- Build MCP servers with resources, tools, and prompts
- Build MCP clients that connect to any MCP server
- Supports stdio and HTTP with SSE transports
- High-level
McpServer and low-level Server APIs
- Includes a client library with typed method calls
Use cases of MCP TypeScript SDK
- Expose a database schema and run SQL queries through MCP tools
- Create an echo server demonstrating resources, tools, and prompts
- Build a remote MCP server accessible over HTTP with SSE
- Develop an LLM‑friendly API wrapper for weather or other external services
- Test server behavior with the MCP Inspector before deployment
评论