llm-mcp-server-template
About
llm-mcp-server-template is a template project for developing LLM-MCP (Model Context Protocol) servers. It demonstrates a simple number comparison server and provides example clients that illustrate how various models and invocation methods can interact with MCP servers. It is…
Details
- Author
- coderzzy
- GitHub stars
- 1
- Downloads
- 186
- Categories
- AI
Jump to
- Implements a number‑comparison MCP server (stdin/stdout transport)
- Includes a working OpenAI client that calls the MCP tool
- Supports inspection with the official mcp-server-inspector
- Provides a clear template for local development and debugging
- Demonstrates the two‑round MCP workflow (tool call + final response)
- Easily extensible to remote transport (SSE) or other hosting platforms
1. Install uv (package manager) and Python 3.10.
2. In the server directory, create a virtual environment and install mcp[cli] and httpx.
3. Use mcp dev math.py to run the server in development mode (supports inspection via mcp-server-inspector).
4. In the client directory, install openai, openai-agents, and socksio, set OPENAI_API_KEY in .env, then run python openai_client.py.
llm-mcp-server-template
LLM-MCP server 开发的模版项目 - server为数字比大小能力 - client为各模型、各种调用方式MCP
- https://modelcontextprotocol.io/introduction - 简单理解, - 模型(client)是大脑,负责规划和执行文本类任务,如第一步写代码,第二步执行,第三步分析。 - MCP(Server)是工具,负责提供模型需要的其他能力,如数学计算、文件读写、网络请求等。 ### MCP-Server - 主要负责实现mcp能力,如数学计算、文件读写、网络请求等 - https://modelcontextprotocol.io/quickstart/server - 开发过程中,可以使用 mcp-server-inspector 工具协助调试 - 几种类型的server: - 1、本地Stdio,client直接调用本地的server文件(python or nodejs) - plus: 把node项目推远程npm仓库,npx运行,实现半远程调用的效果 - 2、远程聚合平台SSE,如Glama.ai、MCP.so等### MCP-Client
- 主要负责协调模型和mcp-server,最终实现"模型调用了mcp能力"
- 几种类型的client:
- 1、直接用现成的客户端软件,如Cursor、MCP Inspector等。
- 2、云平台上的各种智能体agent,如阿里云百炼应用管理。
- 3、自己写脚本支持
- 3.1、模型的sdk已经支持了mcp,使用脚本方便的进行调用
- 如claude,https://modelcontextprotocol.io/quickstart/client
- 如openai,https://openai.github.io/openai-agents-python/mcp/
- 3.2、模型的sdk没有支持mcp,需要自己实现
- 3.2.1、使用框架,如langchain-mcp-adapter(https://github.com/langchain-ai/langchain-mcp-adapters)
- 3.2.2、完全原生,具体包括多轮请求:
- a、使用 prompt 请求模型,告知模型任务和 mcp servers 的介绍,模型返回调用server的接口和参数
- b、使用上一轮返回的信息,请求tools,获取结果
- c、使用上一轮返回的信息,请求模型,获取结果
- d、重复b、c,直到模型返回最终结果
项目相关
环境准备
```Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.
