样本 S3 模型上下文协议服务器
概览
什么是示例 MCP 服务器 S3?
示例 MCP 服务器 S3 是一个托管在 GitHub 上的公共代码库,隶属于组织 aws-samples。该项目展示了如何实现一个与 Amazon S3(简单存储服务)交互的服务器,展示最佳实践,并为希望将 S3 集成到其应用程序中的开发人员提供示例代码。该代码库包含各种资源,包括代码片段、文档和示例,帮助用户理解如何有效地使用 S3 进行存储解决方案。
示例 MCP 服务器 S3 的特点
- 与 Amazon S3 的集成:该项目提供了一种无缝连接和与 S3 交互的方式,使用户能够轻松上传、下载和管理文件。
- 公开访问:作为一个公共代码库,它允许开发人员访问代码、贡献和学习提供的示例。
- 文档:包含全面的文档,以指导用户进行服务器的设置和使用。
- 社区支持:作为 AWS 示例的一部分,它受益于社区的贡献和反馈,增强了其功能和可用性。
- 开源:该项目是开源的,允许开发人员修改和调整代码以满足其特定需求。
如何使用示例 MCP 服务器 S3
-
克隆代码库:首先使用以下命令将代码库克隆到本地计算机:
git clone https://github.com/aws-samples/sample-mcp-server-s3.git
-
设置 AWS 凭证:确保您已配置 AWS 凭证。这可以通过设置 AWS CLI 或在应用程序配置中提供凭证来完成。
-
安装依赖项:导航到项目目录并安装所需的依赖项。通常需要运行:
npm install
-
运行服务器:使用以下命令启动服务器:
npm start
-
访问应用程序:一旦服务器运行,您可以通过网页浏览器或 API 客户端访问应用程序,与 S3 进行交互。
-
探索代码:查看提供的示例和文档,以了解如何实现各种功能和特性。
常见问题解答
什么是 Amazon S3?
Amazon S3(简单存储服务)是 AWS 提供的可扩展对象存储服务,允许用户从网络上的任何地方存储和检索任意数量的数据。它广泛用于备份、归档和 Web 应用程序的数据存储。
示例 MCP 服务器 S3 是免费使用的吗?
是的,示例 MCP 服务器 S3 是一个开源项目,免费使用。不过,根据您的使用情况,您可能会产生与使用 AWS 服务(如 S3)相关的费用。
我可以为示例 MCP 服务器 S3 贡献吗?
当然可以!欢迎贡献。您可以分叉代码库,进行更改,并提交拉取请求以供审核。
我在哪里可以找到有关 AWS S3 的更多信息?
您可以在 官方 AWS 文档 上找到有关 AWS S3 的更多信息。这包括详细的指南、API 参考和有效使用 S3 的最佳实践。
详情
Sample S3 Model Context Protocol Server
An MCP server implementation for retrieving data such as PDF's from S3.
Features
Resources
Expose AWS S3 Data through Resources. (think of these sort of like GET endpoints; they are used to load information into the LLM's context). Currently only PDF documents supported and limited to 1000 objects.
Tools
- ListBuckets
- Returns a list of all buckets owned by the authenticated sender of the request
- ListObjectsV2
- Returns some or all (up to 1,000) of the objects in a bucket with each request
- GetObject
- Retrieves an object from Amazon S3. In the GetObject request, specify the full key name for the object. General purpose buckets - Both the virtual-hosted-style requests and the path-style requests are supported
Configuration
Setting up AWS Credentials
- Obtain AWS access key ID, secret access key, and region from the AWS Management Console and configure credentials files using Default profile as shown here
- Ensure these credentials have appropriate permission READ/WRITE permissions for S3.
Usage with Claude Desktop
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"s3-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/Users/user/generative_ai/model_context_protocol/s3-mcp-server",
"run",
"s3-mcp-server"
]
}
}
}
</details>
<details>
<summary>Published Servers Configuration</summary>
{
"mcpServers": {
"s3-mcp-server": {
"command": "uvx",
"args": [
"s3-mcp-server"
]
}
}
}
</details>
Development
Building and Publishing
To prepare the package for distribution:
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/
directory.
- Publish to PyPI:
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--token
orUV_PUBLISH_TOKEN
- Or username/password:
--username
/UV_PUBLISH_USERNAME
and--password
/UV_PUBLISH_PASSWORD
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm
with this command:
npx @modelcontextprotocol/inspector uv --directory /Users/user/generative_ai/model_context_protocol/s3-mcp-server run s3-mcp-server
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
Security
See CONTRIBUTING for more information.
License
This library is licensed under the MIT-0 License. See the LICENSE file.
Server配置
{
"mcpServers": {
"sample-mcp-server-s-3": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--aws-samples--sample-mcp-server-s3--sample-mcp-server-s-3",
"s3-mcp-server"
],
"env": {}
}
}
}