What is an MCP Server?
An MCP Server exposes tools, resources, and prompts that AI agents can use through the Model Context Protocol. mcp-use provides a simple decorator-based API for creating production-ready MCP servers in Python.Key Features
Simple Decorators
Define tools, resources, and prompts with intuitive decorators
Multiple Transports
Support for stdio, SSE, and streamable HTTP
Built-in Inspector
Debug mode with web UI for testing tools
Type Safety
Full type hints and Pydantic validation
Authentication
Built-in bearer token auth support
Middleware
Extensible middleware system
Quick Example
Architecture
Core Concepts
Tools
Tools are functions that AI agents can call to perform actions:Resources
Resources provide read-only data that agents can access:Prompts
Prompts are reusable templates for agent interactions:Transport Modes
Stdio Transport
For command-line integration and local development:HTTP Transport
For web-based integrations with server-sent events:Debug Mode
Enable debug mode to access development tools:http://localhost:8000/docs- API documentationhttp://localhost:8000/inspector- Interactive tool testing UIhttp://localhost:8000/openmcp.json- OpenMCP metadata
Context Access
Access request context in your tools:Error Handling
Return structured errors from tools:Next Steps
Creating Servers
Learn to build MCP servers
Tools
Define server tools
Resources
Expose data resources
Transport
Configure transport protocols