Token导航 LogoToken导航TokenDH.com
Basic MCP Agent logo
AI代理stdio官方级别未说明来源级核验

Basic MCP Agent

MCP Server

一个展示如何构建MCP服务器并通过PayLink基础设施连接到AI代理的简单示例。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
AI代理PythonAPI密钥

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

payelink

提供方

payelink

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run main.py

详细介绍

集成PayLink的基本MCP服务器

一个简单的例子演示如何构建 MCP(模型上下文协议)服务器 并使用PayLink基础设施将其连接到AI代理。

概述

该项目展示了以下内容之间的整合:

  • MCP服务器 -AI模型可以使用的工具
  • PayLink -用于将MCP服务器连接到代理的基础架构
  • AI智能体 -使用MCP工具的LangChain/LangGraph代理

此示例演示了基本的MCP服务器设置:

  1. MCP服务器 通过HTTP公开工具(加、减)
  2. AI 代理 使用连接到MCP服务器 PayLinkTools
  3. PayLink 提供代理和服务器之间的连接基础架构
  4. 工具执行 并将结果返回给代理

项目结构

basic-mcp+agent/
├── README.md                    # This file
├── example_mcp_server/          # The MCP server
│   ├── main.py                  # Server implementation
│   ├── pyproject.toml           # Dependencies
│   ├── .env.example             # Environment variable template
│   └── README.md
└── agent/                       # The AI agent consumer
    ├── src/
    │   └── graph.py             # LangGraph agent definition
    ├── notebooks/
    │   └── use_monitized_mcp.ipynb  # Interactive example
    ├── langgraph.json           # LangGraph configuration
    ├── pyproject.toml           # Dependencies
    ├── .env.example             # Environment variable template
    └── README.md

快速开始

先决条件

  • Python 3.13+
  • 紫外线 -快速Python包管理器
  • OpenAI API密钥 -对于AI代理

步骤1:启动MCP服务器

# Create and activate virtual environment
uv venv
source .venv/bin/activate

# Install dependencies
uv sync

# Run the server
uv run main.py

服务器将在以下时间启动 http://0.0.0.0:5003/mcp

步骤2:配置AI代理

打开一个新终端:

# Navigate to the agent directory
cd agent

# Copy the environment template
cp .env.example .env

# Edit .env and replace the values with your custom values:
# - WALLET_CONNECTION_STRING (generate on PayLink platform)
# - OPENAI_API_KEY (your OpenAI API key)

步骤3:运行AI代理

# Create and activate virtual environment
uv venv
source .venv/bin/activate

# Install dependencies
uv sync

# Run the LangGraph development server
langgraph dev

代理人将在 http://127.0.0.1:2024 使用Studio UI。

示例流程

User: "What is 15 plus 27?"

1. Agent receives the query
2. LLM decides to use the "add" tool
3. PayLinkTools sends request to MCP server
   - Includes wallet credentials in headers
4. MCP server receives the request
5. Tool executes: 15 + 27 = 42
6. Result returned to agent
7. Agent responds: "15 plus 27 equals 42"

定制

添加新工具

  1. 在中添加工具定义 list_tools()
  2. 在中实现工具逻辑 call_tool()
@app.list_tools()
async def list_tools() -> list[types.Tool]:
    return [
        # ... existing tools
        types.Tool(
            name="multiply",
            description="Multiply two integers",
            inputSchema={
                "type": "object",
                "properties": {
                    "a": {"type": "number"},
                    "b": {"type": "number"},
                },
                "required": ["a", "b"],
            },
        ),
    ]

@app.call_tool()
async def call_tool(tool_name: str, arguments: dict[str, Any]) -> list[TextContent]:
    # ... existing logic
    elif tool_name == "multiply":
        result = arguments["a"] * arguments["b"]
        return [types.TextContent(type="text", text=str(result))]

资源

许可证

此示例作为PayLink SDK的一部分提供用于教育目的。

目录标签

目录标签

AI代理PythonAPI密钥MCP服务器本地部署PayLink集成HTTP工具

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP