mcp 1.28.0
pip install mcp
Released:
Model Context Protocol SDK
Navigation
Verified details
These details have been verified by PyPIProject links
GitHub Statistics
Maintainers
๐ Avatar for dsp from gravatar.comdsp ๐ Avatar for jspahrsummers from gravatar.com
jspahrsummers ๐ Avatar for Kludex from gravatar.com
Kludex ๐ Avatar for maxisbey from gravatar.com
maxisbey
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Anthropic, PBC.
- Maintainer: David Soria Parra
- Tags automation , git , llm , mcp
- Requires: Python >=3.10
-
Provides-Extra:
cli,rich,ws
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
Project description
MCP Python SDK
Python implementation of the Model Context Protocol (MCP)
๐ PyPI
๐ MIT licensed
๐ Python Version
๐ Documentation
๐ Protocol
๐ Specification
This documents v1.x, the stable release line of the MCP Python SDK. v2 is in alpha.
v2 pre-releases are published to PyPI as
2.0.0aN. Installers never select a pre-release unless you opt in (for examplepip install mcp==2.0.0a1), so v1.x users are unaffected. If your package depends onmcp, add a<2upper bound to your version constraint (for examplemcp>=1.27,<2) before the stable v2 release lands. See the v2 documentation and the migration guide for what's changing.v1.x remains recommended for production use. It is in maintenance mode and continues to receive critical bug fixes and security patches.
Table of Contents
Overview
The Model Context Protocol allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction. This Python SDK implements the full MCP specification, making it easy to:
- Build MCP clients that can connect to any MCP server
- Create MCP servers that expose resources, prompts and tools
- Use standard transports like stdio, SSE, and Streamable HTTP
- Handle all MCP protocol messages and lifecycle events
Installation
Adding MCP to your python project
We recommend using uv to manage your Python projects.
If you haven't created a uv-managed project yet, create one:
uvinitmcp-server-demo
cdmcp-server-demo
Then add MCP to your project dependencies:
uvadd"mcp[cli]"
Alternatively, for projects using pip for dependencies:
pipinstall"mcp[cli]"
Running the standalone MCP development tools
To run the mcp command with uv:
uvrunmcp
Quickstart
Let's create a simple MCP server that exposes a calculator tool and some data:
""" FastMCP quickstart example. Run from the repository root: uv run examples/snippets/servers/fastmcp_quickstart.py """ frommcp.server.fastmcpimport FastMCP # Create an MCP server mcp = FastMCP("Demo", json_response=True) # Add an addition tool @mcp.tool() defadd(a: int, b: int) -> int: """Add two numbers""" return a + b # Add a dynamic greeting resource @mcp.resource("greeting://{name}") defget_greeting(name: str) -> str: """Get a personalized greeting""" return f"Hello, {name}!" # Add a prompt @mcp.prompt() defgreet_user(name: str, style: str = "friendly") -> str: """Generate a greeting prompt""" styles = { "friendly": "Please write a warm, friendly greeting", "formal": "Please write a formal, professional greeting", "casual": "Please write a casual, relaxed greeting", } return f"{styles.get(style,styles['friendly'])} for someone named {name}." # Run with streamable HTTP transport if __name__ == "__main__": mcp.run(transport="streamable-http")
Full example: examples/snippets/servers/fastmcp_quickstart.py
You can install this server in Claude Code and interact with it right away. First, run the server:
uvrun--withmcpexamples/snippets/servers/fastmcp_quickstart.py
Then add it to Claude Code:
claudemcpadd--transporthttpmy-serverhttp://localhost:8000/mcp
Alternatively, you can test it with the MCP Inspector. Start the server as above, then in a separate terminal:
npx-y@modelcontextprotocol/inspector
In the inspector UI, connect to http://localhost:8000/mcp.
What is MCP?
The Model Context Protocol (MCP) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can:
- Expose data through Resources (think of these sort of like GET endpoints; they are used to load information into the LLM's context)
- Provide functionality through Tools (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect)
- Define interaction patterns through Prompts (reusable templates for LLM interactions)
- And more!
Documentation
- Building Servers -- tools, resources, prompts, logging, completions, sampling, elicitation, transports, ASGI mounting
- Writing Clients -- connecting to servers, using tools/resources/prompts, display utilities
- Authorization -- OAuth 2.1, token verification, client authentication
- Low-Level Server -- direct handler registration for advanced use cases
- Protocol Features -- MCP primitives, server capabilities
- Testing -- in-memory transport testing with pytest
- API Reference
- Experimental Features (Tasks)
- Model Context Protocol documentation
- Model Context Protocol specification
- Officially supported servers
Contributing
We are passionate about supporting contributors of all levels of experience and would love to see you get involved in the project. See the contributing guide to get started.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Verified details
These details have been verified by PyPIProject links
GitHub Statistics
Maintainers
๐ Avatar for dsp from gravatar.comdsp ๐ Avatar for jspahrsummers from gravatar.com
jspahrsummers ๐ Avatar for Kludex from gravatar.com
Kludex ๐ Avatar for maxisbey from gravatar.com
maxisbey
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Anthropic, PBC.
- Maintainer: David Soria Parra
- Tags automation , git , llm , mcp
- Requires: Python >=3.10
-
Provides-Extra:
cli,rich,ws
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp-1.28.0.tar.gz.
File metadata
- Download URL: mcp-1.28.0.tar.gz
- Upload date:
- Size: 636.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
559d3f9943674cafbe5744c5d3794f3237e8b47f9bbc58e20c0fad680d8487c2
|
|
| MD5 |
490e6a6c465b1d3d2c96b0d8fb9b30d2
|
|
| BLAKE2b-256 |
c1ee94c6c50ffc5b5cf4737052275d11b57367f32d1a8516e31dcd60591b3916
|
Provenance
The following attestation bundles were made for mcp-1.28.0.tar.gz:
Publisher:
publish-pypi.yml on modelcontextprotocol/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp-1.28.0.tar.gz -
Subject digest:
559d3f9943674cafbe5744c5d3794f3237e8b47f9bbc58e20c0fad680d8487c2 - Sigstore transparency entry: 1842071152
- Sigstore integration time:
-
Permalink:
modelcontextprotocol/python-sdk@32d32908feb7b15eddeb46872774bf95869cc5f0 -
Branch / Tag:
refs/tags/v1.28.0 - Owner: https://github.com/modelcontextprotocol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@32d32908feb7b15eddeb46872774bf95869cc5f0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcp-1.28.0-py3-none-any.whl.
File metadata
- Download URL: mcp-1.28.0-py3-none-any.whl
- Upload date:
- Size: 222.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c1e7cf3a9125557e418ecd4fed8e9adddce81b0dfdae4d6601d700f5beb71a4
|
|
| MD5 |
b845ac18365f9417fcabda1503852377
|
|
| BLAKE2b-256 |
2ee14c1dc1fbb688641a712d34650c3d58bbbdcb314ddb75bc5817bbf33515a4
|
Provenance
The following attestation bundles were made for mcp-1.28.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on modelcontextprotocol/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp-1.28.0-py3-none-any.whl -
Subject digest:
9c1e7cf3a9125557e418ecd4fed8e9adddce81b0dfdae4d6601d700f5beb71a4 - Sigstore transparency entry: 1842071222
- Sigstore integration time:
-
Permalink:
modelcontextprotocol/python-sdk@32d32908feb7b15eddeb46872774bf95869cc5f0 -
Branch / Tag:
refs/tags/v1.28.0 - Owner: https://github.com/modelcontextprotocol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@32d32908feb7b15eddeb46872774bf95869cc5f0 -
Trigger Event:
release
-
Statement type:
