Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/mcp-use/mcp-use/llms.txt

Use this file to discover all available pages before exploring further.

Choose Your Language

mcp-use is available in both TypeScript and Python with consistent APIs across both languages.

TypeScript Installation

Prerequisites

Node.js Version: Node.js 20.19.0 or higher (22+ recommended)
Check your Node.js version:
node --version
If you need to upgrade, visit nodejs.org or use a version manager like nvm.

Package Managers

npm install mcp-use

Core Dependencies

mcp-use requires Zod for schema validation:
npm install mcp-use zod

Optional Dependencies

Depending on your use case, you may want to install additional packages:
npm install mcp-use @langchain/openai langchain
# or for Anthropic
npm install mcp-use @langchain/anthropic langchain
npm install mcp-use react react-dom
npm install mcp-use langfuse langfuse-langchain
npm install mcp-use ai @langchain/anthropic
npm install mcp-use @e2b/code-interpreter

Development Tools

For the best development experience, also install:
# CLI tool with hot reload and inspector
npm install -D @mcp-use/cli

# TypeScript and build tools
npm install -D typescript tsx @types/node

Project Scaffolding

The fastest way to start a new project:
npx create-mcp-use-app my-project
This creates a fully configured project with:
  • TypeScript configuration
  • Example server with tools and widgets
  • Hot reload setup
  • Auto-opening inspector
  • Build and deployment scripts

Verify Installation

Create a test file test.ts:
import { MCPServer, text } from "mcp-use/server";
import { z } from "zod";

const server = new MCPServer({
  name: "test-server",
  version: "1.0.0",
});

server.tool({
  name: "hello",
  description: "Say hello",
  schema: z.object({}),
}, async () => text("Hello from mcp-use!"));

await server.listen(3000);
console.log("Server running at http://localhost:3000");
Run it:
npx tsx test.ts
You should see:
Server running at http://localhost:3000
🔍 Inspector: http://localhost:3000/inspector
🚀 MCP endpoint: http://localhost:3000/mcp

IDE Setup

Visual Studio Code

Recommended extensions: TypeScript:
  • ESLint
  • Prettier
  • TypeScript and JavaScript Language Features
Python:
  • Python (Microsoft)
  • Pylance
  • Ruff

TypeScript Configuration

Create tsconfig.json:
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "outDir": "./dist"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

Troubleshooting

Make sure you’re importing from the correct subpaths:
import { MCPServer } from "mcp-use/server";  // ✅ Correct
import { MCPAgent } from "mcp-use/agent";    // ✅ Correct
import { MCPClient } from "mcp-use/client";  // ✅ Correct
import { useWidget } from "mcp-use/react";   // ✅ Correct
Make sure your virtual environment is activated and mcp-use is installed:
# Check if mcp-use is installed
pip list | grep mcp-use

# Reinstall if needed
pip install --upgrade mcp-use
mcp-use requires Node.js 20.19.0 or higher. Use nvm to switch versions:
nvm install 22
nvm use 22
mcp-use requires Python 3.11+. Check your version:
python --version
Use pyenv to manage Python versions:
pyenv install 3.11
pyenv local 3.11

Next Steps

Quickstart

Build your first MCP server

Concepts

Learn about the MCP protocol

Build docs developers (and LLMs) love