Skip to main content
This is the reference for building MCP servers, clients, agents, and React integrations in TypeScript with mcp-use. It documents public exports with exact signatures, parameters, return values, defaults, and minimal examples. For task-based walkthroughs and concepts, use the Docs tab. This section is the precise reference you cite when you already know what you are building.

Install

npm install mcp-use

CLI

The @mcp-use/cli package installs the mcp-use executable for local development, production builds, deployment, tunneling, type generation, and terminal-based MCP client workflows.

mcp-use CLI

Command reference for mcp-use dev, build, start, deploy, client, servers, deployments, skills, and generate-types.

CLI client

Use mcp-use client to connect to MCP servers, call tools, read resources, get prompts, and capture widget screenshots.

Import paths

The TypeScript SDK ships from several entry points. Use the entry point that matches where your code runs.
Import pathUse it to
mcp-useCreate Node.js MCP clients, enable Code Mode, and use shared client helpers.
mcp-use/browserCreate browser MCP clients for HTTP servers.
mcp-use/serverCreate the server, register tools, resources, and prompts, handle auth, sessions, middleware, and MCP Apps resources.
mcp-use/reactManage React client connections and build React widget UIs that render inside MCP Apps and ChatGPT.
Create a server with new MCPServer({ ... }). See the MCPServer reference for the constructor and all of its methods.

Server (mcp-use/server)

MCPServer

The server class: construct, register, and start a server.

ServerConfig

Every configuration option for new MCPServer.

Tools

tool() and the tool definition, callback, and annotation types.

Resources

resource(), resourceTemplate(), and their callbacks.

Prompts

prompt(), prompt types, and argument completion.

Tool context (ctx)

The ctx object: sample, elicit, log, progress, client, session.

Response helpers

text, object, image, widget, mix, and the rest.

Elicitation schemas

Enum and form schema builders for elicitation.

Authentication

getAuth, scope checks, and the JWT verifier.

OAuth providers

Provider factories and the OAuth proxy.

Sessions and streams

Pluggable session stores and stream managers.

Middleware and proxy

Operation middleware, framework adapters, and the CORS proxy.

MCP Apps

UI resource builders, protocol adapters, and landing pages.

Client (mcp-use, mcp-use/browser, mcp-use/react)

MCPClient

The Node.js client class: configure servers, create sessions, and manage lifecycle.

MCPSession

Live protocol calls for tools, resources, prompts, completion, roots, and notifications.

Code Mode

Code execution options, methods, executor classes, and result types.

React client

McpClientProvider, useMcpClient(), useMcpServer(), useMcp(), and storage providers.

React widget UI (mcp-use/react)

useWidget()

The universal hook for MCP Apps and Apps SDK widgets.

useCallTool()

Call MCP tools from a widget, with optional typed helpers.

useFiles()

Upload and manage files from a widget.

McpUseProvider

Provider that wires up the widget runtime and auto-sizing.

WidgetControls

Built-in debug and view controls.

ThemeProvider

Apply host theme variables to a widget.

ErrorBoundary

Catch and display widget render errors.

Image

Render images with correct host URLs.

ModelContext

Expose widget context to the model.