├── .prettierignore
├── logo
├── dark.png
├── light.png
└── dark.svg
├── sdk
└── java
│ ├── .DS_Store
│ ├── mcp-overview.mdx
│ └── mcp-client.mdx
├── images
├── og-image.png
├── current-weather.png
├── mcp-inspector.png
├── quickstart-menu.png
├── weather-alerts.png
├── quickstart-hammer.png
├── quickstart-tools.png
├── available-mcp-tools.png
├── quickstart-approve.png
├── quickstart-developer.png
├── quickstart-filesystem.png
├── quickstart-screenshot.png
├── client-claude-cli-python.png
├── quickstart-dotnet-client.png
├── visual-indicator-mcp-tools.png
├── java
│ ├── java-mcp-client-architecture.jpg
│ ├── java-mcp-server-architecture.jpg
│ └── class-diagrams.puml
├── claude-desktop-mcp-hammer-icon.svg
├── claude-desktop-mcp-plug-icon.svg
├── hero-light.svg
└── hero-dark.svg
├── README.md
├── snippets
└── snippet-intro.mdx
├── development
├── contributing.mdx
├── updates.mdx
└── roadmap.mdx
├── favicon.svg
├── LICENSE
├── CLAUDE.md
├── CONTRIBUTING.md
├── docs
├── concepts
│ ├── roots.mdx
│ ├── sampling.mdx
│ ├── resources.mdx
│ ├── tools.mdx
│ ├── architecture.mdx
│ ├── transports.mdx
│ └── prompts.mdx
└── tools
│ ├── inspector.mdx
│ └── debugging.mdx
├── tutorials
├── building-mcp-with-llms.mdx
└── building-a-client-node.mdx
├── docs.json
├── CODE_OF_CONDUCT.md
├── introduction.mdx
├── examples.mdx
└── quickstart
└── user.mdx
/.prettierignore:
--------------------------------------------------------------------------------
1 | *.mdx
--------------------------------------------------------------------------------
/logo/dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/logo/dark.png
--------------------------------------------------------------------------------
/logo/light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/logo/light.png
--------------------------------------------------------------------------------
/sdk/java/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/sdk/java/.DS_Store
--------------------------------------------------------------------------------
/images/og-image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/og-image.png
--------------------------------------------------------------------------------
/images/current-weather.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/current-weather.png
--------------------------------------------------------------------------------
/images/mcp-inspector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/mcp-inspector.png
--------------------------------------------------------------------------------
/images/quickstart-menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/quickstart-menu.png
--------------------------------------------------------------------------------
/images/weather-alerts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/weather-alerts.png
--------------------------------------------------------------------------------
/images/quickstart-hammer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/quickstart-hammer.png
--------------------------------------------------------------------------------
/images/quickstart-tools.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/quickstart-tools.png
--------------------------------------------------------------------------------
/images/available-mcp-tools.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/available-mcp-tools.png
--------------------------------------------------------------------------------
/images/quickstart-approve.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/quickstart-approve.png
--------------------------------------------------------------------------------
/images/quickstart-developer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/quickstart-developer.png
--------------------------------------------------------------------------------
/images/quickstart-filesystem.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/quickstart-filesystem.png
--------------------------------------------------------------------------------
/images/quickstart-screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/quickstart-screenshot.png
--------------------------------------------------------------------------------
/images/client-claude-cli-python.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/client-claude-cli-python.png
--------------------------------------------------------------------------------
/images/quickstart-dotnet-client.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/quickstart-dotnet-client.png
--------------------------------------------------------------------------------
/images/visual-indicator-mcp-tools.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/visual-indicator-mcp-tools.png
--------------------------------------------------------------------------------
/images/java/java-mcp-client-architecture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/java/java-mcp-client-architecture.jpg
--------------------------------------------------------------------------------
/images/java/java-mcp-server-architecture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/modelcontextprotocol/docs/HEAD/images/java/java-mcp-server-architecture.jpg
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Model Context Protocol documentation
2 |
3 | **This documentation has moved to [modelcontextprotocol/modelcontextprotocol](https://github.com/modelcontextprotocol/modelcontextprotocol/tree/main/docs).**
4 |
5 | Please file issues and pull requests for documentation changes there.
6 |
--------------------------------------------------------------------------------
/snippets/snippet-intro.mdx:
--------------------------------------------------------------------------------
1 | One of the core principles of software development is DRY (Don't Repeat
2 | Yourself). This is a principle that apply to documentation as
3 | well. If you find yourself repeating the same content in multiple places, you
4 | should consider creating a custom snippet to keep your content in sync.
5 |
--------------------------------------------------------------------------------
/development/contributing.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Contributing
3 | description: How to participate in Model Context Protocol development
4 | ---
5 |
6 | We welcome contributions from the community! Please review our [contributing guidelines](https://github.com/modelcontextprotocol/.github/blob/main/CONTRIBUTING.md) for details on how to submit changes.
7 |
8 | All contributors must adhere to our [Code of Conduct](https://github.com/modelcontextprotocol/.github/blob/main/CODE_OF_CONDUCT.md).
9 |
10 | For questions and discussions, please use [GitHub Discussions](https://github.com/orgs/modelcontextprotocol/discussions).
11 |
--------------------------------------------------------------------------------
/favicon.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024–2025 Anthropic, PBC and contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/CLAUDE.md:
--------------------------------------------------------------------------------
1 | # MCP Documentation Guidelines
2 |
3 | ## Build Commands
4 | - Preview changes locally: `mintlify dev`
5 | - Deploy: Automatic after PR merge to main branch
6 |
7 | ## Style Guidelines
8 | - Follow existing MDX formatting and components
9 | - Keep content clear, concise, and technically accurate
10 | - Include practical code examples where appropriate
11 | - Test all links and code samples before submitting
12 | - Maintain consistent structure with existing documentation
13 | - When documenting CLI commands, use two-line format with the prompt on a separate line: `$ claude` followed by `> /command`
14 | - Use appropriate headings: "When to use", "Steps", and "Tips" for tutorials
15 | - Branch naming convention: prefix with "ashwin/" (e.g., "ashwin/add-mcp-cli-docs")
16 |
17 | ## File Organization
18 | - Place new pages in appropriate sections (concepts, tutorials, etc.)
19 | - Update docs.json when adding new pages
20 | - Follow existing file naming conventions (kebab-case.mdx)
21 | - Include proper frontmatter in MDX files
22 |
23 | ## Documentation Standards
24 | - Prioritize user understanding over technical completeness
25 | - Document both basic syntax and concrete examples
26 | - Structure command documentation with clear formatting
27 | - For image analysis examples, use quotes: `$ claude "Analyze this image: /path/to/image.png"`
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to MCP Documentation
2 |
3 | Thank you for your interest in contributing to the Model Context Protocol (MCP) documentation! This guide will help you get started with contributing.
4 |
5 | ## Getting Started
6 |
7 | 1. Install the required tools:
8 | - Node.js
9 | - Git
10 | - [Mintlify CLI](https://www.npmjs.com/package/mintlify): `npm i -g mintlify`
11 | 2. Fork and clone the repository
12 | 3. Create a new branch for your changes
13 | 4. Run `mintlify dev` to preview changes locally
14 |
15 | ## Documentation Guidelines
16 |
17 | - Keep content clear, concise, and technically accurate
18 | - Follow the existing file structure and naming conventions
19 | - Include code examples where appropriate
20 | - Use proper MDX formatting and components
21 | - Test all links and code samples
22 |
23 | ## Content Types
24 |
25 | You can contribute to:
26 |
27 | - Conceptual guides
28 | - API reference documentation
29 | - Tutorials and quickstarts
30 | - Best practices and examples
31 | - Troubleshooting guides
32 |
33 | ## Pull Request Process
34 |
35 | 1. Ensure your changes follow our documentation guidelines
36 | 2. Update the relevant table of contents if needed
37 | 3. Test your changes locally using `mintlify dev`
38 | 4. Submit a pull request with a clear description of your changes
39 | 5. Wait for review and address any feedback
40 |
41 | ## Need Help?
42 |
43 | - Check existing documentation at [modelcontextprotocol.io](https://modelcontextprotocol.io)
44 | - [Open an issue](https://github.com/modelcontextprotocol/docs/issues) for bugs or concerns
45 | - Join our [community discussions](https://github.com/modelcontextprotocol/docs/discussions)
46 |
47 | ## Code of Conduct
48 |
49 | Please note that this project follows our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you agree to uphold these guidelines.
50 |
--------------------------------------------------------------------------------
/images/claude-desktop-mcp-hammer-icon.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/docs/concepts/roots.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Roots"
3 | description: "Understanding roots in MCP"
4 | ---
5 |
6 | Roots are a concept in MCP that define the boundaries where servers can operate. They provide a way for clients to inform servers about relevant resources and their locations.
7 |
8 | ## What are Roots?
9 |
10 | A root is a URI that a client suggests a server should focus on. When a client connects to a server, it declares which roots the server should work with. While primarily used for filesystem paths, roots can be any valid URI including HTTP URLs.
11 |
12 | For example, roots could be:
13 |
14 | ```
15 | file:///home/user/projects/myapp
16 | https://api.example.com/v1
17 | ```
18 |
19 | ## Why Use Roots?
20 |
21 | Roots serve several important purposes:
22 |
23 | 1. **Guidance**: They inform servers about relevant resources and locations
24 | 2. **Clarity**: Roots make it clear which resources are part of your workspace
25 | 3. **Organization**: Multiple roots let you work with different resources simultaneously
26 |
27 | ## How Roots Work
28 |
29 | When a client supports roots, it:
30 |
31 | 1. Declares the `roots` capability during connection
32 | 2. Provides a list of suggested roots to the server
33 | 3. Notifies the server when roots change (if supported)
34 |
35 | While roots are informational and not strictly enforcing, servers should:
36 |
37 | 1. Respect the provided roots
38 | 2. Use root URIs to locate and access resources
39 | 3. Prioritize operations within root boundaries
40 |
41 | ## Common Use Cases
42 |
43 | Roots are commonly used to define:
44 |
45 | - Project directories
46 | - Repository locations
47 | - API endpoints
48 | - Configuration locations
49 | - Resource boundaries
50 |
51 | ## Best Practices
52 |
53 | When working with roots:
54 |
55 | 1. Only suggest necessary resources
56 | 2. Use clear, descriptive names for roots
57 | 3. Monitor root accessibility
58 | 4. Handle root changes gracefully
59 |
60 | ## Example
61 |
62 | Here's how a typical MCP client might expose roots:
63 |
64 | ```json
65 | {
66 | "roots": [
67 | {
68 | "uri": "file:///home/user/projects/frontend",
69 | "name": "Frontend Repository"
70 | },
71 | {
72 | "uri": "https://api.example.com/v1",
73 | "name": "API Endpoint"
74 | }
75 | ]
76 | }
77 | ```
78 |
79 | This configuration suggests the server focus on both a local repository and an API endpoint while keeping them logically separated.
--------------------------------------------------------------------------------
/tutorials/building-mcp-with-llms.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Building MCP with LLMs"
3 | description: "Speed up your MCP development using LLMs such as Claude!"
4 | ---
5 |
6 | This guide will help you use LLMs to help you build custom Model Context Protocol (MCP) servers and clients. We'll be focusing on Claude for this tutorial, but you can do this with any frontier LLM.
7 |
8 | ## Preparing the documentation
9 |
10 | Before starting, gather the necessary documentation to help Claude understand MCP:
11 |
12 | 1. Visit https://modelcontextprotocol.io/llms-full.txt and copy the full documentation text
13 | 2. Navigate to either the [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) or [Python SDK repository](https://github.com/modelcontextprotocol/python-sdk)
14 | 3. Copy the README files and other relevant documentation
15 | 4. Paste these documents into your conversation with Claude
16 |
17 | ## Describing your server
18 |
19 | Once you've provided the documentation, clearly describe to Claude what kind of server you want to build. Be specific about:
20 |
21 | - What resources your server will expose
22 | - What tools it will provide
23 | - Any prompts it should offer
24 | - What external systems it needs to interact with
25 |
26 | For example:
27 | ```
28 | Build an MCP server that:
29 | - Connects to my company's PostgreSQL database
30 | - Exposes table schemas as resources
31 | - Provides tools for running read-only SQL queries
32 | - Includes prompts for common data analysis tasks
33 | ```
34 |
35 | ## Working with Claude
36 |
37 | When working with Claude on MCP servers:
38 |
39 | 1. Start with the core functionality first, then iterate to add more features
40 | 2. Ask Claude to explain any parts of the code you don't understand
41 | 3. Request modifications or improvements as needed
42 | 4. Have Claude help you test the server and handle edge cases
43 |
44 | Claude can help implement all the key MCP features:
45 |
46 | - Resource management and exposure
47 | - Tool definitions and implementations
48 | - Prompt templates and handlers
49 | - Error handling and logging
50 | - Connection and transport setup
51 |
52 | ## Best practices
53 |
54 | When building MCP servers with Claude:
55 |
56 | - Break down complex servers into smaller pieces
57 | - Test each component thoroughly before moving on
58 | - Keep security in mind - validate inputs and limit access appropriately
59 | - Document your code well for future maintenance
60 | - Follow MCP protocol specifications carefully
61 |
62 | ## Next steps
63 |
64 | After Claude helps you build your server:
65 |
66 | 1. Review the generated code carefully
67 | 2. Test the server with the MCP Inspector tool
68 | 3. Connect it to Claude.app or other MCP clients
69 | 4. Iterate based on real usage and feedback
70 |
71 | Remember that Claude can help you modify and improve your server as requirements change over time.
72 |
73 | Need more guidance? Just ask Claude specific questions about implementing MCP features or troubleshooting issues that arise.
--------------------------------------------------------------------------------
/development/updates.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "What's New"
3 | description: 'The latest updates and improvements to MCP'
4 | ---
5 |
6 |
7 | - Fix issues and cleanup API
8 | - Added binary compatibility tracking to avoid breaking changes
9 | - Drop jdk requirements to JDK8
10 | - Added Claude Desktop integration with sample
11 | - The full changelog can be found here: https://github.com/modelcontextprotocol/kotlin-sdk/releases/tag/0.4.0
12 |
13 |
14 |
15 | - Version [0.8.1](https://github.com/modelcontextprotocol/java-sdk/releases/tag/v0.8.1) of the MCP Java SDK has been released,
16 | providing important bug fixes.
17 |
18 |
19 | - We are exited to announce the availability of the MCP
20 | [C# SDK](https://github.com/modelcontextprotocol/csharp-sdk/) developed by
21 | [Peder Holdgaard Pedersen](http://github.com/PederHP) and Microsoft. This joins our growing
22 | list of supported languages. The C# SDK is also available as
23 | [NuGet package](https://www.nuget.org/packages/ModelContextProtocol)
24 | - Python SDK 1.5.0 was released with multiple fixes and improvements.
25 |
26 |
27 | - Version [0.8.0](https://github.com/modelcontextprotocol/java-sdk/releases/tag/v0.8.0) of the MCP Java SDK has been released,
28 | delivering important session management improvements and bug fixes.
29 |
30 |
31 | - Typescript SDK 1.7.0 was released with multiple fixes and improvements.
32 |
33 |
34 | - We're excited to announce that the Java SDK developed by Spring AI at VMware Tanzu is now
35 | the official [Java SDK](https://github.com/modelcontextprotocol/java-sdk) for MCP.
36 | This joins our existing Kotlin SDK in our growing list of supported languages.
37 | The Spring AI team will maintain the SDK as an integral part of the Model Context Protocol
38 | organization. We're thrilled to welcome them to the MCP community!
39 |
40 |
41 |
42 | - Version [1.2.1](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.2.1) of the MCP Python SDK has been released,
43 | delivering important stability improvements and bug fixes.
44 |
45 |
46 | - Simplified, express-like API in the [TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
47 | - Added 8 new clients to the [clients page](https://modelcontextprotocol.io/clients)
48 |
49 |
50 |
51 | - FastMCP API in the [Python SDK](https://github.com/modelcontextprotocol/python-sdk)
52 | - Dockerized MCP servers in the [servers repo](https://github.com/modelcontextprotocol/servers)
53 |
54 |
55 |
56 | - Jetbrains released a Kotlin SDK for MCP!
57 | - For a sample MCP Kotlin server, check out [this repository](https://github.com/modelcontextprotocol/kotlin-sdk/tree/main/samples/kotlin-mcp-server)
58 |
59 |
--------------------------------------------------------------------------------
/development/roadmap.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Roadmap
3 | description: Our plans for evolving Model Context Protocol
4 | ---
5 |
6 | Last updated: **2025-03-27**
7 |
8 | The Model Context Protocol is rapidly evolving. This page outlines our current thinking on key priorities and direction for approximately **the next six months**, though these may change significantly as the project develops. To see what's changed recently, check out the **[specification changelog](https://spec.modelcontextprotocol.io/specification/2025-03-26/changelog/)**.
9 |
10 | The ideas presented here are not commitments—we may solve these challenges differently than described, or some may not materialize at all. This is also not an _exhaustive_ list; we may incorporate work that isn't mentioned here.
11 |
12 | We value community participation! Each section links to relevant discussions where you can learn more and contribute your thoughts.
13 |
14 | For a technical view of our standardization process, visit the [Standards Track](https://github.com/orgs/modelcontextprotocol/projects/2/views/2) on GitHub, which tracks how proposals progress toward inclusion in the official [MCP specification](https://spec.modelcontextprotocol.io).
15 |
16 | ## Validation
17 |
18 | To foster a robust developer ecosystem, we plan to invest in:
19 |
20 | - **Reference Client Implementations**: demonstrating protocol features with high-quality AI applications
21 | - **Compliance Test Suites**: automated verification that clients, servers, and SDKs properly implement the specification
22 |
23 | These tools will help developers confidently implement MCP while ensuring consistent behavior across the ecosystem.
24 |
25 | ## Registry
26 |
27 | For MCP to reach its full potential, we need streamlined ways to distribute and discover MCP servers.
28 |
29 | We plan to develop an [**MCP Registry**](https://github.com/orgs/modelcontextprotocol/discussions/159) that will enable centralized server discovery and metadata. This registry will primarily function as an API layer that third-party marketplaces and discovery services can build upon.
30 |
31 | ## Agents
32 |
33 | As MCP increasingly becomes part of agentic workflows, we're exploring [improvements](https://github.com/modelcontextprotocol/specification/discussions/111) such as:
34 |
35 | - **[Agent Graphs](https://github.com/modelcontextprotocol/specification/discussions/94)**: enabling complex agent topologies through namespacing and graph-aware communication patterns
36 | - **Interactive Workflows**: improving human-in-the-loop experiences with granular permissioning, standardized interaction patterns, and [ways to directly communicate](https://github.com/modelcontextprotocol/specification/issues/97) with the end user
37 |
38 | ## Multimodality
39 |
40 | Supporting the full spectrum of AI capabilities in MCP, including:
41 |
42 | - **Additional Modalities**: video and other media types
43 | - **[Streaming](https://github.com/modelcontextprotocol/specification/issues/117)**: multipart, chunked messages, and bidirectional communication for interactive experiences
44 |
45 | ## Governance
46 |
47 | We're implementing governance structures that prioritize:
48 |
49 | - **Community-Led Development**: fostering a collaborative ecosystem where community members and AI developers can all participate in MCP's evolution, ensuring it serves diverse applications and use cases
50 | - **Transparent Standardization**: establishing clear processes for contributing to the specification, while exploring formal standardization via industry bodies
51 |
52 | ## Get Involved
53 |
54 | We welcome your contributions to MCP's future! Join our [GitHub Discussions](https://github.com/orgs/modelcontextprotocol/discussions) to share ideas, provide feedback, or participate in the development process.
55 |
--------------------------------------------------------------------------------
/images/claude-desktop-mcp-plug-icon.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/docs.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://mintlify.com/docs.json",
3 | "theme": "willow",
4 | "name": "Model Context Protocol",
5 | "colors": {
6 | "primary": "#09090b",
7 | "light": "#FAFAFA",
8 | "dark": "#09090b"
9 | },
10 | "favicon": "/favicon.svg",
11 | "navigation": {
12 | "tabs": [
13 | {
14 | "tab": "Documentation",
15 | "groups": [
16 | {
17 | "group": "Get Started",
18 | "pages": [
19 | "introduction",
20 | {
21 | "group": "Quickstart",
22 | "pages": [
23 | "quickstart/server",
24 | "quickstart/client",
25 | "quickstart/user"
26 | ]
27 | },
28 | "examples",
29 | "clients"
30 | ]
31 | },
32 | {
33 | "group": "Tutorials",
34 | "pages": [
35 | "tutorials/building-mcp-with-llms",
36 | "docs/tools/debugging",
37 | "docs/tools/inspector"
38 | ]
39 | },
40 | {
41 | "group": "Concepts",
42 | "pages": [
43 | "docs/concepts/architecture",
44 | "docs/concepts/resources",
45 | "docs/concepts/prompts",
46 | "docs/concepts/tools",
47 | "docs/concepts/sampling",
48 | "docs/concepts/roots",
49 | "docs/concepts/transports"
50 | ]
51 | },
52 | {
53 | "group": "Development",
54 | "pages": [
55 | "development/updates",
56 | "development/roadmap",
57 | "development/contributing"
58 | ]
59 | }
60 | ]
61 | },
62 | {
63 | "tab": "SDKs",
64 | "icon": "book-open",
65 | "groups": [
66 | {
67 | "group": "Java",
68 | "pages": [
69 | "sdk/java/mcp-overview",
70 | "sdk/java/mcp-client",
71 | "sdk/java/mcp-server"
72 | ]
73 | }
74 | ]
75 | }
76 | ],
77 | "global": {
78 | "anchors": [
79 | {
80 | "anchor": "Python SDK",
81 | "href": "https://github.com/modelcontextprotocol/python-sdk",
82 | "icon": "python"
83 | },
84 | {
85 | "anchor": "TypeScript SDK",
86 | "href": "https://github.com/modelcontextprotocol/typescript-sdk",
87 | "icon": "square-js"
88 | },
89 | {
90 | "anchor": "Java SDK",
91 | "href": "https://github.com/modelcontextprotocol/java-sdk",
92 | "icon": "java"
93 | },
94 | {
95 | "anchor": "Kotlin SDK",
96 | "href": "https://github.com/modelcontextprotocol/kotlin-sdk",
97 | "icon": "square-k"
98 | },
99 | {
100 | "anchor": "C# SDK",
101 | "href": "https://github.com/modelcontextprotocol/csharp-sdk",
102 | "icon": "square-c"
103 | },
104 | {
105 | "anchor": "Specification",
106 | "href": "https://spec.modelcontextprotocol.io",
107 | "icon": "book"
108 | }
109 | ]
110 | }
111 | },
112 | "logo": {
113 | "light": "/logo/light.svg",
114 | "dark": "/logo/dark.svg"
115 | },
116 | "navbar": {
117 | "links": [],
118 | "primary": {
119 | "type": "button",
120 | "label": "GitHub",
121 | "href": "https://github.com/modelcontextprotocol"
122 | }
123 | },
124 | "seo": {
125 | "metatags": {
126 | "og:image": "https://raw.githubusercontent.com/modelcontextprotocol/docs/2eb6171ddbfeefde349dc3b8d5e2b87414c26250/images/og-image.png"
127 | },
128 | "indexing": "navigable"
129 | },
130 | "footer": {
131 | "socials": {
132 | "github": "https://github.com/modelcontextprotocol"
133 | }
134 | },
135 | "redirects": [
136 | {
137 | "source": "/tutorials/building-a-client",
138 | "destination": "/quickstart/client"
139 | },
140 | {
141 | "source": "/quickstart",
142 | "destination": "/quickstart/server"
143 | }
144 | ]
145 | }
146 |
--------------------------------------------------------------------------------
/docs/tools/inspector.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Inspector
3 | description: In-depth guide to using the MCP Inspector for testing and debugging Model Context Protocol servers
4 | ---
5 |
6 | The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) is an interactive developer tool for testing and debugging MCP servers. While the [Debugging Guide](/docs/tools/debugging) covers the Inspector as part of the overall debugging toolkit, this document provides a detailed exploration of the Inspector's features and capabilities.
7 |
8 | ## Getting started
9 |
10 | ### Installation and basic usage
11 |
12 | The Inspector runs directly through `npx` without requiring installation:
13 |
14 |
15 | ```bash
16 | npx @modelcontextprotocol/inspector
17 | ```
18 |
19 | ```bash
20 | npx @modelcontextprotocol/inspector
21 | ```
22 |
23 | #### Inspecting servers from NPM or PyPi
24 |
25 | A common way to start server packages from [NPM](https://npmjs.com) or [PyPi](https://pypi.com).
26 |
27 |
28 |
29 |
30 | ```bash
31 | npx -y @modelcontextprotocol/inspector npx
32 | # For example
33 | npx -y @modelcontextprotocol/inspector npx server-postgres postgres://127.0.0.1/testdb
34 | ```
35 |
36 |
37 |
38 | ```bash
39 | npx @modelcontextprotocol/inspector uvx
40 | # For example
41 | npx @modelcontextprotocol/inspector uvx mcp-server-git --repository ~/code/mcp/servers.git
42 | ```
43 |
44 |
45 |
46 | #### Inspecting locally developed servers
47 |
48 | To inspect servers locally developed or downloaded as a repository, the most common
49 | way is:
50 |
51 |
52 |
53 | ```bash
54 | npx @modelcontextprotocol/inspector node path/to/server/index.js args...
55 | ```
56 |
57 |
58 | ```bash
59 | npx @modelcontextprotocol/inspector \
60 | uv \
61 | --directory path/to/server \
62 | run \
63 | package-name \
64 | args...
65 | ```
66 |
67 |
68 |
69 | Please carefully read any attached README for the most accurate instructions.
70 |
71 | ## Feature overview
72 |
73 |
74 |
75 |
76 |
77 | The Inspector provides several features for interacting with your MCP server:
78 |
79 | ### Server connection pane
80 | - Allows selecting the [transport](/docs/concepts/transports) for connecting to the server
81 | - For local servers, supports customizing the command-line arguments and environment
82 |
83 | ### Resources tab
84 | - Lists all available resources
85 | - Shows resource metadata (MIME types, descriptions)
86 | - Allows resource content inspection
87 | - Supports subscription testing
88 |
89 | ### Prompts tab
90 | - Displays available prompt templates
91 | - Shows prompt arguments and descriptions
92 | - Enables prompt testing with custom arguments
93 | - Previews generated messages
94 |
95 | ### Tools tab
96 | - Lists available tools
97 | - Shows tool schemas and descriptions
98 | - Enables tool testing with custom inputs
99 | - Displays tool execution results
100 |
101 | ### Notifications pane
102 | - Presents all logs recorded from the server
103 | - Shows notifications received from the server
104 |
105 | ## Best practices
106 |
107 | ### Development workflow
108 |
109 | 1. Start Development
110 | - Launch Inspector with your server
111 | - Verify basic connectivity
112 | - Check capability negotiation
113 |
114 | 2. Iterative testing
115 | - Make server changes
116 | - Rebuild the server
117 | - Reconnect the Inspector
118 | - Test affected features
119 | - Monitor messages
120 |
121 | 3. Test edge cases
122 | - Invalid inputs
123 | - Missing prompt arguments
124 | - Concurrent operations
125 | - Verify error handling and error responses
126 |
127 | ## Next steps
128 |
129 |
130 |
135 | Check out the MCP Inspector source code
136 |
137 |
138 |
143 | Learn about broader debugging strategies
144 |
145 |
146 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | mcp-coc@anthropic.com.
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0, available at
119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120 |
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 |
124 | [homepage]: https://www.contributor-covenant.org
125 |
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at
128 | https://www.contributor-covenant.org/translations.
129 |
--------------------------------------------------------------------------------
/introduction.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Introduction
3 | description: 'Get started with the Model Context Protocol (MCP)'
4 | ---
5 |
6 | C# SDK released! Check out [what else is new.](/development/updates)
7 |
8 | MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.
9 |
10 | ## Why MCP?
11 |
12 | MCP helps you build agents and complex workflows on top of LLMs. LLMs frequently need to integrate with data and tools, and MCP provides:
13 | - A growing list of pre-built integrations that your LLM can directly plug into
14 | - The flexibility to switch between LLM providers and vendors
15 | - Best practices for securing your data within your infrastructure
16 |
17 | ### General architecture
18 |
19 | At its core, MCP follows a client-server architecture where a host application can connect to multiple servers:
20 |
21 | ```mermaid
22 | flowchart LR
23 | subgraph "Your Computer"
24 | Host["Host with MCP Client\n(Claude, IDEs, Tools)"]
25 | S1["MCP Server A"]
26 | S2["MCP Server B"]
27 | S3["MCP Server C"]
28 | Host <-->|"MCP Protocol"| S1
29 | Host <-->|"MCP Protocol"| S2
30 | Host <-->|"MCP Protocol"| S3
31 | S1 <--> D1[("Local\nData Source A")]
32 | S2 <--> D2[("Local\nData Source B")]
33 | end
34 | subgraph "Internet"
35 | S3 <-->|"Web APIs"| D3[("Remote\nService C")]
36 | end
37 | ```
38 |
39 | - **MCP Hosts**: Programs like Claude Desktop, IDEs, or AI tools that want to access data through MCP
40 | - **MCP Clients**: Protocol clients that maintain 1:1 connections with servers
41 | - **MCP Servers**: Lightweight programs that each expose specific capabilities through the standardized Model Context Protocol
42 | - **Local Data Sources**: Your computer's files, databases, and services that MCP servers can securely access
43 | - **Remote Services**: External systems available over the internet (e.g., through APIs) that MCP servers can connect to
44 |
45 | ## Get started
46 |
47 | Choose the path that best fits your needs:
48 |
49 | #### Quick Starts
50 |
51 |
56 | Get started building your own server to use in Claude for Desktop and other clients
57 |
58 |
63 | Get started building your own client that can integrate with all MCP servers
64 |
65 |
70 | Get started using pre-built servers in Claude for Desktop
71 |
72 |
73 |
74 | #### Examples
75 |
76 |
81 | Check out our gallery of official MCP servers and implementations
82 |
83 |
88 | View the list of clients that support MCP integrations
89 |
90 |
91 |
92 | ## Tutorials
93 |
94 |
95 |
100 | Learn how to use LLMs like Claude to speed up your MCP development
101 |
102 |
106 | Learn how to effectively debug MCP servers and integrations
107 |
108 |
113 | Test and inspect your MCP servers with our interactive debugging tool
114 |
115 |
120 |
121 |
122 |
123 |
124 | ## Explore MCP
125 |
126 | Dive deeper into MCP's core concepts and capabilities:
127 |
128 |
129 |
134 | Understand how MCP connects clients, servers, and LLMs
135 |
136 |
141 | Expose data and content from your servers to LLMs
142 |
143 |
148 | Create reusable prompt templates and workflows
149 |
150 |
155 | Enable LLMs to perform actions through your server
156 |
157 |
162 | Let your servers request completions from LLMs
163 |
164 |
169 | Learn about MCP's communication mechanism
170 |
171 |
172 |
173 | ## Contributing
174 |
175 | Want to contribute? Check out our [Contributing Guide](/development/contributing) to learn how you can help improve MCP.
176 |
177 | ## Support and Feedback
178 |
179 | Here's how to get help or provide feedback:
180 |
181 | - For bug reports and feature requests related to the MCP specification, SDKs, or documentation (open source), please [create a GitHub issue](https://github.com/modelcontextprotocol)
182 | - For discussions or Q&A about the MCP specification, use the [specification discussions](https://github.com/modelcontextprotocol/specification/discussions)
183 | - For discussions or Q&A about other MCP open source components, use the [organization discussions](https://github.com/orgs/modelcontextprotocol/discussions)
184 | - For bug reports, feature requests, and questions related to Claude.app and claude.ai's MCP integration, please see Anthropic's guide on [How to Get Support](https://support.anthropic.com/en/articles/9015913-how-to-get-support)
185 |
--------------------------------------------------------------------------------
/docs/concepts/sampling.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Sampling"
3 | description: "Let your servers request completions from LLMs"
4 | ---
5 |
6 | Sampling is a powerful MCP feature that allows servers to request LLM completions through the client, enabling sophisticated agentic behaviors while maintaining security and privacy.
7 |
8 |
9 | This feature of MCP is not yet supported in the Claude Desktop client.
10 |
11 |
12 | ## How sampling works
13 |
14 | The sampling flow follows these steps:
15 |
16 | 1. Server sends a `sampling/createMessage` request to the client
17 | 2. Client reviews the request and can modify it
18 | 3. Client samples from an LLM
19 | 4. Client reviews the completion
20 | 5. Client returns the result to the server
21 |
22 | This human-in-the-loop design ensures users maintain control over what the LLM sees and generates.
23 |
24 | ## Message format
25 |
26 | Sampling requests use a standardized message format:
27 |
28 | ```typescript
29 | {
30 | messages: [
31 | {
32 | role: "user" | "assistant",
33 | content: {
34 | type: "text" | "image",
35 |
36 | // For text:
37 | text?: string,
38 |
39 | // For images:
40 | data?: string, // base64 encoded
41 | mimeType?: string
42 | }
43 | }
44 | ],
45 | modelPreferences?: {
46 | hints?: [{
47 | name?: string // Suggested model name/family
48 | }],
49 | costPriority?: number, // 0-1, importance of minimizing cost
50 | speedPriority?: number, // 0-1, importance of low latency
51 | intelligencePriority?: number // 0-1, importance of capabilities
52 | },
53 | systemPrompt?: string,
54 | includeContext?: "none" | "thisServer" | "allServers",
55 | temperature?: number,
56 | maxTokens: number,
57 | stopSequences?: string[],
58 | metadata?: Record
59 | }
60 | ```
61 |
62 | ## Request parameters
63 |
64 | ### Messages
65 |
66 | The `messages` array contains the conversation history to send to the LLM. Each message has:
67 |
68 | - `role`: Either "user" or "assistant"
69 | - `content`: The message content, which can be:
70 | - Text content with a `text` field
71 | - Image content with `data` (base64) and `mimeType` fields
72 |
73 | ### Model preferences
74 |
75 | The `modelPreferences` object allows servers to specify their model selection preferences:
76 |
77 | - `hints`: Array of model name suggestions that clients can use to select an appropriate model:
78 | - `name`: String that can match full or partial model names (e.g. "claude-3", "sonnet")
79 | - Clients may map hints to equivalent models from different providers
80 | - Multiple hints are evaluated in preference order
81 |
82 | - Priority values (0-1 normalized):
83 | - `costPriority`: Importance of minimizing costs
84 | - `speedPriority`: Importance of low latency response
85 | - `intelligencePriority`: Importance of advanced model capabilities
86 |
87 | Clients make the final model selection based on these preferences and their available models.
88 |
89 | ### System prompt
90 |
91 | An optional `systemPrompt` field allows servers to request a specific system prompt. The client may modify or ignore this.
92 |
93 | ### Context inclusion
94 |
95 | The `includeContext` parameter specifies what MCP context to include:
96 |
97 | - `"none"`: No additional context
98 | - `"thisServer"`: Include context from the requesting server
99 | - `"allServers"`: Include context from all connected MCP servers
100 |
101 | The client controls what context is actually included.
102 |
103 | ### Sampling parameters
104 |
105 | Fine-tune the LLM sampling with:
106 |
107 | - `temperature`: Controls randomness (0.0 to 1.0)
108 | - `maxTokens`: Maximum tokens to generate
109 | - `stopSequences`: Array of sequences that stop generation
110 | - `metadata`: Additional provider-specific parameters
111 |
112 | ## Response format
113 |
114 | The client returns a completion result:
115 |
116 | ```typescript
117 | {
118 | model: string, // Name of the model used
119 | stopReason?: "endTurn" | "stopSequence" | "maxTokens" | string,
120 | role: "user" | "assistant",
121 | content: {
122 | type: "text" | "image",
123 | text?: string,
124 | data?: string,
125 | mimeType?: string
126 | }
127 | }
128 | ```
129 |
130 | ## Example request
131 |
132 | Here's an example of requesting sampling from a client:
133 | ```json
134 | {
135 | "method": "sampling/createMessage",
136 | "params": {
137 | "messages": [
138 | {
139 | "role": "user",
140 | "content": {
141 | "type": "text",
142 | "text": "What files are in the current directory?"
143 | }
144 | }
145 | ],
146 | "systemPrompt": "You are a helpful file system assistant.",
147 | "includeContext": "thisServer",
148 | "maxTokens": 100
149 | }
150 | }
151 | ```
152 |
153 | ## Best practices
154 |
155 | When implementing sampling:
156 |
157 | 1. Always provide clear, well-structured prompts
158 | 2. Handle both text and image content appropriately
159 | 3. Set reasonable token limits
160 | 4. Include relevant context through `includeContext`
161 | 5. Validate responses before using them
162 | 6. Handle errors gracefully
163 | 7. Consider rate limiting sampling requests
164 | 8. Document expected sampling behavior
165 | 9. Test with various model parameters
166 | 10. Monitor sampling costs
167 |
168 | ## Human in the loop controls
169 |
170 | Sampling is designed with human oversight in mind:
171 |
172 | ### For prompts
173 |
174 | - Clients should show users the proposed prompt
175 | - Users should be able to modify or reject prompts
176 | - System prompts can be filtered or modified
177 | - Context inclusion is controlled by the client
178 |
179 | ### For completions
180 |
181 | - Clients should show users the completion
182 | - Users should be able to modify or reject completions
183 | - Clients can filter or modify completions
184 | - Users control which model is used
185 |
186 | ## Security considerations
187 |
188 | When implementing sampling:
189 |
190 | - Validate all message content
191 | - Sanitize sensitive information
192 | - Implement appropriate rate limits
193 | - Monitor sampling usage
194 | - Encrypt data in transit
195 | - Handle user data privacy
196 | - Audit sampling requests
197 | - Control cost exposure
198 | - Implement timeouts
199 | - Handle model errors gracefully
200 |
201 | ## Common patterns
202 |
203 | ### Agentic workflows
204 |
205 | Sampling enables agentic patterns like:
206 |
207 | - Reading and analyzing resources
208 | - Making decisions based on context
209 | - Generating structured data
210 | - Handling multi-step tasks
211 | - Providing interactive assistance
212 |
213 | ### Context management
214 |
215 | Best practices for context:
216 |
217 | - Request minimal necessary context
218 | - Structure context clearly
219 | - Handle context size limits
220 | - Update context as needed
221 | - Clean up stale context
222 |
223 | ### Error handling
224 |
225 | Robust error handling should:
226 |
227 | - Catch sampling failures
228 | - Handle timeout errors
229 | - Manage rate limits
230 | - Validate responses
231 | - Provide fallback behaviors
232 | - Log errors appropriately
233 |
234 | ## Limitations
235 |
236 | Be aware of these limitations:
237 |
238 | - Sampling depends on client capabilities
239 | - Users control sampling behavior
240 | - Context size has limits
241 | - Rate limits may apply
242 | - Costs should be considered
243 | - Model availability varies
244 | - Response times vary
245 | - Not all content types supported
246 |
--------------------------------------------------------------------------------
/examples.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Example Servers
3 | description: 'A list of example servers and implementations'
4 | ---
5 |
6 | This page showcases various Model Context Protocol (MCP) servers that demonstrate the protocol's capabilities and versatility. These servers enable Large Language Models (LLMs) to securely access tools and data sources.
7 |
8 | ## Reference implementations
9 |
10 | These official reference servers demonstrate core MCP features and SDK usage:
11 |
12 | ### Data and file systems
13 | - **[Filesystem](https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem)** - Secure file operations with configurable access controls
14 | - **[PostgreSQL](https://github.com/modelcontextprotocol/servers/tree/main/src/postgres)** - Read-only database access with schema inspection capabilities
15 | - **[SQLite](https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite)** - Database interaction and business intelligence features
16 | - **[Google Drive](https://github.com/modelcontextprotocol/servers/tree/main/src/gdrive)** - File access and search capabilities for Google Drive
17 |
18 | ### Development tools
19 | - **[Git](https://github.com/modelcontextprotocol/servers/tree/main/src/git)** - Tools to read, search, and manipulate Git repositories
20 | - **[GitHub](https://github.com/modelcontextprotocol/servers/tree/main/src/github)** - Repository management, file operations, and GitHub API integration
21 | - **[GitLab](https://github.com/modelcontextprotocol/servers/tree/main/src/gitlab)** - GitLab API integration enabling project management
22 | - **[Sentry](https://github.com/modelcontextprotocol/servers/tree/main/src/sentry)** - Retrieving and analyzing issues from Sentry.io
23 |
24 | ### Web and browser automation
25 | - **[Brave Search](https://github.com/modelcontextprotocol/servers/tree/main/src/brave-search)** - Web and local search using Brave's Search API
26 | - **[Fetch](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch)** - Web content fetching and conversion optimized for LLM usage
27 | - **[Puppeteer](https://github.com/modelcontextprotocol/servers/tree/main/src/puppeteer)** - Browser automation and web scraping capabilities
28 |
29 | ### Productivity and communication
30 | - **[Slack](https://github.com/modelcontextprotocol/servers/tree/main/src/slack)** - Channel management and messaging capabilities
31 | - **[Google Maps](https://github.com/modelcontextprotocol/servers/tree/main/src/google-maps)** - Location services, directions, and place details
32 | - **[Memory](https://github.com/modelcontextprotocol/servers/tree/main/src/memory)** - Knowledge graph-based persistent memory system
33 |
34 | ### AI and specialized tools
35 | - **[EverArt](https://github.com/modelcontextprotocol/servers/tree/main/src/everart)** - AI image generation using various models
36 | - **[Sequential Thinking](https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking)** - Dynamic problem-solving through thought sequences
37 | - **[AWS KB Retrieval](https://github.com/modelcontextprotocol/servers/tree/main/src/aws-kb-retrieval-server)** - Retrieval from AWS Knowledge Base using Bedrock Agent Runtime
38 |
39 | ## Official integrations
40 |
41 | These MCP servers are maintained by companies for their platforms:
42 |
43 | - **[Axiom](https://github.com/axiomhq/mcp-server-axiom)** - Query and analyze logs, traces, and event data using natural language
44 | - **[Browserbase](https://github.com/browserbase/mcp-server-browserbase)** - Automate browser interactions in the cloud
45 | - **[Cloudflare](https://github.com/cloudflare/mcp-server-cloudflare)** - Deploy and manage resources on the Cloudflare developer platform
46 | - **[E2B](https://github.com/e2b-dev/mcp-server)** - Execute code in secure cloud sandboxes
47 | - **[Neon](https://github.com/neondatabase/mcp-server-neon)** - Interact with the Neon serverless Postgres platform
48 | - **[Obsidian Markdown Notes](https://github.com/calclavia/mcp-obsidian)** - Read and search through Markdown notes in Obsidian vaults
49 | - **[Qdrant](https://github.com/qdrant/mcp-server-qdrant/)** - Implement semantic memory using the Qdrant vector search engine
50 | - **[Raygun](https://github.com/MindscapeHQ/mcp-server-raygun)** - Access crash reporting and monitoring data
51 | - **[Search1API](https://github.com/fatwang2/search1api-mcp)** - Unified API for search, crawling, and sitemaps
52 | - **[Stripe](https://github.com/stripe/agent-toolkit)** - Interact with the Stripe API
53 | - **[Tinybird](https://github.com/tinybirdco/mcp-tinybird)** - Interface with the Tinybird serverless ClickHouse platform
54 | - **[Weaviate](https://github.com/weaviate/mcp-server-weaviate)** - Enable Agentic RAG through your Weaviate collection(s)
55 |
56 | ## Community highlights
57 |
58 | A growing ecosystem of community-developed servers extends MCP's capabilities:
59 |
60 | - **[Docker](https://github.com/ckreiling/mcp-server-docker)** - Manage containers, images, volumes, and networks
61 | - **[Kubernetes](https://github.com/Flux159/mcp-server-kubernetes)** - Manage pods, deployments, and services
62 | - **[Linear](https://github.com/jerhadf/linear-mcp-server)** - Project management and issue tracking
63 | - **[Snowflake](https://github.com/datawiz168/mcp-snowflake-service)** - Interact with Snowflake databases
64 | - **[Spotify](https://github.com/varunneal/spotify-mcp)** - Control Spotify playback and manage playlists
65 | - **[Todoist](https://github.com/abhiz123/todoist-mcp-server)** - Task management integration
66 |
67 | > **Note:** Community servers are untested and should be used at your own risk. They are not affiliated with or endorsed by Anthropic.
68 |
69 | For a complete list of community servers, visit the [MCP Servers Repository](https://github.com/modelcontextprotocol/servers).
70 |
71 | ## Getting started
72 |
73 | ### Using reference servers
74 |
75 | TypeScript-based servers can be used directly with `npx`:
76 |
77 | ```bash
78 | npx -y @modelcontextprotocol/server-memory
79 | ```
80 |
81 | Python-based servers can be used with `uvx` (recommended) or `pip`:
82 |
83 | ```bash
84 | # Using uvx
85 | uvx mcp-server-git
86 |
87 | # Using pip
88 | pip install mcp-server-git
89 | python -m mcp_server_git
90 | ```
91 |
92 | ### Configuring with Claude
93 |
94 | To use an MCP server with Claude, add it to your configuration:
95 |
96 | ```json
97 | {
98 | "mcpServers": {
99 | "memory": {
100 | "command": "npx",
101 | "args": ["-y", "@modelcontextprotocol/server-memory"]
102 | },
103 | "filesystem": {
104 | "command": "npx",
105 | "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/files"]
106 | },
107 | "github": {
108 | "command": "npx",
109 | "args": ["-y", "@modelcontextprotocol/server-github"],
110 | "env": {
111 | "GITHUB_PERSONAL_ACCESS_TOKEN": ""
112 | }
113 | }
114 | }
115 | }
116 | ```
117 |
118 | ## Additional resources
119 |
120 | - [MCP Servers Repository](https://github.com/modelcontextprotocol/servers) - Complete collection of reference implementations and community servers
121 | - [Awesome MCP Servers](https://github.com/punkpeye/awesome-mcp-servers) - Curated list of MCP servers
122 | - [MCP CLI](https://github.com/wong2/mcp-cli) - Command-line inspector for testing MCP servers
123 | - [MCP Get](https://mcp-get.com) - Tool for installing and managing MCP servers
124 | - [Supergateway](https://github.com/supercorp-ai/supergateway) - Run MCP stdio servers over SSE
125 | - [Zapier MCP](https://zapier.com/mcp) - MCP Server with over 7,000+ apps and 30,000+ actions
126 |
127 | Visit our [GitHub Discussions](https://github.com/orgs/modelcontextprotocol/discussions) to engage with the MCP community.
128 |
--------------------------------------------------------------------------------
/docs/tools/debugging.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Debugging
3 | description: A comprehensive guide to debugging Model Context Protocol (MCP) integrations
4 | ---
5 |
6 | Effective debugging is essential when developing MCP servers or integrating them with applications. This guide covers the debugging tools and approaches available in the MCP ecosystem.
7 |
8 |
9 | This guide is for macOS. Guides for other platforms are coming soon.
10 |
11 |
12 | ## Debugging tools overview
13 |
14 | MCP provides several tools for debugging at different levels:
15 |
16 | 1. **MCP Inspector**
17 | - Interactive debugging interface
18 | - Direct server testing
19 | - See the [Inspector guide](/docs/tools/inspector) for details
20 |
21 | 2. **Claude Desktop Developer Tools**
22 | - Integration testing
23 | - Log collection
24 | - Chrome DevTools integration
25 |
26 | 3. **Server Logging**
27 | - Custom logging implementations
28 | - Error tracking
29 | - Performance monitoring
30 |
31 | ## Debugging in Claude Desktop
32 |
33 | ### Checking server status
34 |
35 | The Claude.app interface provides basic server status information:
36 |
37 | 1. Click the icon to view:
38 | - Connected servers
39 | - Available prompts and resources
40 |
41 | 2. Click the icon to view:
42 | - Tools made available to the model
43 |
44 | ### Viewing logs
45 |
46 | Review detailed MCP logs from Claude Desktop:
47 |
48 | ```bash
49 | # Follow logs in real-time
50 | tail -n 20 -F ~/Library/Logs/Claude/mcp*.log
51 | ```
52 |
53 | The logs capture:
54 | - Server connection events
55 | - Configuration issues
56 | - Runtime errors
57 | - Message exchanges
58 |
59 | ### Using Chrome DevTools
60 |
61 | Access Chrome's developer tools inside Claude Desktop to investigate client-side errors:
62 |
63 | 1. Create a `developer_settings.json` file with `allowDevTools` set to true:
64 |
65 | ```bash
66 | echo '{"allowDevTools": true}' > ~/Library/Application\ Support/Claude/developer_settings.json
67 | ```
68 |
69 | 2. Open DevTools: `Command-Option-Shift-i`
70 |
71 | Note: You'll see two DevTools windows:
72 | - Main content window
73 | - App title bar window
74 |
75 | Use the Console panel to inspect client-side errors.
76 |
77 | Use the Network panel to inspect:
78 | - Message payloads
79 | - Connection timing
80 |
81 | ## Common issues
82 |
83 | ### Working directory
84 |
85 | When using MCP servers with Claude Desktop:
86 |
87 | - The working directory for servers launched via `claude_desktop_config.json` may be undefined (like `/` on macOS) since Claude Desktop could be started from anywhere
88 | - Always use absolute paths in your configuration and `.env` files to ensure reliable operation
89 | - For testing servers directly via command line, the working directory will be where you run the command
90 |
91 | For example in `claude_desktop_config.json`, use:
92 | ```json
93 | {
94 | "command": "npx",
95 | "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/username/data"]
96 | }
97 | ```
98 | Instead of relative paths like `./data`
99 |
100 | ### Environment variables
101 |
102 | MCP servers inherit only a subset of environment variables automatically, like `USER`, `HOME`, and `PATH`.
103 |
104 | To override the default variables or provide your own, you can specify an `env` key in `claude_desktop_config.json`:
105 |
106 | ```json
107 | {
108 | "myserver": {
109 | "command": "mcp-server-myapp",
110 | "env": {
111 | "MYAPP_API_KEY": "some_key",
112 | }
113 | }
114 | }
115 | ```
116 |
117 | ### Server initialization
118 |
119 | Common initialization problems:
120 |
121 | 1. **Path Issues**
122 | - Incorrect server executable path
123 | - Missing required files
124 | - Permission problems
125 | - Try using an absolute path for `command`
126 |
127 | 2. **Configuration Errors**
128 | - Invalid JSON syntax
129 | - Missing required fields
130 | - Type mismatches
131 |
132 | 3. **Environment Problems**
133 | - Missing environment variables
134 | - Incorrect variable values
135 | - Permission restrictions
136 |
137 | ### Connection problems
138 |
139 | When servers fail to connect:
140 |
141 | 1. Check Claude Desktop logs
142 | 2. Verify server process is running
143 | 3. Test standalone with [Inspector](/docs/tools/inspector)
144 | 4. Verify protocol compatibility
145 |
146 | ## Implementing logging
147 |
148 | ### Server-side logging
149 |
150 | When building a server that uses the local stdio [transport](/docs/concepts/transports), all messages logged to stderr (standard error) will be captured by the host application (e.g., Claude Desktop) automatically.
151 |
152 |
153 | Local MCP servers should not log messages to stdout (standard out), as this will interfere with protocol operation.
154 |
155 |
156 | For all [transports](/docs/concepts/transports), you can also provide logging to the client by sending a log message notification:
157 |
158 |
159 |
160 | ```python
161 | server.request_context.session.send_log_message(
162 | level="info",
163 | data="Server started successfully",
164 | )
165 | ```
166 |
167 |
168 | ```typescript
169 | server.sendLoggingMessage({
170 | level: "info",
171 | data: "Server started successfully",
172 | });
173 | ```
174 |
175 |
176 |
177 | Important events to log:
178 | - Initialization steps
179 | - Resource access
180 | - Tool execution
181 | - Error conditions
182 | - Performance metrics
183 |
184 | ### Client-side logging
185 |
186 | In client applications:
187 |
188 | 1. Enable debug logging
189 | 2. Monitor network traffic
190 | 3. Track message exchanges
191 | 4. Record error states
192 |
193 | ## Debugging workflow
194 |
195 | ### Development cycle
196 |
197 | 1. Initial Development
198 | - Use [Inspector](/docs/tools/inspector) for basic testing
199 | - Implement core functionality
200 | - Add logging points
201 |
202 | 2. Integration Testing
203 | - Test in Claude Desktop
204 | - Monitor logs
205 | - Check error handling
206 |
207 | ### Testing changes
208 |
209 | To test changes efficiently:
210 |
211 | - **Configuration changes**: Restart Claude Desktop
212 | - **Server code changes**: Use Command-R to reload
213 | - **Quick iteration**: Use [Inspector](/docs/tools/inspector) during development
214 |
215 | ## Best practices
216 |
217 | ### Logging strategy
218 |
219 | 1. **Structured Logging**
220 | - Use consistent formats
221 | - Include context
222 | - Add timestamps
223 | - Track request IDs
224 |
225 | 2. **Error Handling**
226 | - Log stack traces
227 | - Include error context
228 | - Track error patterns
229 | - Monitor recovery
230 |
231 | 3. **Performance Tracking**
232 | - Log operation timing
233 | - Monitor resource usage
234 | - Track message sizes
235 | - Measure latency
236 |
237 | ### Security considerations
238 |
239 | When debugging:
240 |
241 | 1. **Sensitive Data**
242 | - Sanitize logs
243 | - Protect credentials
244 | - Mask personal information
245 |
246 | 2. **Access Control**
247 | - Verify permissions
248 | - Check authentication
249 | - Monitor access patterns
250 |
251 | ## Getting help
252 |
253 | When encountering issues:
254 |
255 | 1. **First Steps**
256 | - Check server logs
257 | - Test with [Inspector](/docs/tools/inspector)
258 | - Review configuration
259 | - Verify environment
260 |
261 | 2. **Support Channels**
262 | - GitHub issues
263 | - GitHub discussions
264 |
265 | 3. **Providing Information**
266 | - Log excerpts
267 | - Configuration files
268 | - Steps to reproduce
269 | - Environment details
270 |
271 | ## Next steps
272 |
273 |
274 |
279 | Learn to use the MCP Inspector
280 |
281 |
282 |
--------------------------------------------------------------------------------
/docs/concepts/resources.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Resources"
3 | description: "Expose data and content from your servers to LLMs"
4 | ---
5 |
6 | Resources are a core primitive in the Model Context Protocol (MCP) that allow servers to expose data and content that can be read by clients and used as context for LLM interactions.
7 |
8 |
9 | Resources are designed to be **application-controlled**, meaning that the client application can decide how and when they should be used.
10 | Different MCP clients may handle resources differently. For example:
11 | - Claude Desktop currently requires users to explicitly select resources before they can be used
12 | - Other clients might automatically select resources based on heuristics
13 | - Some implementations may even allow the AI model itself to determine which resources to use
14 |
15 | Server authors should be prepared to handle any of these interaction patterns when implementing resource support. In order to expose data to models automatically, server authors should use a **model-controlled** primitive such as [Tools](./tools).
16 |
17 |
18 | ## Overview
19 |
20 | Resources represent any kind of data that an MCP server wants to make available to clients. This can include:
21 |
22 | - File contents
23 | - Database records
24 | - API responses
25 | - Live system data
26 | - Screenshots and images
27 | - Log files
28 | - And more
29 |
30 | Each resource is identified by a unique URI and can contain either text or binary data.
31 |
32 | ## Resource URIs
33 |
34 | Resources are identified using URIs that follow this format:
35 |
36 | ```
37 | [protocol]://[host]/[path]
38 | ```
39 |
40 | For example:
41 | - `file:///home/user/documents/report.pdf`
42 | - `postgres://database/customers/schema`
43 | - `screen://localhost/display1`
44 |
45 | The protocol and path structure is defined by the MCP server implementation. Servers can define their own custom URI schemes.
46 |
47 | ## Resource types
48 |
49 | Resources can contain two types of content:
50 |
51 | ### Text resources
52 |
53 | Text resources contain UTF-8 encoded text data. These are suitable for:
54 | - Source code
55 | - Configuration files
56 | - Log files
57 | - JSON/XML data
58 | - Plain text
59 |
60 | ### Binary resources
61 |
62 | Binary resources contain raw binary data encoded in base64. These are suitable for:
63 | - Images
64 | - PDFs
65 | - Audio files
66 | - Video files
67 | - Other non-text formats
68 |
69 | ## Resource discovery
70 |
71 | Clients can discover available resources through two main methods:
72 |
73 | ### Direct resources
74 |
75 | Servers expose a list of concrete resources via the `resources/list` endpoint. Each resource includes:
76 |
77 | ```typescript
78 | {
79 | uri: string; // Unique identifier for the resource
80 | name: string; // Human-readable name
81 | description?: string; // Optional description
82 | mimeType?: string; // Optional MIME type
83 | }
84 | ```
85 |
86 | ### Resource templates
87 |
88 | For dynamic resources, servers can expose [URI templates](https://datatracker.ietf.org/doc/html/rfc6570) that clients can use to construct valid resource URIs:
89 |
90 | ```typescript
91 | {
92 | uriTemplate: string; // URI template following RFC 6570
93 | name: string; // Human-readable name for this type
94 | description?: string; // Optional description
95 | mimeType?: string; // Optional MIME type for all matching resources
96 | }
97 | ```
98 |
99 | ## Reading resources
100 |
101 | To read a resource, clients make a `resources/read` request with the resource URI.
102 |
103 | The server responds with a list of resource contents:
104 |
105 | ```typescript
106 | {
107 | contents: [
108 | {
109 | uri: string; // The URI of the resource
110 | mimeType?: string; // Optional MIME type
111 |
112 | // One of:
113 | text?: string; // For text resources
114 | blob?: string; // For binary resources (base64 encoded)
115 | }
116 | ]
117 | }
118 | ```
119 |
120 |
121 | Servers may return multiple resources in response to one `resources/read` request. This could be used, for example, to return a list of files inside a directory when the directory is read.
122 |
123 |
124 | ## Resource updates
125 |
126 | MCP supports real-time updates for resources through two mechanisms:
127 |
128 | ### List changes
129 |
130 | Servers can notify clients when their list of available resources changes via the `notifications/resources/list_changed` notification.
131 |
132 | ### Content changes
133 |
134 | Clients can subscribe to updates for specific resources:
135 |
136 | 1. Client sends `resources/subscribe` with resource URI
137 | 2. Server sends `notifications/resources/updated` when the resource changes
138 | 3. Client can fetch latest content with `resources/read`
139 | 4. Client can unsubscribe with `resources/unsubscribe`
140 |
141 | ## Example implementation
142 |
143 | Here's a simple example of implementing resource support in an MCP server:
144 |
145 |
146 |
147 | ```typescript
148 | const server = new Server({
149 | name: "example-server",
150 | version: "1.0.0"
151 | }, {
152 | capabilities: {
153 | resources: {}
154 | }
155 | });
156 |
157 | // List available resources
158 | server.setRequestHandler(ListResourcesRequestSchema, async () => {
159 | return {
160 | resources: [
161 | {
162 | uri: "file:///logs/app.log",
163 | name: "Application Logs",
164 | mimeType: "text/plain"
165 | }
166 | ]
167 | };
168 | });
169 |
170 | // Read resource contents
171 | server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
172 | const uri = request.params.uri;
173 |
174 | if (uri === "file:///logs/app.log") {
175 | const logContents = await readLogFile();
176 | return {
177 | contents: [
178 | {
179 | uri,
180 | mimeType: "text/plain",
181 | text: logContents
182 | }
183 | ]
184 | };
185 | }
186 |
187 | throw new Error("Resource not found");
188 | });
189 | ```
190 |
191 |
192 | ```python
193 | app = Server("example-server")
194 |
195 | @app.list_resources()
196 | async def list_resources() -> list[types.Resource]:
197 | return [
198 | types.Resource(
199 | uri="file:///logs/app.log",
200 | name="Application Logs",
201 | mimeType="text/plain"
202 | )
203 | ]
204 |
205 | @app.read_resource()
206 | async def read_resource(uri: AnyUrl) -> str:
207 | if str(uri) == "file:///logs/app.log":
208 | log_contents = await read_log_file()
209 | return log_contents
210 |
211 | raise ValueError("Resource not found")
212 |
213 | # Start server
214 | async with stdio_server() as streams:
215 | await app.run(
216 | streams[0],
217 | streams[1],
218 | app.create_initialization_options()
219 | )
220 | ```
221 |
222 |
223 |
224 | ## Best practices
225 |
226 | When implementing resource support:
227 |
228 | 1. Use clear, descriptive resource names and URIs
229 | 2. Include helpful descriptions to guide LLM understanding
230 | 3. Set appropriate MIME types when known
231 | 4. Implement resource templates for dynamic content
232 | 5. Use subscriptions for frequently changing resources
233 | 6. Handle errors gracefully with clear error messages
234 | 7. Consider pagination for large resource lists
235 | 8. Cache resource contents when appropriate
236 | 9. Validate URIs before processing
237 | 10. Document your custom URI schemes
238 |
239 | ## Security considerations
240 |
241 | When exposing resources:
242 |
243 | - Validate all resource URIs
244 | - Implement appropriate access controls
245 | - Sanitize file paths to prevent directory traversal
246 | - Be cautious with binary data handling
247 | - Consider rate limiting for resource reads
248 | - Audit resource access
249 | - Encrypt sensitive data in transit
250 | - Validate MIME types
251 | - Implement timeouts for long-running reads
252 | - Handle resource cleanup appropriately
253 |
--------------------------------------------------------------------------------
/images/java/class-diagrams.puml:
--------------------------------------------------------------------------------
1 | @startuml Core Components
2 |
3 | ' Core Interfaces
4 | interface McpTransport {
5 | +Mono connect(Function, Mono> handler)
6 | +Mono sendMessage(JSONRPCMessage message)
7 | +void close()
8 | +Mono closeGracefully()
9 | + T unmarshalFrom(Object data, TypeReference typeRef)
10 | }
11 |
12 | interface McpSession {
13 | + Mono sendRequest(String method, Object requestParams, TypeReference typeRef)
14 | +Mono sendNotification(String method, Map params)
15 | +Mono closeGracefully()
16 | +void close()
17 | }
18 |
19 | ' Core Implementation Classes
20 | class DefaultMcpSession {
21 | +interface RequestHandler
22 | +interface NotificationHandler
23 | }
24 |
25 | ' Client Classes
26 | class McpClient {
27 | +{static} Builder using(ClientMcpTransport transport)
28 | }
29 |
30 | class McpAsyncClient {
31 | +Mono initialize()
32 | +ServerCapabilities getServerCapabilities()
33 | +Implementation getServerInfo()
34 | +ClientCapabilities getClientCapabilities()
35 | +Implementation getClientInfo()
36 | +void close()
37 | +Mono closeGracefully()
38 | +Mono