MCP服务器

MCP Demo是一个基本的MCP服务器实现,为连接的大型语言模型提供数据和操作接口。

  • by PawNzZi
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 pawnzzi/aidaily

使用说明

MCP演示

这是一个基本的MCP服务器实现,它公开了数据和操作,供连接的大型语言模型使用。

ChatGPT的示例用法

启动服务器后,向ChatGPT提供以下说明

- You are connected to a remote tool MCP Demo. 
- I will describe the usage of functions it contains, the schemas for each function's arguments, and the expected return format.

1. resources/list: Get a list of available resources. Takes no arguments, returns an array of resources with URIs and MIME types

2. tools/list: Get a list of available tools. Takes no arguments, returns an array of tool names

3. tools/call : Use a tool. Required parameters: 'name': The string name of the tool you want to use, 'params': A dictionary representing the tool's arguments

4. prompts/get: Retrieve a prompt. Required parameter: 'name': The string name of the prompt you want to retrieve, returns a string of the prompt text

Thank you, and welcome to MCP Demo

开始使用

通过Smithery安装

通过以下方式自动安装Claude Desktop的MCP演示 史密瑟里:

npx -y @smithery/cli install @PawNzZi/aidaily --client claude

资源

MCP演示包括可以查询的示例资源:

resources = [
  {"name": "Hello World", "uri": "text://hello-world", "mimeType": "text/plain"},
  {"name": "Introduction to Large Language Models", "uri": "text://introduction-to-llms", "mimeType": "text/plain"}
]

A line from A Introduction to Large Language Models

1. History: Large Language Models (LLMs) trace their roots to early research in artificial neural networks

返回的JSON编码响应 tools/list 调用应该看起来像:

{"jsonrpc":"2.0","id":1,"result":[{"name":"Example Tool","input":"Prompt","output":"Reply"}]}

目前只有一小部分行动和数据可用,但我们计划在未来用更令人兴奋的功能来扩展它!

安装

确保系统上安装了python,然后执行以下操作:

git clone THIS_REPOSITORY

pip install . 

使用以下命令设置.env API_KEY="YOUR_KEY"

跑

使用以下命令运行服务器

python3 -m mcp_server

服务器监听端口8080