MCP Server with Docker
带有 Docker 的 MCP 服务器
该项目演示了如何将模型控制协议 (MCP) 与 OpenAI 的 API 集成,使 OpenAI 能够访问和使用在 Docker 中运行的 MCP 服务器公开的工具。
先决条件
您的系统上安装了 Docker
Git(克隆存储库)
Related MCP server: OpenAI MCP Server
项目结构
server.py:使用工具实现的 MCP 服务器client.py:连接服务器并调用代理的客户端Dockerfile:构建 Docker 镜像的说明requirements.txt:项目的 Python 依赖项
数据流解释
用户查询:用户向系统发送查询(例如,“我们公司的休假政策是什么?”)
OpenAI API :OpenAI 从 MCP 服务器接收查询和可用工具
工具选择:OpenAI 根据查询决定使用哪些工具
MCP Client :客户端接收OpenAI的工具调用请求,并转发给MCP服务器
MCP 服务器:服务器执行请求的工具(例如,检索知识库数据)
响应流:工具结果通过 MCP 客户端流回 OpenAI
最终响应:OpenAI 生成包含工具数据的最终响应
使用 Docker 运行
步骤 1:构建 Docker 镜像
docker build -t mcp-server .步骤 2:运行 Docker 容器
docker run -p 8050:8050 mcp-server这将在 Docker 容器内启动 MCP 服务器并将其公开在端口 8050 上。
运行客户端
一旦服务器运行,您就可以在单独的终端中运行客户端:
python client.py客户端将连接到服务器,列出可用的工具,并呼叫代理来回答查询。
故障排除
如果遇到连接问题:
检查服务器是否正在运行:使用
docker ps确保 Docker 容器正在运行。验证端口映射:使用
docker ps或检查docker run命令的输出确保端口正确映射。检查服务器日志:使用
docker logs <container_id>查看服务器日志,看看是否有任何错误。主机绑定:服务器已配置为绑定到
0.0.0.0而不是127.0.0.1,以便从容器外部访问。如果仍然遇到问题,您可能需要检查防火墙设置。网络问题:如果您在远程计算机上运行 Docker,请确保可以从客户端计算机访问该端口。
笔记
该服务器配置为使用 SSE(服务器发送事件)传输并监听端口 8050。
客户端通过
http://localhost:8050/sse连接到服务器。启动客户端之前请确保服务器正在运行。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP server for AI dialogue using various LLM models via AceDataCloud
An MCP server that integrates with Discord to provide AI-powered features.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceA simple MCP server for interacting with OpenAI assistants. This server allows other tools (like Claude Desktop) to create and interact with OpenAI assistants through the Model Context Protocol.939MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server implementation that enables connection between OpenAI APIs and MCP clients for coding assistance with features like CLI interaction, web API integration, and tool-based architecture.35-
- AlicenseNot gradedqualityDmaintenanceA server that integrates the MCP library with OpenAI's API, allowing users to interact with various tools, such as the weather tool, through natural language queries.MIT
- FlicenseNot gradedqualityDmaintenanceAn auto-generated MCP server that enables interaction with the OpenAI API, allowing users to access OpenAI's models and capabilities through the Multi-Agent Conversation Protocol.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/TomasRodriguez2002/MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server