MCP ExplorerExplorer

Typescript Sdk

@chatmcpon a year ago
4 MIT
FreeCommunity
AI Systems
MCP typescript-sdk

Overview

What is Typescript Sdk

The typescript-sdk is a software development kit designed for interacting with the MCP server using TypeScript. It provides tools and utilities to facilitate communication and integration with the MCP server’s API.

Use cases

Use cases for the typescript-sdk include building web applications that require real-time data from the MCP server, integrating third-party services with the MCP server, and developing client applications that leverage the capabilities of the MCP server.

How to use

To use the typescript-sdk, first install it via npm with the command ‘npm i @chatmcp/sdk’. Then, set up the MCP server by importing the RestServerTransport class, configuring the server’s port and endpoint, and starting the server. Finally, you can make API requests using curl to interact with the server.

Key features

Key features of the typescript-sdk include easy installation via npm, a straightforward API for server communication, and support for JSON-RPC protocol, allowing for structured requests and responses.

Where to use

The typescript-sdk can be used in various fields such as web development, application integration, and any environment where interaction with the MCP server is required, particularly in TypeScript-based projects.

Content

MCP Typescript SDK by ChatMCP

How to use

  1. install sdk
npm i @chatmcp/sdk
  1. update MCP Server
import { RestServerTransport } from "@chatmcp/sdk/server/rest.js";

async function main() {
  const port = 9593;
  const endpoint = "/rest";

  const transport = new RestServerTransport({ port, endpoint });
  await server.connect(transport);

  await transport.startServer();
}
  1. request api
curl -X POST http://127.0.0.1:9593/rest \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "initialize",
  "params": {
    "protocolVersion": "1.0",
    "capabilities": {},
    "clientInfo": {
      "name": "your_client_name",
      "version": "your_version"
    }
  }
}'

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers