About Ts Mcp Client Server
A TypeScript example combining an MCP client, an MCP server, and a command-line chat interface that uses Anthropic's Claude API. It is for developers exploring how MCP components work together with an LLM.
Key features
- 01MCP server exposing and executing tools
- 02MCP client using stdio transport
- 03Command-line chat with Claude
- 04Anthropic SDK integration
Use cases
- 01Explore MCP client and server roles
- 02Run a stdio MCP demo
- 03Chat with Claude using MCP
MCP support
Includes an MCP server that exposes tools and an MCP client that starts a server over stdio. Its chat CLI uses MCP with Anthropic's Claude API.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP client and server example
src
├── chat.ts # command line chat interface to Claude completion
├── client.ts # MCP client that starts MCP server with stdio transport
├── index.ts # Node run script to start MCP server or Chat CLI
├── llm.ts # Uses Anthropic SDK to talk to Claude API
└── server.ts # MCP server that exposes tools and executes them
Depends
NPM # install with your package manager of choice (Recommend nix)
# nix shell nixpkgs#nodejs
ANTHROPIC_API_KEY='' # Put your key here in .env.local file
Build
npm run build
Run MCP stdio client/server demo
npm run mcp
Run CLI chat with Anthropic using MCP
npm run chat
TODO
NOTE: Used Claude and Gemini web chat interface to generate some boiler plate code.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.