Build MCP servers, clients, and agents in TypeScript

One SDK for everything MCP. Build AI agents, connect to MCP servers, or create your own. Deploy to mcp-use Cloud with one command.

agent.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { MCPClient, MCPAgent } from "mcp-use";
import { ChatOpenAI } from "@langchain/openai";
const client = new MCPClient({
configPath: "./mcp.json"
});
const agent = new MCPAgent({
llm: new ChatOpenAI({ model: "gpt-4o" }),
client,
maxSteps: 30
});
const result = await agent.run("Analyze sales data");
6sense Logo
Elastic Logo
IBM Logo
Innovacer Logo
Intuit Logo
NVIDIA Logo
Oracle Logo
Red Hat Logo
Tavily Logo
Verizon Logo
6sense Logo
Elastic Logo
IBM Logo
Innovacer Logo
Intuit Logo
NVIDIA Logo
Oracle Logo
Red Hat Logo
Tavily Logo
Verizon Logo
Use Cases

Three tools for MCP development

Build AI agents that use tools, connect to any MCP server, or create your own server with UI widgets.

agent.ts
import { MCPClient, MCPAgent } from "mcp-use";
import { ChatOpenAI } from "@langchain/openai";
const client = new MCPClient({
configPath: "./mcp.json"
});
const agent = new MCPAgent({
llm: new ChatOpenAI({ model: "gpt-4o" }),
client,
maxSteps: 30
});
const result = await agent.run("Analyze sales data");

MCP Agent

Build AI agents that interact with external tools and services. The MCPAgent combines LLM integration, tool orchestration, and memory management.

  • LLM support: OpenAI, Anthropic, Google, Groq
  • Auto tool calling: Agents select and execute tools automatically
  • Multi-server: Connect to multiple MCP servers at once
  • Streaming: Real-time response streaming
  • Memory: Built-in conversation history

MCP Client

Connect to MCP servers programmatically. Supports all primitives: tools, resources, prompts, sampling, elicitation, and notifications.

  • Multi-server: Connect to multiple servers at once
  • Transports: STDIO, HTTP, WebSocket, SSE
  • Type-safe: Full TypeScript support with inference
  • Middleware: Add logging, metrics, and custom handlers
  • Sandbox: Secure execution for untrusted code
client.ts
import { MCPClient } from "mcp-use";
const client = new MCPClient({
mcpServers: {
github: { url: "https://api.github.com/mcp" },
linear: { url: "https://mcp.linear.app/mcp" },
custom: { url: "http://localhost:3000/mcp" }
}
});
await client.createAllSessions();
const tools = await client.getSession("github").listTools();
const result = await client.getSession("linear")
.callTool("create_issue", { title: "Bug fix" });
server.ts
import { MCPServer, text } from "mcp-use/server";
import { z } from "zod";
const server = new MCPServer({
name: "my-server",
version: "1.0.0"
});
server.tool({
name: "greet",
description: "Greet someone by name",
schema: z.object({
name: z.string().describe("Person name")
})
}, async ({ name }) =>
text(`Hello, ${name}!`)
);
await server.listen(3000);

MCP Server

Build MCP servers so agents can connect to your service. 100% compatible with MCP specs. Works with Claude, ChatGPT, Cursor, and any MCP client.

  • One command: npx create-mcp-use-app to scaffold
  • Apps SDK: UI widgets for ChatGPT and MCP-UI
  • Inspector: Built-in debugger at /inspector
  • Edge runtime: Deploy to Cloudflare, Vercel, etc.
  • 100/100: MCP conformance score
Apps SDK

UI widgets for ChatGPT

Drop React components in your resources/ folder. They become MCP tools that render directly in ChatGPT and other chat clients.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { createMCPServer } from 'mcp-use/server'
// The MCP Inspector is automatically mounted at /inspector
const server = createMCPServer('my-mcp-server', {
version: '1.0.0',
description: 'An MCP server with Apps SDK support for ChatGPT',
baseUrl: process.env.MCP_URL,
})
// UI Widgets are React components in the "resources/" folder.
// They are automatically registered as both MCP tools and resources.
// ...
// Add your tools, resources, and prompts here
MCP Server
mcp-useInspector
Select a MCP Tool to inspect

How it works

  • 1. Create a React component: Create a React component in resources/ folder
  • 2. Auto-registration: mcp-use auto-registers it as an MCP tool
  • 3. Widget rendering: Widget renders in ChatGPT when tool is called
  • 4. Universal compatibility: Works with Apps SDK and MCP-UI clients
Developer Experience

Built for developers

Simple API, great defaults, and tools that help you ship faster.

Built-in Inspector

Every server launches with a visual inspector at /inspector. Test tools, view resources, debug JSON-RPC messages.

Type Safety

Full TypeScript support with automatic type inference. Zod schemas for runtime validation.

Zero Config

npx create-mcp-use-app sets up everything. TypeScript, build tools, dev server, inspector, all ready.

Hot Reload

Changes reflect instantly during development. No restart needed for tools, resources, or widgets.

useMcp Hook

React hook for MCP connections. Manage state, call tools, and build chat UIs with minimal code.

Hono + Express

Add custom HTTP routes alongside MCP endpoints. Full Express/Hono API available on the server instance.

Stats

Trusted by developers worldwide

mcp-use powers MCP applications for thousands of developers

1.5M+

MCP requests processed

4,000+

Companies building with mcp-use

8,000+

GitHub stars

Join MCP community

Get help, share your projects, and get inspired.

The community for developers building with MCP and mcp-use.

Begin your MCP journey
in the
fastest way

Build with mcp-use SDKs, preview with our inspector, deploy with mcp-use Cloud.