Skip to main content
mcp-use is a unified MCP framework to build MCP servers, MCP clients and MCP Agents.
SectionDescription
AgentAn AI Agent with tool calling capabilities through MCP connectionsExamples
ClientA full featured MCP Client implementation for TypeScript with node, browser and react supportExamples
ServerThe MCP Server framework implementation for TypeScript, with Apps SDK and MCP-UI supportExamples

MCP Agent

mcp-use has a complete MCP Agent implementation for TypeScript. MCP Agents are AI-powered agents that can use tools from MCP servers to accomplish complex tasks. They reason across multiple steps, selecting and executing tools as needed. Building such agents is easy with mcp-use, all you need is an LLM and the MCP Client.
yarn add mcp-use
Here’s a simple example to get you started for an agent with browser tools support.
TypeScript
import { ChatOpenAI } from '@langchain/openai' // use your preferred LLM provider
import { MCPAgent, MCPClient } from 'mcp-use'
// Create MCPClient from configuration object
const client = new MCPClient({
  mcpServers: {
    playwright: {
      command: 'npx',
      args: ['@playwright/mcp@latest'],
      env: {
        DISPLAY: ':1'
      }
    }
  }
})

// Create agent with the client
const agent = new MCPAgent({
  llm: new ChatOpenAI({ model: 'gpt-5.1' }), // use your preferred LLM provider
  client,
  maxSteps: 30
})

// Run the query
const result = await agent.run(
    'Find the best restaurant in San Francisco USING GOOGLE SEARCH'
)
console.log(`\nResult: ${result}`)

// Clean up
await client.closeAllSessions()

For multi-server setups, tool restrictions, and advanced configuration options, see the Agent Configuration and Client Configuration guides.
For a complete overview of the mcp-use MCP Agent, see the MCP Agent documentation.

Available MCP Servers

mcp-use supports any MCP server. Check out the Awesome MCP Servers list for available options. Or deploy your own following the instruction below.

MCP Client

mcp-use has a complete MCP Client implementation for TypeScript. It improves the official Model Context Protocol Client SDK with browser and server environments support, react hooks and more. The mcp-use client has a conformance score of 100/100 based on the official MCP Conformance Tests.
yarn add mcp-use
Then create a new MCP Client:
import { MCPClient } from 'mcp-use'

const client = new MCPClient({
    mcpServers: {
        everything: {
            command: 'npx',
            args: ['-y', '@modelcontextprotocol/server-everything']
        }
    }
})

// Initialize all configured sessions
await client.createAllSessions()

// Get the session for a specific server
const session = client.getSession('everything')

// List available tools
const tools = await session.listTools()
console.log(`Available tools: ${tools.map(t => t.name).join(', ')}`)

// Call a specific tool with arguments
const result = await session.callTool(
    'add',
    { a: 1, b: 2 }
)
To learn more about the MCP Client, see the MCP Client documentation.

MCP Server

mcp-use has a complete MCP server framework implementation for TypeScript. It improves the official Model Context Protocol SDK with support for Edge Runtime, ChatGPT Apps SDK and MCP-UI. In addition, it supports all official MCP features and achieves a conformance score of 100/100 based on the official MCP Conformance Tests.
npx create-mcp-use-app my-mcp-server
cd my-mcp-server
npm install
npm run dev
This command will create a new MCP server with:
  • A complete TypeScript MCP server project structure.
  • Example MCP Tools and Resources to get you started.
  • Example UI Widgets React components in resources/ folder exposed as tools and resources in Apps SDK for ChatGPT and MCP-UI format.
  • Hot Module Reloading (HMR) - modify tools/prompts/resources without restarting or dropping connections.
  • Automatically launches an MCP Inspector in your browser to test your server.

Project Structure

After creation, your project will have this structure:
my-mcp-server/
├── resources/
│   └── component.tsx  # React widgets for Apps SDK and MCP-UI
├── index.ts           # MCP server entry point, you can add tools and rest endpoints here
├── package.json
├── tsconfig.json
└── README.md

Running Your MCP Server

Commands:
yarn dev   # start the development server
yarn build # build the server
yarn start # start the production server
yarn deploy # deploy the server to mcp-use cloud
When you run your MCP server, it will be available at:
  • MCP Endpoint: http://localhost:3000/mcp - For MCP client connections
  • MCP Inspector: http://localhost:3000/inspector

Deploy Your MCP Server

You can deploy your MCP server on any platform. Build your MCP server with npm run build and start the production server with npm run start. Or you can deploy it on mcp-use Cloud. For detailed instructions, see the Deploy Your Server guide.

Next Steps

  • Core features: Learn how to create MCP tools, prompts and resources.
  • UI Widgets: Expose UI components to chat clients compatible with ChatGPT Apps SDK and MCP-UI.
  • Configuration: Advanced configuration and deployment options.
  • Deploy Your Server - Deploy to production with one command

Next Steps

Need Help? Join our Discord or Github communities.