使用说明
脉冲星
社区建设 模型上下文协议(MCP)服务器 这使AI编码助手能够实时访问Stellar网络和Soroban智能合约。
目录
- 概述
- 脉冲星为何存在
- 特性
- 建筑
- 先决条件
- 安装
- 配置
- 连接到AI助手
- 工具参考
- get_count_balance
- get_count_balances
- 搜索资产
- fetch_concontract_spec
- 模拟交易
- get_contract_storage
- decode_ledger_entry
- 提交交易
- 构建交易
- 索罗班·马思
- 计算投资时间表
- 部署合同
- 签名_带边框
- inspectxdr
- export_ai_schemas
- get_price_feed
- 计算_拍卖_价格
- 计算_执行_状态
- safe_math_计算机
- track_ledger_sensus_time
- get_network_params
- 优化合同字节码
- 获取协议版本
- 阿姆
- get_token_transfer_fee
- 提示和工作流示例
- Soroban CLI集成
- 开发指南
- 监控
- 安全注意事项
- 路线图
- 贡献
- 相关项目
- 许可证
概述
脉冲星 是一个社区 模型上下文协议 该服务器将人工智能编码助手——Cursor、Claude Desktop、Windsurf和任何其他MCP兼容客户端——直接连接到Stellar网络和Soroban智能合约平台。
您可以询问您的AI助手,而不是将原始JSON粘贴到提示中或从块资源管理器复制余额:
“XLM余额是多少
GBBD...?"
“模拟提交此Soroban交易,并告诉我它的回报。”
“获取合同的ABI规范CA3D...并为我编写一个TypeScript客户端。”
pulser代表您处理所有低级RPC调用、XDR编码/解码和Soroban CLI调用,返回AI可以立即推理的干净、结构化的数据。
脉冲星为何存在
恒星开发者基金会正在建设 斯特拉 --一个无头AI助手,可以回答Stellar的问题,并帮助跨平台的构建者。这是一个伟大的倡议。但它是一个由SDF维护的集中式工具。
目前有 没有社区驱动的MCP服务器 对于Stellar,这意味着:
- 如果没有每个项目的自定义函数调用设置,人工智能助手就无法查询实时账户余额。
- 模拟Soroban事务需要复制粘贴XDR blob并手动运行CLI命令。
- 获取和解释合约ABI规范(Soroban合约接口)需要开发人员手动解码。
- 新恒星构建者的人工智能辅助入职涉及将人工智能指向文档,而不是让它直接反思链。
脉冲星填补了这一空白。 这是社区的答案:一个开放的、可自托管的MCP服务器,任何开发人员都可以在两分钟内与他们的编辑器一起运行。
特性
| 能力 | 详细信息 |
|---|---|
| 账户余额 | 查询一个账户的XLM和已发放资产余额,或在一次调用中批量提取多达25个账户 |
| 合同规格获取 | 检索任何已部署的Soroban合约的完整ABI/接口规范 |
| 交易模拟 | 模拟Soroban交易,在支出费用之前检查资源使用情况和回报值 |
| 分类账条目解码 | 将原始XDR分类账条目解码为人类可读的JSON |
| 交易提交 | 签名(通过提供的密钥或外部签名者)并将交易提交到网络 |
| 合同部署 | 通过内置部署器或工厂合约部署Soroban智能合约 |
| 行权进度计算 | 计算团队、投资者和顾问的代币归属/时间锁释放时间表 |
| 多网络 | 目标主网、测试网、Futurenet或自定义RPC端点 |
| Soroban CLI后端 | 将复杂的操作委托给官员 stellar / soroban CLI实现最大正确性 |
| 结构化输出 | 所有工具响应都是类型化的JSON对象,AI可以直接解析和处理 |
| 零依赖传输 | 使用标准MCP stdio传输——不需要额外的HTTP服务器 |
| 能力 | 详细信息 |
| -------------------------------- | ----------------------------------------------------------------------------------------------- |
| 账户余额 | 查询主网或测试网上任何账户的XLM和任何已发行资产余额 |
| 合同规格获取 | 检索任何已部署的Soroban合约的完整ABI/接口规范 |
| 交易模拟 | 模拟Soroban交易,在支出费用之前检查资源使用情况和回报值 |
| 分类账条目解码 | 将原始XDR分类账条目解码为人类可读的JSON |
| 交易提交 | 签名(通过提供的密钥或外部签名者)并将交易提交到网络 |
| 合同部署 | 通过内置部署器或工厂合约部署Soroban智能合约 |
| 行权进度计算 | 计算团队、投资者和顾问的代币归属/时间锁释放时间表 |
| 网络参数 | 获取Soroban网络资源权重、费用阈值和通货膨胀参数 |
| 多网络 | 目标主网、测试网、Futurenet或自定义RPC端点 |
| Soroban CLI后端 | 将复杂的操作委托给官员 stellar / soroban CLI实现最大正确性 |
| 结构化输出 | 所有工具响应都是类型化的JSON对象,AI可以直接解析和处理 |
| 零依赖传输 | 使用标准MCP stdio传输——不需要额外的HTTP服务器 |
| 能力 | 详细信息 |
| --- | --- |
| 账户余额 | 查询主网或测试网上任何账户的XLM和任何已发行资产余额 |
| 流动性池查询 | 从Horizon获取AMM池储备、份额和费用设置 |
| 网络费用统计 | 检索最近的费用百分比和推荐的交易费用 |
| 资产发现 | 通过Stellar Expert/Horizon按代码、发行人或声誉评分搜索Stellar资产 |
| 合同规格获取 | 检索任何已部署的Soroban合约的完整ABI/接口规范 |
| 交易模拟 | 模拟Soroban交易,在支出费用之前检查资源使用情况和回报值 |
| 分类账条目解码 | 将原始XDR分类账条目解码为人类可读的JSON |
| 交易提交 | 签名(通过提供的密钥或外部签名者)并将交易提交到网络 |
| 事务构建助手 | 在没有原始XDR知识的情况下构建常见的Stellar交易(支付、信任线、管理数据等) |
| 索罗班数学 | 不动点算术、统计函数(均值、标准差、TWAP)和金融数学(复利、基点)与索罗班的7位十进制整数模型兼容 |
| 合同部署 | 通过内置部署器或工厂合约部署Soroban智能合约 |
| 硬件钱包签名 | 使用物理分类账设备安全地签署交易 |
| XDR检查 | 在模拟之前,预先验证XDR blob的安全风险和危险信号 |
| 桥梁事件观察 | 观察跨链桥接合约发出的Soroban合约事件,并按合约、类型或主题进行筛选 |
| 价格馈送查询 | 查询去中心化的oracle合约以获取实时资产价格 |
| 协议版本信息 | 跨不同网络跟踪网络升级和功能可用性 |
| 行权进度计算 | 计算团队、投资者和顾问的代币归属/时间锁释放时间表 |
| AI模式导出 | 以JSON、Markdown或OpenAPI格式导出所有工具定义,用于AI培训和文档 |
| 拍卖定价 | 计算荷兰和英国拍卖的当前价格和出价要求 |
| 安全数学实用程序 | 对BigInt和Soroban类型执行溢出/下溢保护算法 |
| 分类账共识跟踪 | 对最近的分类账进行采样,并报告分类账间关闭时间的平均值、最小值、最大值和标准偏差 |
| 自动做市商(AMM) | 与固定产品(x*y=k)AMM池交互:交换代币、添加/删除流动性、获取报价 |
| 转移检测费 | 模拟转账以检测隐藏费用或明确的转账费用逻辑 |
| 多网络 | 目标主网、测试网、Futurenet或自定义RPC端点 |
| 基于延迟的RPC路由 | 配置多个时,自动将Soroban RPC调用路由到最快的健康端点 |
| Soroban CLI后端 | 将复杂的操作委托给官员 stellar / soroban CLI实现最大正确性 |
| 结构化输出 | 所有工具响应都是类型化的JSON对象,AI可以直接解析和处理 |
| 零依赖传输 | 使用标准MCP stdio传输——不需要额外的HTTP服务器 |
建筑
┌─────────────────────────────────────┐
│ AI Coding Assistant │
│ (Cursor / Claude Desktop / Windsurf│)
└────────────────┬────────────────────┘
│ MCP (stdio / SSE)
▼
┌─────────────────────────────────────┐
│ pulsar │
│ ┌──────────┐ ┌──────────────────┐ │
│ │Tool Layer│ │ Schema / Types │ │
│ └────┬─────┘ └──────────────────┘ │
│ │ │
│ ┌────▼──────────────────────────┐ │
│ │ Service Layer │ │
│ │ Horizon Client │ RPC Client│ │
│ │ Soroban CLI │ XDR Codec │ │
│ └────┬─────────────────────┬────┘ │
└───────┼─────────────────────┼───────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────────┐
│ Stellar │ │ Soroban RPC │
│ Horizon API │ │ (Mainnet / │
│ (REST) │ │ Testnet / etc) │
└──────────────┘ └──────────────────┘
关键设计选择:
- stdio传输 --服务器通过stdin/stdout进行通信,这意味着任何MCP主机都可以将其作为子进程生成,而不需要端口或防火墙规则。
- Soroban CLI作为后端 --服务器没有从头开始重新实现XDR序列化,而是向官方
stellarCLI用于需要它的操作,确保字节级正确性。 - 地平线+索罗班RPC --账户数据从Horizon(REST层)获取,而合约交互通过Soroban JSON-RPC端点。
- Zod模式 --每个工具输入和输出都经过验证 佐德 在运行时,防止格式错误的数据到达网络。
- 中央产出合同 --工具输出在共享调度程序路径中进行验证(
TOOL_OUTPUT_SCHEMAS)在返回给MCP客户端之前,确保所有工具之间的合同一致性。
先决条件
开始之前,请确保您的计算机上安装了以下内容:
必需
| 依赖关系 | 版本 | 安装 |
|---|---|---|
| Node.js | ≥ 18 | nodejs.org |
| npm | ≥9 | 与Node.js捆绑 |
Stellar CLI (stellar) |
≥21 | 见下文 |
安装Stellar CLI
Stellar CLI(包括 soroban 命令)是SDF维护的官方工具。
macOS/Linux(通过Homebrew):
brew install stellar-cli
macOS/Linux(通过货运):
cargo install --locked stellar-cli --features opt
验证安装:
stellar --version
# stellar 21.x.x
注: 如果你只打算使用
get_account_balance和fetch_contract_spec,Stellar CLI是可选的。这是必需的simulate_transaction和submit_transaction.
可选的
| 依赖性 | 目的 |
|---|---|
| jq | 在shell示例中打印JSON很漂亮 |
| 铁锈+货物 | 仅当从源代码构建Stellar CLI时才需要 |
安装
来源(TypeScript)
# 1. Clone the repository
git clone https://github.com/your-org/pulsar.git
cd pulsar
# 2. Install dependencies
npm install
# 3. Build the project
npm run build
# 4. (Optional) Link globally so any MCP host can find it
npm link
链接后,the pulsar 二进制文件在系统范围内可用:
pulsar --version
NPX(未安装)
发布包后,您可以直接运行服务器,而无需通过npx进行克隆:
npx pulsar
这是编辑器插件配置的推荐方法(请参阅 连接到AI助手).
码头工人
你也可以使用Docker运行脉冲星:
# Pull the image from GitHub Container Registry
docker pull ghcr.io/benelabs/pulsar:latest
# Run with environment variables
docker run --rm -e STELLAR_NETWORK=testnet ghcr.io/benelabs/pulsar:latest
# Run with a custom .env file
docker run --rm --env-file .env ghcr.io/benelabs/pulsar:latest
从源头构建
# Build the Docker image
docker build -t pulsar .
# Run the container
docker run --rm -e STELLAR_NETWORK=testnet pulsar
Docker Compose
对于具有环境变量传递的本地开发:
# Copy the example environment file
cp .env.example .env
# Edit .env with your configuration
# Run with docker-compose
docker-compose up
这 docker-compose.yml 包括:
- 环境变量从传递
.env - 资源限制(512MB内存,最大1个CPU)
- 非root用户执行
- 自动重启策略
配置
环境变量
创建一个 .env 项目根目录中的文件(或在shell/editor配置中设置这些变量):
# ─── Network ────────────────────────────────────────────────────────────────
# Options: mainnet | testnet | futurenet | custom
STELLAR_NETWORK=testnet
# Override the Horizon REST endpoint (optional)
HORIZON_URL=https://horizon-testnet.stellar.org
# Override the Soroban RPC endpoint (optional)
SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
# Comma-separated list of Soroban RPC endpoints for latency-based routing.
# If provided, pulsar will automatically route requests to the fastest healthy endpoint.
# Example: SOROBAN_RPC_URLS=https://rpc1.example.com,https://rpc2.example.com
SOROBAN_RPC_URLS=
# ─── Signing (optional — required only for submit_transaction) ───────────────
# WARNING: Never commit a funded secret key to version control.
# Use a dedicated low-value keypair for development.
STELLAR_SECRET_KEY=SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# ─── Soroban CLI ────────────────────────────────────────────────────────────
# Path to the stellar/soroban CLI binary (auto-detected if on PATH)
STELLAR_CLI_PATH=stellar
# ─── Server ─────────────────────────────────────────────────────────────────
# Log level: error | warn | info | debug | trace
LOG_LEVEL=info
# Tool execution audit log path (defaults to audit.log)
AUDIT_LOG_PATH=audit.log
# ─── Metrics (optional) ──────────────────────────────────────────────────────
# Enable Prometheus metrics export (default: true)
METRICS_ENABLED=true
# Port for metrics HTTP endpoint (default: 9090)
METRICS_PORT=9090
# ─── RPC Routing ─────────────────────────────────────────────────────────────
# Health check interval in milliseconds (default: 30000)
# RPC_HEALTH_CHECK_INTERVAL_MS=30000
# Maximum acceptable latency for an RPC endpoint in milliseconds before marking it unhealthy (default: 2000)
# RPC_LATENCY_THRESHOLD_MS=2000
日志以结构化JSON的形式发送到stderr,以保持MCP stdout的干净。
安全说明:
STELLAR_SECRET_KEY是可选的,仅由以下人员使用submit_transaction。如果未设置,该工具将返回一个未签名的XDR blob,您可以在外部对其进行签名。在开发过程中永远不要使用资金支持的主网密钥——使用通过以下方式资助的一次性测试网密钥对 Friendbot.
网络选择
STELLAR_NETWORK value |
地平线URL | 索罗班RPC URL |
|---|---|---|
mainnet |
https://horizon.stellar.org |
https://soroban-rpc.stellar.org |
testnet |
https://horizon-testnet.stellar.org |
https://soroban-testnet.stellar.org |
futurenet |
https://horizon-futurenet.stellar.org |
https://rpc-futurenet.stellar.org |
custom |
HORIZON_URL env var |
SOROBAN_RPC_URL env var |
使用Prometheus Metrics进行监控
pulser在专用HTTP端点上公开Prometheus指标,用于实时监控和警报。
指标端点
当 METRICS_ENABLED=true (默认),指标可在以下网址获得:
http://localhost:9090/metrics
端点以标准Prometheus文本格式返回指标。
可用指标
工具执行指标:
pulsar_tool_invocations_total(计数器)--按工具名称和状态(成功/错误)列出的工具调用总数pulsar_tool_duration_seconds(直方图)——工具执行持续时间(秒)(每个工具)pulsar_tool_errors_total(计数器)--按工具名称和错误类型统计的工具错误总数pulsar_validation_errors_total(计数器)--每个工具的输入验证错误pulsar_active_tool_invocations(仪表)——当前活动工具调用次数
系统指标:
pulsar_heap_memory_used_bytes(gauge)--当前堆内存使用情况(以字节为单位)pulsar_heap_memory_total_bytes(gauge)--以字节为单位分配的堆内存总量pulsar_process_*(各种)-标准Node.js进程指标(正常运行时间、CPU、文件描述符等)
网络指标:
pulsar_network_requests_total(计数器)--按服务(地平线、soroban-rpc)和状态列出的总网络请求数pulsar_network_duration_seconds(柱状图)——按服务划分的网络请求持续时间
健康检查端点
一个简单的健康检查端点位于:
GET http://localhost:9090/health
退货:
{
"status": "ok",
"uptime": 123.456
}
与普罗米修斯搏斗
配置Prometheus,通过添加到您的 prometheus.yml:
scrape_configs:
- job_name: 'pulsar'
static_configs:
- targets: ['localhost:9090']
scrape_interval: 15s
scrape_timeout: 10s
禁用指标
要禁用指标导出(例如,为了减少开销),请设置:
METRICS_ENABLED=false
HTTP指标端点将不会启动,指标收集将被跳过。
连接到AI助手
脉冲星使用 stdio传输 --服务器由AI助手作为子进程启动,并通过stdin/stdout进行通信。没有端口,没有防火墙更改,没有额外服务。
克劳德桌面版
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)或 %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"pulsar": {
"command": "npx",
"args": ["-y", "pulsar"],
"env": {
"STELLAR_NETWORK": "testnet",
"LOG_LEVEL": "warn"
}
}
}
}
如果从源代码克隆和构建:
{
"mcpServers": {
"pulsar": {
"command": "node",
"args": ["/absolute/path/to/pulsar/dist/index.js"],
"env": {
"STELLAR_NETWORK": "testnet"
}
}
}
}
重新启动克劳德桌面。你应该看到 脉冲星 出现在工具列表中(锤子图标)。
光标
打开光标设置→ 特性 → MCP服务器 → 添加新的MCP服务器.
- 姓名:
pulsar - 类型:
command - 命令:
npx -y pulsar
或者,编辑 .cursor/mcp.json 在项目根目录中进行项目本地配置:
{
"mcpServers": {
"pulsar": {
"command": "npx",
"args": ["-y", "pulsar"],
"env": {
"STELLAR_NETWORK": "testnet"
}
}
}
}
帆板运动
打开Windsurf设置面板→ 主控程序 → 添加服务器:
{
"pulsar": {
"command": "npx",
"args": ["-y", "pulsar"],
"env": {
"STELLAR_NETWORK": "testnet"
}
}
}
任何MCP兼容客户端
脉冲星通过stdio使用标准MCP协议。要连接任何MCP客户端:
# Spawn the server manually to test it
node dist/index.js
# Send a raw list-tools request (for debugging)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/index.js
工具参考
所有工具都接受并返回JSON对象。使用Zod验证输入;无效输入在进行任何网络调用之前返回结构化MCP错误。
get_account_balance
检索恒星账户持有的XLM余额和所有已发行资产余额。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account_id |
string |
是 | 恒星公钥(G...)或联邦地址(name*domain.com) |
asset_code |
string |
否 | 将结果筛选到特定的资产代码,例如。 USDC |
asset_issuer |
string |
否 | 筛选资产的发行人公钥 |
输出:
{
"account_id": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
"sequence": "12345678901",
"subentry_count": 3,
"balances": [
{
"asset_type": "native",
"asset_code": "XLM",
"balance": "9842.1234567",
"buying_liabilities": "0.0000000",
"selling_liabilities": "0.0000000",
},
{
"asset_type": "credit_alphanum4",
"asset_code": "USDC",
"asset_issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
"balance": "250.0000000",
"limit": "922337203685.4775807",
"is_authorized": true,
},
],
"network": "testnet",
}
示例提示:
“检查账户余额
GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5在测试网上。"
get_account_balances
在一次工具调用中获取多个Stellar帐户的余额。服务器以有限的并发限制扇出并发的Horizon请求,并返回每个帐户的成功或失败,而不会丢弃整个批处理。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
account_ids |
string[] |
是 | 一到25个独特的恒星公钥(G...) |
asset_code |
string |
否 | 将每个帐户结果筛选为特定的资产代码,例如。 USDC |
asset_issuer |
string |
否 | 筛选资产的发行人公钥 |
max_concurrency |
number |
否 | 并发Horizon请求的最大数量。范围: 1 到 10默认值: 5 |
network |
string |
否 | 覆盖此呼叫的网络 |
输出:
{
"network": "testnet",
"requested": 3,
"succeeded": 2,
"failed": 1,
"max_concurrency": 3,
"duration_ms": 184,
"results": [
{
"status": "success",
"account_id": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
"balances": [
{
"asset_type": "native",
"balance": "9842.1234567",
},
],
},
{
"status": "error",
"account_id": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHG",
"error_code": "NETWORK_ERROR",
"message": "Account not found - it may not be funded yet",
"details": {
"status": 404,
"account_id": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHG",
},
},
],
}
示例提示:
“一次调用即可获取这些国库账户的XLM余额,并标记任何未备资金的账户:
GBBD47...,GBZX12...,GAAA...."
fetch_contract_spec
get_fee_stats
从Horizon检索最近的网络费用统计数据,以帮助估算最佳交易费用。返回stroops中的最小、最大、平均和百分位(p10-p99)费用值,以及基于中位数(p50)的建议费用。
search_assets
按代码、发行人或最低信誉评分搜索Stellar资产。用途 stellar.expert 如果可用于声誉评分和增强搜索;否则将退回地平线 /assets 终点。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
network |
string |
否 | 覆盖此呼叫的网络(mainnet, testnet, futurenet, custom) |
| --- | --- | --- | --- |
asset_code |
string |
否 | 按资产代码筛选(例如。 USDC) |
asset_issuer |
string |
否 | 按资产发行者公钥筛选(G...) |
min_reputation_score |
number |
否 | 要筛选的最低信誉评分/评级(0-10)。需要 stellar.expert 决心 |
network |
string |
否 | 覆盖此呼叫的配置网络 |
输出:
{
"min_accepted_fee": "100",
"max_accepted_fee": "10000",
"avg_accepted_fee": "5000",
"p_10": "1000",
"p_20": "1500",
"p_30": "2000",
"p_40": "2500",
"p_50": "3000",
"p_60": "3500",
"p_70": "4000",
"p_80": "4500",
"p_90": "5000",
"p_95": "6000",
"p_99": "8000",
"last_ledger": "48234567",
"last_ledger_base_fee": "100",
"ledger_capacity_usage": 0.75,
"recommended_fee_stroops": "3000",
"network": "testnet"
}
recommended_fee_stroops 对于典型交易来说,这是一个合理的费用,在可用的情况下使用中位数(p50),必要时回落到平均值或最低值。
示例提示:
“测试网上目前推荐的交易费用是多少?” “显示主网的费用百分比分布。”
get_liquidity_pool
查询AMM流动性池数据,包括储备、总股份、费用(以基点为单位)和池类型。数据来源于Stellar Horizon API。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
liquidity_pool_id |
string |
是 | 流动性池ID(例如。 POOL_...) |
network |
string |
否 | 覆盖此呼叫的网络(mainnet, testnet, futurenet, custom) |
输出:
{
"liquidity_pool_id": "POOL_ABC123...",
"fee_bp": 30,
"type": "constant_product",
"reserves": [
{ "asset": "XLM", "amount": "1000.1234567" },
{ "asset": "USDC:GA...", "amount": "500.0000000" }
],
"total_shares": "2000.1234567",
"network": "testnet"
}
fee_bp是以基点表示的池费(1个基点=0.01%,因此30个基点=0.3%)。reserves列出合并资产及其金额。total_shares是集合股的总供应量。
示例提示:
“在测试网上获取流动性池pool_XYZ的准备金和费用。” “USDC/XLM池的总份额是多少?” “资产”:[ { “资产代码”:“USDC”, “资产_发行人”:“GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4K4KZVN”, “asset_type”:“credit_alphanum4”, “信誉_核心”:9, “金额”:“2670911892241840”, “域名”:“circle.com” } ] }
**Example prompt:**
> _"Find all USDC assets on mainnet with a reputation score of at least 8."_
---
### `fetch_contract_spec`
Fetch the ABI interface specification of a deployed Soroban smart contract. Returns the full list of functions, their parameter types, and return types — in both raw XDR and decoded JSON form.
**Input:**
| Parameter | Type | Required | Description |
| ------------- | -------- | -------- | ---------------------------------------------------------------------- |
| `contract_id` | `string` | Yes | The Soroban contract address (`C...`) |
| `network` | `string` | No | Override the network for this call (`mainnet`, `testnet`, `futurenet`) |
**Output:**
```jsonc
{
"contract_id": "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE",
"network": "testnet",
"functions": [
{
"name": "transfer",
"doc": "Transfer tokens from one account to another.",
"inputs": [
{ "name": "from", "type": "Address" },
{ "name": "to", "type": "Address" },
{ "name": "amount", "type": "i128" },
{ "name": "amount", "type": "i128" }
],
"outputs": [{ "type": "bool" }],
},
{
"name": "balance",
"inputs": [{ "name": "id", "type": "Address" }],
"outputs": [{ "type": "i128" }],
},
],
"events": [
{
"name": "transfer",
"topics": [{ "type": "Symbol" }, { "type": "Address" }, { "type": "Address" }],
"data": { "type": "i128" },
},
],
"raw_xdr": "AAAAAgAAAA...",
}
示例提示:
“获取合同规范
CA3D...并为我编写一个TypeScript SDK客户端,调用其transfer功能。"
observe_bridge_events
查询Soroban合同事件,了解跨链桥梁观测工作流程。此工具返回解码的事件主题和值,以及用于恢复事件扫描的分页字段。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
contract_id |
string |
是 | 索罗班合同地址(C...)观察事件 |
event_type |
string |
否 | 可选事件类型筛选器(contract, system, diagnostic) |
topic_filters |
string[][] |
否 | 使用base64主题值和通配符模式的可选嵌套主题过滤器 |
start_ledger |
number |
否 | 开始扫描事件的可选分类账顺序 |
cursor |
string |
否 | 用于恢复事件检索的可选分页令牌 |
limit |
number |
否 | 可选返回的最大事件数 |
network |
string |
否 | 覆盖此呼叫的网络 |
输出:
{
"network": "testnet",
"latest_ledger": 123456,
"events": [
{
"id": "event-1",
"type": "contract",
"ledger": 123456,
"ledger_closed_at": "2026-01-01T00:00:00Z",
"paging_token": "123456-1",
"in_successful_contract_call": true,
"tx_hash": "abcdef123456",
"contract_id": "CA...",
"topic_raw": ["AAAA..."],
"topic_native": ["bridge_event"],
"value_raw": "AAAA...",
"value_native": 42
}
]
}
示例提示:
“观察合同中的桥梁事件排放
CA...从账本1000000开始。”
simulate_transaction
在不广播的情况下对网络进行Soroban交易的模拟运行。返回模拟结果、资源占用(CPU、内存、账本读/写)和费用估算。这相当于打电话 stellar contract invoke --dry-run 或 simulateTransaction Soroban RPC方法。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
xdr |
string |
是 | 要模拟的base64编码事务信封XDR |
network |
string |
否 | 覆盖此呼叫的网络 |
输出:
{
"status": "success",
"return_value": {
"type": "i128",
"value": "1000000000",
},
"cost": {
"cpu_instructions": 512340,
"memory_bytes": 98304,
},
"footprint": {
"read_only": ["ledger_key_1_xdr", "ledger_key_2_xdr"],
"read_write": ["ledger_key_3_xdr"],
},
"min_resource_fee": "12345",
"events": [],
"error": null,
}
如果模拟失败(例如合同恐慌、余额不足) status 是 "error" 和那个 error 字段包含来自合同的诊断消息。
示例提示:
“模拟此交易XDR,并告诉我它是否会成功以及成本是多少。”
simulate_transactions_sequence
针对网络依次模拟Soroban交易序列。在XDR数组上迭代,并返回每笔交易的详细结果、错误、足迹和费用估计数组。
get_contract_storage
按耐久性和密钥获取Soroban合约存储条目。返回原始分类账条目XDR和TTL元数据(如果可用)。使用 decode_ledger_entry 以检查解码字段。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
xdrs |
array of strings |
是 | 一个base64编码的事务信封XDR数组,用于顺序模拟 |
network |
string |
否 | 覆盖此序列的网络 |
输出:
返回模拟输出数组。每个元素都遵循相同的结构 simulate_transaction 上面,包括a status 现场("SUCCESS", "ERROR",或 "RESTORE_NEEDED").
示例提示:
“按顺序模拟此交易XDR序列,并列出其成本和任何错误。” |
contract_id|string|是|索罗班合同地址(C...) | |storage_type|string|是的|instance,persistent,或temporary| |key|object|否|用于持久/临时存储的键入SCVal密钥,例如。{ type: "symbol", value: "Balance" }| |network|string|否|覆盖此呼叫的网络|
输出:
{
"contract_id": "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE",
"storage_type": "persistent",
"key": { "type": "symbol", "value": "Balance" },
"network": "testnet",
"entries": [
{
"key_xdr": "AAAAAgAAAA...",
"entry_xdr": "AAAABgAAAAEA...",
"last_modified_ledger": 48123456,
"live_until_ledger": 48199999
}
]
}
示例提示:
“获取密钥的持久存储条目
Balance按合同CA3D...并对其进行解码。”
decode_ledger_entry
将原始base64编码的XDR分类账条目解码为人类可读的JSON结构。可用于检查Soroban合约的持久存储槽,或调试链上实际存储的内容。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
xdr |
string |
是 | 分类账条目的base64编码XDR(键或值) |
entry_type |
string |
否 | 解码提示: account, trustline, contract_data, contract_code, offer, data |
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
xdr |
string |
是 | 分类账条目的base64编码XDR(键或值) |
entry_type |
string |
否 | 解码提示: account, trustline, contract_data, contract_code, offer, data (可选,有助于解决模糊的XDR) |
entry_type |
string |
否 | 解码提示: account, trustline, contract_data, contract_code, offer, data |
compression.enabled |
boolean |
否 | 为解码账簿字段中的嵌入式base64 blob启用解压缩过程 |
compression.algorithm |
string |
否 | 压缩算法: auto (默认), gzip, deflate, brotli |
compression.fields |
string[] |
否 | 指向要检查的字段的点路径(例如 val.data);如果省略,则会自动发现常见的blob字段 |
输出:
{
"entry_type": "contract_data",
"decoded": {
"contract": "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE",
"key": {
"type": "Symbol",
"value": "Balance",
},
"val": {
"type": "Map",
"value": [
{
"key": { "type": "Address", "value": "GBBD47IF..." },
"val": { "type": "i128", "value": "5000000000" },
},
],
"val": { "type": "i128", "value": "5000000000" }
}
]
},
"durability": "persistent",
"last_modified_ledger": 48123456,
},
"raw_xdr": "AAAABgAAAAEA...",
"compression": {
"enabled": true,
"requested_algorithm": "auto",
"inspected_fields": ["val.data"],
"decompressed_fields": [
{
"path": "val.data",
"algorithm": "gzip",
"utf8": "{\"version\":1,\"blob\":\"...\"}",
"byte_length": 26
}
],
"skipped_fields": []
}
}
示例提示:
“解码此分类账条目XDR并解释其中存储的内容:
AAAABgAAAAEA..."
submit_transaction
签署(可选)并向Stellar网络提交交易。如果 STELLAR_SECRET_KEY 如果在环境中设置了,服务器将在提交之前对交易进行签名。如果没有设置,您可以传递一个已经签名的XDR,它将按原样提交。
警告: 这个工具在网络上不可逆地改变状态。在主网上,它需要花费真正的XLM。始终先进行模拟。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
xdr |
string |
是 | base64编码的交易信封XDR(签名或未签名) |
network |
string |
否 | 覆盖此提交的网络 |
sign |
boolean |
否 | 如果 true 和 STELLAR_SECRET_KEY 设置后,服务器在提交之前对事务进行签名。违约: false |
wait_for_result |
boolean |
否 | 如果 true,轮询直到交易得到确认并返回最终结果。违约: true |
输出(成功):
{
"status": "SUCCESS",
"hash": "aabbccdd1122...",
"ledger": 48123789,
"created_at": "2026-03-16T14:30:00Z",
"fee_charged": "1234",
"return_value": {
"type": "bool",
"value": true,
},
"result_xdr": "AAAAAAAAAGQ...",
}
输出(故障):
{
"status": "FAILED",
"hash": "aabbccdd1122...",
"error_result_xdr": "AAAAAAAAAGT...",
"diagnostic_events": [
{
"event": "contract error",
"message": "HostError: Error(Contract, #1)",
},
],
}
示例提示:
“将此已签名的交易XDR提交到测试网,并告诉我结果:
AAAA..."
build_transaction
构建常见的Stellar交易类型(支付、信任线、管理数据、设置选项、帐户合并、创建帐户),而不需要原始的XDR知识。返回未签名的事务XDR,准备进行模拟和提交。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
source_account |
string |
是 | 恒星公钥(G...)将签署交易并支付费用 |
operations |
array |
Yes | 操作对象数组(至少1个)。每个操作都有一个 type 以及特定类型的参数 |
fee |
number |
无 | 每次手术的基本费用以stroops计。违约: 100000 |
timeout |
number |
否 | 事务超时(秒)。违约: 30 |
network |
string |
否 | 覆盖此事务的网络 |
支持的操作类型:
支付操作
{
"type": "payment",
"destination": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
"amount": 100.5,
"asset_code": "USDC", // Optional - omit for native XLM
"asset_issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN" // Required if asset_code provided
}
更改信任操作
{
"type": "change_trust",
"asset_code": "USDC",
"asset_issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
"limit": "1000000" // Optional - defaults to maximum uint64
}
管理数据操作
{
"type": "manage_data",
"name": "user_preference",
"value": "dark_mode" // Optional - omit to clear the entry
}
设置选项操作
{
"type": "set_options",
"inflation_destination": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
"home_domain": "example.com",
"master_weight": 1,
"low_threshold": 2,
"med_threshold": 3,
"high_threshold": 4,
"signer_address": "GD5DJOWB5G4H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6",
"signer_type": "ed25519_public_key",
"signer_weight": 1
}
帐户合并操作
{
"type": "account_merge",
"destination": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
}
创建帐户操作
{
"type": "create_account",
"destination": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
"starting_balance": 2.5
}
soroban_math
使用Soroban兼容的7位十进制整数表示法执行定点算术、统计和金融数学运算。所有数值都以字符串形式传递,以保持大整数的精度。
操作:
operation |
说明 | 关键参数 |
|---|---|---|
fixed_add |
添加两个定点数字 | a, b, decimals |
fixed_sub |
减去两个不动点数字 | a, b, decimals |
fixed_mul |
将两个定点数相乘 | a, b, decimals |
fixed_div |
除以两个定点数 | a, b, decimals |
mean |
值列表的算术平均值 | values[], decimals |
weighted_mean |
具有相应权重的值的加权平均值 | values[], weights[], decimals |
std_dev |
总体标准偏差 | values[] (≥ 2), decimals |
twap |
时间加权平均价格 | prices[]{price, timestamp} (≥ 2), decimals |
compound_interest |
复利最终金额 | principal, rate_bps, periods, compounds_per_period, decimals |
basis_points_to_percent |
将基点转换为百分比 | value |
percent_to_basis_points |
将百分比转换为基点 | value |
常用参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
operation |
string |
是 | 上述操作名称之一 |
decimals |
integer |
否 | 固定小数点(0-18,默认值 7 --恒星标准) |
输出:
{
"transaction_xdr": "AAAAAgAAAABGDW...==",
"network": "testnet",
"source_account": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
"operations": [
{
"type": "payment",
"description": "Payment of 100.5 XLM to GD5DJOWB5G4H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6H6"
}
],
"fee": "100000",
"timeout": 30
}
示例提示:
“创建一笔交易,将10 XLM从我的账户发送到
GBBD47IF...在测试网上” “为USDC创建一个信托额度,由GA5ZSEJY...限制为1000” “创建一笔交易,创建一个初始余额为2 XLM的新账户”
“操作”:“fixed_mul”, “result”:“10000000”,//原始整数字符串 “人类可感知”:“100000000”, “小数”:7 }
For `basis_points_to_percent` / `percent_to_basis_points` the output contains only `operation` and `result` (a number, not a fixed-point integer).
**Example prompt:**
> _"What is the compound interest on a principal of 1,000 USDC at 5% annual rate (500 bps) over 12 monthly periods?"_
### `compute_vesting_schedule`
Calculate a token vesting / timelock release schedule for team members, investors, or advisors. Given a total allocation, start time, cliff, vesting duration, and release frequency, the tool returns the amount already released, the amount still locked, and a period-by-period schedule.
**Input:**
| Parameter | Type | Required | Description |
| --------------------------- | -------- | -------- | ---------------------------------------------------------------- |
| `total_amount` | `number` | Yes | Total token amount to vest |
| `start_timestamp` | `number` | Yes | Unix timestamp when vesting begins |
| `cliff_seconds` | `number` | Yes | Seconds before any tokens unlock (cliff period) |
| `vesting_duration_seconds` | `number` | Yes | Total vesting period in seconds |
| `release_frequency_seconds` | `number` | Yes | How often tokens unlock after cliff (e.g. `2592000` for monthly) |
| `beneficiary_type` | `string` | Yes | Category: `team`, `investor`, `advisor`, or `other` |
| `current_timestamp` | `number` | No | Optional override for "now" (defaults to current time) |
**Output:**
```jsonc
{
"beneficiary_type": "team",
"total_amount": "1000000.0000000",
"start_date": "2024-11-13T12:00:00.000Z",
"cliff_date": "2025-11-13T12:00:00.000Z",
"end_date": "2028-11-13T12:00:00.000Z",
"released_amount": "250000.0000000",
"unreleased_amount": "750000.0000000",
"vesting_percentage": 25.0,
"next_release_date": "2025-12-13T12:00:00.000Z",
"schedule": [
{
"release_date": "2025-12-13T12:00:00.000Z",
"amount": "20833.3333333",
"released": true,
},
{
"release_date": "2026-01-13T12:00:00.000Z",
"amount": "20833.3333333",
"released": false,
},
],
}
示例提示:
“计算分配给团队的1000000个代币的行权时间表,有1年的悬崖和4年的行权,每月发布一次。”
estimate_token_fees
估算在恒星资产合约(SAC)上铸造或燃烧代币的Soroban资源成本(CPU、内存、费用)。这将为您构建事务并运行模拟。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
contract_id |
string |
是 | SAC合同地址(C...) |
amount |
string |
Yes | 造币或焚烧的金额(作为表示i128的字符串) |
address |
string |
是 | 接收(造币)或丢失(烧毁)代币的地址 |
op |
string |
是 | 估计操作: mint 或 burn |
source_account |
string |
是 | 调用操作的帐户 |
network |
string |
否 | 覆盖网络: mainnet, testnet, futurenet |
输出:
返回模拟结果对象(请参见 simulate_transaction).
{
"status": "success",
"return_value": { "type": "void" },
"cost": {
"cpu_instructions": 725400,
"memory_bytes": 112000
},
"min_resource_fee": "15432",
"events": [...]
}
示例提示:
“估计铸造1000个代币的成本
GBBD...使用SACC...在测试网上。"
“使用账户在主网上燃烧500美元需要多少天然气
G...?"
deploy_contract
构建Stellar交易以部署Soroban智能合约。支持两种模式:
- 直接模式 --使用内置的Soroban部署器(
Operation.createCustomContract).源帐户直接从上传的WASM哈希部署合约。返回未签名的事务XDR和预测的确定性合约地址。 - 工厂模式 --调用工厂合约的部署函数(
Operation.invokeContractFunction).工厂合约在内部使用内置的部署器来创建子合约。返回未签名的事务XDR。
警告: 此工具构建但不提交交易。始终模拟返回的XDR
simulate_transaction在提交之前submit_transaction.
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
mode |
string |
是的 | direct (内置部署器)或 factory (通过工厂合同) |
source_account |
string |
是 | 恒星公钥(G...)这将支付费用 |
wasm_hash |
string |
没有 | 64个字符的十六进制WASM哈希。 直接模式需要。 |
salt |
string |
确定性地址没有 | 64个字符的十六进制盐。如果省略,则为随机。 |
factory_contract_id |
string |
否 | 工厂合同ID(C...). 出厂模式需要。 |
deploy_function |
string |
否 | 工厂部署函数名称。违约: deploy |
deploy_args |
array |
无 | 键入的SCVL参数: [{ type?: 'symbol'|'string'|'u32'|'i32'|'u64'|'i64'|'u128'|'i128'|'bool'|'address'|'bytes'|'void', value: any }] |
optimize_cross_contract_call |
boolean |
否 | 仅工厂模式。如果 true,在返回XDR之前,模拟和组装事务以最小化跨合约资源开销。违约: false |
network |
string |
否 | 覆盖网络: mainnet, testnet, futurenet, custom |
| 参数 | 类型 | 必填 | 说明 |
| --------------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
mode |
string |
是的 | direct (内置部署器)或 factory (通过工厂合同) |
source_account |
string |
是 | 恒星公钥(G...)这将支付费用 |
wasm_hash |
string |
没有 | 64个字符的十六进制WASM哈希。 直接模式需要。 |
salt |
string |
确定性地址没有 | 64个字符的十六进制盐。如果省略,则为随机。 |
factory_contract_id |
string |
否 | 工厂合同ID(C...). 出厂模式需要。 |
deploy_function |
string |
否 | 工厂部署函数名称。违约: deploy |
deploy_args |
array |
无 | 键入的SCVL参数: [{ type?: 'symbol'|'string'|'u32'|'i32'|'u64'|'i64'|'u128'|'i128'|'bool'|'address'|'bytes'|'void', value: any }] |
network |
string |
否 | 覆盖网络: mainnet, testnet, futurenet, custom |
输出(直接模式):
{
"mode": "direct",
"transaction_xdr": "AAAAAgAAAAE...",
"predicted_contract_id": "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE",
"network": "testnet",
"source_account": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
}
输出(出厂模式):
{
"mode": "factory",
"transaction_xdr": "AAAAAgAAAAE...",
"optimization": {
"min_resource_fee": "2500",
"cpu_instructions": "345",
"memory_bytes": "678"
},
"network": "testnet",
"source_account": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
}
示例提示:
“构建一个事务以从wasm哈希部署合约
a1b2c3...在testnet上使用accountGBBD...."
“通过我的工厂部署新的代币合约
CA3D...使用init参数[symbol: 'init', u64: 1000]在测试网上。"
sign_with_ledger
将交易签名委托给物理Ledger硬件钱包。设备必须通过USB连接,Stellar应用程序必须打开。此工具将阻止,直到用户确认或拒绝设备上的交易。
export_ai_schemas
以针对AI训练、文档生成和LLM系统提示创建而优化的格式导出所有Pulsar工具的全面模式定义。该工具可将Pulsar工具定义无缝集成到外部AI/ML系统中。
支持的导出格式:
- JSON --具有类型信息、示例和元数据的机器可读模式。非常适合程序化消费。
- 标记语言 --具有格式化描述、代码块和最佳实践的人类可读文档。
- OpenAPI 3.0 -用于与API文档工具和SDK生成器集成的行业标准REST API规范格式。
get_price_feed
根据报价资产查询去中心化oracle合约中基础资产的价格。假设oracle合约实现了一个标准接口 get_price(base_asset: Symbol, quote_asset: Symbol) -> i128 功能。
calculate_dutch_auction_price
用线性衰减计算荷兰拍卖中资产的当前价格。
track_ledger_consensus_time
对Horizon的最新分类账进行采样,并报告分类账间关闭时间的平均值、最小值、最大值和标准偏差。Stellar的目标是每个账本大约5秒;偏差表明网络拥塞或验证器速度减慢。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
xdr |
string |
是 | Base64编码的无符号事务信封XDR |
derivation_path |
string |
否 | BIP44派生路径(默认: 44'/148'/0') |
network |
string |
否 | 恒星网络覆盖(mainnet, testnet, futurenet) |
输出:
{
"status": "SUCCESS",
"signed_xdr": "AAAAAgAAAAE...",
"network": "testnet"
}
示例提示:
“使用我的分类账签署此交易XDR:
AAAA..."
inspect_xdr
在模拟或提交之前,分析Stellar交易XDR的潜在安全风险。标记危险操作,如帐户合并、签名者更改或过高费用。
| start_price | number |是|资产的初始价格|
| reserve_price | number |是|最低价格(曲线底部)|
| start_timestamp | number |是|价格开始下跌的Unix时间戳|
| end_timestamp | number |是|价格达到保留价时的Unix时间戳|
| current_timestamp | number |否|当前时间的可选覆盖|
calculate_english_auction_state
计算下一个出价要求,并说明英语拍卖。
| sample_size | number |否|要抽样的最近分类账数量(2-100)。违约: 10 |
| network | string |否|覆盖此呼叫的网络(mainnet, testnet, futurenet, custom) |
get_network_params
获取当前的Soroban网络参数,包括资源权重(CPU、内存、分类账操作)、费用阈值和交易限制以及通货膨胀/基础网络参数。在构建事务之前,使用此功能了解资源定价和网络约束。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
network |
string |
否 | 覆盖此呼叫的网络(mainnet, testnet, futurenet, custom) |
optimize_contract_bytecode
分析Soroban合约WASM blob,并提供字节码大小诊断、大小限制检查和与Stellar/Soroban最佳实践一致的优化操作。
此工具专为部署前质量门和CI实施而设计。
get_protocol_version
从Horizon检索当前Stellar协议版本和网络信息。返回协议版本、Horizon版本、支持的功能和升级状态,以帮助跟踪网络功能和功能可用性。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
format |
string |
否 | 导出格式: json (默认), markdown,或 openapi |
include_examples |
boolean |
否 | 包括每个工具的示例输入和输出。违约: true |
network |
string |
否 | 可选网络筛选器(不影响导出的架构,仅用于将来的筛选) |
输出(格式:json):
{
"format": "json",
"content_type": "application/json",
"schema_count": 7,
"include_examples": true,
"data": {
"version": "1.0.0",
"server": "pulsar",
"description": "Pulsar MCP Server — Stellar/Soroban tools for automated blockchain operations...",
"tools": [
{
"name": "get_account_balance",
"description": "Query the current XLM and issued asset balances...",
"category": "query",
"inputSchema": { "type": "object", "properties": { ... } },
"outputSchema": { "type": "object", "properties": { ... } },
"examples": {
"input": { "account_id": "GBBD47IF..." },
"output": { "account_id": "GBBD47IF...", "balances": [...] }
}
},
...
],
"metadata": {
"total_tools": 7,
"categories": { "query": 1, "transaction": 2, "contract": 2, "utility": 2 },
"security_notes": [...],
"stellar_best_practices": [...]
}
}
}
输出(格式:markdown):
返回一个格式化的Markdown文档,其中包含:
- 概述和目录
- 安全和最佳实践部分
- 每个工具文档,包括描述、输入/输出模式和示例
- 危险操作警告(例如。,
submit_transaction)
输出(格式:openapi):
返回OpenAPI 3.0.0规范,其中包含:
- 服务器定义
- 每个工具的路径定义
- 请求/响应模式
- 组件定义(可重用类型)
使用案例:
- AI培训 --导出为JSON,以精确的工具定义微调语言模型
- 文档 --导出为Markdown以自动生成开发人员文档
- API客户端 --导出为OpenAPI以生成类型安全的SDK客户端
- 系统提示 --在LLM系统提示中使用Markdown输出,以实现准确的工具调用
- 整合 --在外部系统中使用JSON导出进行工具发现和验证
示例提示:
“将所有工具模式导出为JSON,以微调LLM。”
“使用示例为所有Pulsar工具生成Markdown文档。”
“以OpenAPI格式导出工具定义以生成SDK。” |
contract_id|string|是| Soroban预言机合约地址(C...) | |base_asset|string|是|基础资产符号(例如。,USD) | |quote_asset|string|是|引用资产符号(例如。,XLM) | |network|string|否|覆盖此呼叫的网络(mainnet,testnet,futurenet) | |current_highest_bid|number|是|当前要击败的出价(如果没有,则为0)| |reserve_price|number|是|开始或获胜所需的最低出价| |bid_increment|number|是|要添加的最小金额或百分比| |bid_increment_type|string|没有|absolute或percentage(默认值:absolute) | |end_timestamp|number|是|拍卖结束时的Unix时间戳|
safe_math_compute
执行具有溢出/下溢保护和Soroban兼容边界检查的安全整数运算。
输入:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
xdr |
string |
是 | Base64编码交易信封XDR |
network |
string |
否 | 恒星网络覆盖(mainnet, testnet, futurenet) |
xdr |
string |
是 | Base64编码的无符号事务信封XDR |
derivation_path |
string |
否 | BIP44派生路径(默认: m/44'/148'/0') |
network |
string |
否 | 恒星网络覆盖(mainnet, testnet, futurenet) |
a |
string |
是 | 第一个操作数(作为字符串以支持大整数) |
b |
string |
是 | 第二个操作数(作为字符串) |
operation |
string |
是的 | add, sub, mul, div |
bounds |
string |
没有 | u32, i32, u64, i64, u128, i128, none (默认值: none) |
wasm_path |
string |
是 | 要分析的WASM文件的路径 |
max_size_kb |
number |
否 | 允许的最大大小(KB)(默认值: 256) |
strict_mode |
boolean |
否 | 如果 true,当大小超过时返回错误 max_size_kb |
network |
string |
否 | 覆盖网络: mainnet, testnet, futurenet, custom |
amm
与实施常数乘积(x*y=k)公式的自动做市商(AMM)合同进行交互。该工具支持代币互换、流动性提供/移除、池查询和具有内置滑点保护的价格影响计算。
行动:
| 动作 | 描述 |
|---|---|
swap |
用滑点保护将一种资产换成另一种资产 |
add_liquidity |
向池中添加流动性并接收LP股份 |
remove_liquidity |
焚烧LP股份以撤回标的资产 |
get_quote |
获取包含价格影响计算的掉期报价 |
get_pool_info |
查询池储备和LP股份总数 |
交换代币
使用AMM池将一种资产兑换成另一种资产。该工具构建了一个事务,您应该在提交之前对其进行模拟。
输入(动作: swap):
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
amm_contract_id |
string |
是 | AMM合同ID(C...) |
source_account |
string |
是 | 您的Stellar公钥(G...) |
offer_asset_code |
string |
是 | 您提供的资产代码(例如。, XLM, USDC) |
offer_asset_issuer |
string |
否 | 发行资产的发行人(XLM省略) |
offer_amount |
string |
是 | 以stroops为单位的金额(1 XLM=10000000 stroops) |
min_receive_amount |
string |
是 | stroops中收到的最低金额(防滑保护) |
receive_asset_code |
string |
是 | 您要接收的资产代码 |
receive_asset_issuer |
string |
否 | 接收资产的发行人(XLM省略) |
network |
string |
否 | 覆盖网络: mainnet, testnet, futurenet |
输出:
{
"is_safe": false,
"risk_level": "HIGH",
"findings": [
{
"level": "HIGH",
"type": "ACCOUNT_MERGE",
"message": "DANGEROUS: This operation will permanently delete account..."
}
],
"operation_count": 1,
"total_fee": "100",
"summary": "Transaction with 1 operation(s): accountMerge."
"network": "testnet",
"sample_size": 10,
"average_consensus_seconds": 5.123,
"min_consensus_seconds": 4.891,
"max_consensus_seconds": 6.204,
"std_dev_seconds": 0.412,
"sampled_at": "2026-04-28T12:00:00.000Z",
"ledgers": [
{
"sequence": 999991,
"closed_at": "2026-04-28T11:59:55.000Z",
"close_time_seconds": 5.0
},
{
"sequence": 999992,
"closed_at": "2026-04-28T11:59:60.000Z",
"close_time_seconds": 5.0
}
]
}
示例提示:
“恒星测试网现在关闭账本的速度有多快?共识是否健康?” “账本序列”:48123789, “资源权重”:{ “cpu_instructions”:“100”, “memory_bytes”:“1000”, “ledger_entry_read”:“50”, “ledger_entry_write”:“100”, “ledger_entry_create”:“150”, “传输字节数”:“200” }, “费用阈值”:{ “min_resource_fee”:“100”, “max_cpu_instructions”:“100000000”, “max_memory_bytes”:“52428800”, “ledger_entry_limits”:{ “max_read_bytes”:“10485760”, “max_write_bytes”:“10485760”, “max_create_bytes”:“10485760” } }, “充气图”:{ “base_reserve”:“500000000”, “base_fee”:“100”, “通货膨胀率”:1.0 }, “network_passphrase”:“测试SDF网络;2015年9月”, “协议版本”:20 }
**Resource Weight Units:**
- `cpu_instructions`: Cost multiplier per CPU instruction
- `memory_bytes`: Cost multiplier per byte of memory
- `ledger_entry_read`: Cost for reading a ledger entry
- `ledger_entry_write`: Cost for writing to a ledger entry
- `ledger_entry_create`: Cost for creating a new ledger entry
- `transmit_bytes`: Cost per byte of transaction data
**Fee Thresholds:**
- `min_resource_fee`: Minimum fee required per transaction (in stroops)
- `max_cpu_instructions`: Maximum CPU instructions allowed per transaction
- `max_memory_bytes`: Maximum memory (in bytes) allowed per transaction
- Ledger entry limits: Maximum bytes for read, write, and create operations
**Example prompt:**
> _"What are the current resource weights and fee thresholds on testnet? I want to estimate the cost of my transaction."_
"wasm_path": "/workspace/target/wasm32v1-none/release/governor.wasm",
"size_bytes": 178432,
"size_kb": 174.25,
"max_size_kb": 256,
"exceeds_limit": false,
"diagnostics": {
"custom_section_bytes": 8120,
"code_section_bytes": 129744,
"data_section_bytes": 14688,
"section_breakdown": []
},
"suggested_commands": [
"cargo build --release --target wasm32v1-none",
"stellar contract optimize --wasm <input.wasm> --wasm-out <optimized.wasm>",
"wasm-opt -Oz -o <optimized.wasm> <input.wasm>"
],
"recommendations": [
{
"id": "strip-custom-sections",
"priority": "high",
"title": "Strip debug/custom sections",
"rationale": "Custom/debug sections increase binary size and are not needed for on-chain execution.",
"action": "Enable symbol stripping and optimization pass to remove custom sections from the final WASM artifact."
}
]
}
看 docs/benchmark_gas.md 和 docs/contract-bytecode-optimization.md 用于工作流程指导。
示例提示:
“分析
./target/wasm32v1-none/release/governor.wasm告诉我如何将其压缩到256KB以下。" “网络”:“测试网”, “协议版本”:20, “水平版本”:“4.0.0”, “核心版本”:“恒星核心20.0.0”, “支持的功能”:[ “基本交易”, “多重签名”, “payment_channels”, “soroban_smart_conclubs”, “足迹_膨胀”, “fee_bumps”, “液相池”, “可索赔的平衡”, “contract_data_ttl”, “合同_实例_存储”, “smart_contract_auth”, “信封类型”, “合同成本模型”, “cpu_instructions”, “stellar_asset_contract”, “wasm_v2”, “complex_concontract_auth”, “增强_感觉_结构” ], “时间戳”:“2024-01-15T10:30:00.000Z” }
**Supported Features by Protocol Version:**
| Protocol Version | Key Features Added |
|---|---|
| 11 | Soroban smart contracts, footprint expiration, fee bumps |
| 12 | Liquidity pools, claimable balances |
| 13 | Contract data TTL, contract instance storage |
| 14 | Smart contract auth, envelope types |
| 15 | Contract cost model, CPU instructions |
| 16 | Stellar Asset Contract, WASM v2 |
| 17+ | Complex contract auth, enhanced fee structures |
**Example prompts:**
> _"What protocol version is testnet currently running and what features are available?"_
> _"Check if mainnet supports Soroban smart contracts yet."_
> _"Compare protocol versions between mainnet and testnet to see what's different."_
"status": "success",
"action": "swap",
"transaction_xdr": "AAAAAgAAAAE...",
"message": "Swap transaction built. Simulate before submitting."
}
示例提示:
“使用AMM合约将10 XLM兑换为USDC
CA3D...最低收入为150美元。"
增加流动性
向AMM池提供流动性,并按您的出资比例获得LP(流动性提供者)股份。
输入(动作: add_liquidity):
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
amm_contract_id |
string |
是 | AMM合同ID(C...) |
source_account |
string |
是 | 您的Stellar公钥(G...) |
asset_a_code |
string |
是 | 第一个资产代码 |
asset_a_issuer |
string |
否 | 第一笔资产的发行人(XLM省略) |
asset_a_amount |
string |
是 | stroops中的第一项资产金额 |
asset_b_code |
string |
是 | 第二资产代码 |
asset_b_issuer |
string |
否 | 第二资产的发行人(XLM省略) |
asset_b_amount |
string |
是 | stroops中的第二资产金额 |
min_shares_received |
string |
是 | 接收的最低LP股份(滑点保护) |
network |
string |
否 | 覆盖网络 |
输出:
{
"status": "success",
"action": "add_liquidity",
"transaction_xdr": "AAAAAgAAAAE...",
"message": "Add liquidity transaction built. Simulate before submitting."
}
示例提示:
“向池中添加流动性
CA3D...:100 XLM和200 USDC,最低4000 LP股。"
移除流动性
焚烧LP股份,以提取您在池标的资产中的相应份额。
输入(动作: remove_liquidity):
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
amm_contract_id |
string |
是 | AMM合同ID(C...) |
source_account |
string |
是 | 您的Stellar公钥(G...) |
shares_amount |
string |
是 | 在stroops中燃烧的LP股份数量 |
min_asset_a_amount |
string |
是 | 要接收的最低资产A(滑点保护) |
min_asset_b_amount |
string |
是 | 要接收的最低资产B(滑点保护) |
network |
string |
否 | 覆盖网络 |
输出:
{
"status": "success",
"action": "remove_liquidity",
"transaction_xdr": "AAAAAgAAAAE...",
"message": "Remove liquidity transaction built. Simulate before submitting."
}
示例提示:
“从池中删除500个LP股份
CA3D...,最低50 XLM和100 USDC。"
获取掉期报价
获取潜在掉期的报价,包括预期产出、价格影响和汇率。这是一个只读操作,不会生成事务。
输入(动作: get_quote):
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
amm_contract_id |
string |
是 | AMM合同ID(C...) |
offer_asset_code |
string |
是 | 正在提供资产代码 |
offer_asset_issuer |
string |
否 | 发行资产的发行人(XLM省略) |
offer_amount |
string |
是 | 提供的金额以stroops为单位 |
receive_asset_code |
string |
是 | 要接收的资产代码 |
receive_asset_issuer |
string |
否 | 接收资产的发行人(XLM省略) |
network |
string |
否 | 覆盖网络 |
输出:
{
"status": "SUCCESS",
"signed_xdr": "AAAAAgAAAAE...",
"network": "testnet"
"result": "1000000000000000000",
"operation": "add",
"bounds": "u64",
"formatted": "Result of 500000000000000000 add 500000000000000000 is 1000000000000000000 (within u64 bounds)"
}
“状态”:“成功”, “要约_资产”:{ “代码”:“XLM”, “发行人”:“本地”, “金额”:“10000000” }, “接收资产”:{ “代码”:“USDC”, “发行人”:“GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4K4KZVN”, “金额”:“19850000” }, “pool_reserves”:{ “reserve_a”:“1000000000”, “reserve_b”:“200000000” }, “fee_bps”:30, “价格影响”:150, “汇率”:1.985 }
**Example prompt:**
> _"Get a quote for swapping 10 XLM to USDC on AMM `CA3D...` with current reserves."_
#### Get Pool Information
Query the current state of an AMM pool, including reserves for both assets and total LP shares in circulation.
**Input (action: `get_pool_info`):**
| Parameter | Type | Required | Description |
|---|---|---|---|
| `amm_contract_id` | `string` | Yes | AMM contract ID (`C...`) |
| `asset_a_code` | `string` | Yes | First asset code |
| `asset_a_issuer` | `string` | No | Issuer of first asset (omit for XLM) |
| `asset_b_code` | `string` | Yes | Second asset code |
| `asset_b_issuer` | `string` | No | Issuer of second asset (omit for XLM) |
| `network` | `string` | No | Override network |
**Output:**
```jsonc
{
"contract_id": "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE",
"base_asset": "USD",
"quote_asset": "XLM",
"price": "1000000",
"network": "testnet"
"status": "success",
"pool": {
"asset_a": {
"code": "XLM",
"issuer": "native",
"reserve": "1000000000"
},
"asset_b": {
"code": "USDC",
"issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
"reserve": "2000000000"
},
"total_shares": "1414213562",
"contract_id": "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE"
},
"constant_product": "2000000000000000000"
}
示例提示:
“签署XDR安全吗?
AAAA..." “使用我的分类账签署此交易XDR:AAAA..." “从oracle合约获取当前美元/XLM价格CA3D...在测试网上。" “获取AMM合约上XLM/USDC对的池信息CA3D...."
AMM数学
脉冲星实现了Uniswap V2和类似协议使用的标准常数积AMM公式(x*y=k):
交换计算
output = (reserve_out * amount_in * (1 - fee)) / (reserve_in + amount_in * (1 - fee))
哪里:
fee=0.30%(30个基点)reserve_in=投入资产的当前储备reserve_out=产出资产的当前储备amount_in=交换金额
流动性股票
初始存款:
shares = sqrt(amount_a * amount_b)
后续存款:
shares = min((amount_a * total_shares) / reserve_a, (amount_b * total_shares) / reserve_b)
移除流动性
amount_a = (shares_burned * reserve_a) / total_shares
amount_b = (shares_burned * reserve_b) / total_shares
提示和工作流示例
一旦脉冲星连接到你的人工智能助手,这些现实世界的工作流程就成为可能。
1.汇款前检查账户
Me: Check the XLM and USDC balance of GBBD47... on testnet before I send anything.
AI: [calls get_account_balance] — The account holds 9,842.12 XLM and 250.00 USDC. It has 3 subentries, so the minimum balance is 2 XLM base + 0.5 per subentry = 3.5 XLM. Safe to proceed.
2.根据合约规范生成TypeScript SDK
Me: Fetch the contract spec for CA3D... and generate a fully-typed TypeScript client for all its functions.
AI: [calls fetch_contract_spec] — Here is a TypeScript client using @stellar/stellar-sdk ...
3.支出费用前的模拟运行
Me: I built this transaction XDR. Simulate it and tell me if it will succeed and what the fee will be.
AI: [calls simulate_transaction] — The simulation succeeded. Return value is `true`. The min resource fee is 12,345 stroops (~0.001234 XLM). CPU: 512,340 instructions. Looks good to submit.
4.调试合同存储
Me: Here's a ledger entry XDR from querying the contract storage. What's in it?
AI: [calls decode_ledger_entry] — This is a persistent ContractData entry for contract CA3D.... The key is the Symbol "Balance" and the value is a Map with one entry: address GBBD47... → i128 value 5,000,000,000 (which at 7 decimal places is 500.0000000 tokens).
5.确认后的完整发送周期
Me: Submit this signed XDR to testnet and wait for confirmation.
AI: [calls submit_transaction with wait_for_result: true] — Submitted! Hash: aabbcc... Confirmed in ledger 48,123,789. Fee charged: 1,234 stroops. Return value: true.
Soroban CLI集成
pulser将某些操作委托给官方的Stellar CLI,以确保Soroban XDR格式的字节级正确性。服务器将使用在以下位置找到的二进制文件 STELLAR_CLI_PATH (默认值: stellar 上 $PATH).
使用CLI后端的操作:
| 工具 | 已使用CLI命令 |
|---|---|
fetch_contract_spec |
stellar contract info interface |
simulate_transaction |
呼叫索罗班RPC simulateTransaction 直接 |
decode_ledger_entry |
stellar xdr decode |
submit_transaction |
直接调用Soroban RPC/Horizon,必要时使用CLI进行签名 |
compute_vesting_schedule |
纯计算,无外部调用 |
deploy_contract |
调用Horizon获取序列号;通过star-sdk构建事务XDR |
| 工具 | 已使用CLI命令 |
| --- | --- |
fetch_contract_spec |
stellar contract info interface |
simulate_transaction |
呼叫索罗班RPC simulateTransaction 直接 |
decode_ledger_entry |
stellar xdr decode |
submit_transaction |
直接调用Soroban RPC/Horizon,必要时使用CLI进行签名 |
compute_vesting_schedule |
纯计算,无外部调用 |
deploy_contract |
调用Horizon获取序列号;通过star-sdk构建事务XDR |
track_ledger_consensus_time |
呼叫地平线 ledgers() 终点;统计的纯计算 |
get_protocol_version |
调用Horizon获取最新的分类账和根信息 |
您可以通过设置来检查正在执行的确切CLI命令 LOG_LEVEL=debug.
开发指南
项目结构
pulsar/
├── src/
│ ├── index.ts # MCP server entrypoint, tool registration
│ ├── tools/
│ │ ├── get_account_balance.ts
│ │ ├── fetch_contract_spec.ts
│ │ ├── simulate_transaction.ts
│ │ ├── decode_ledger_entry.ts
│ │ ├── submit_transaction.ts
│ │ ├── compute_vesting_schedule.ts
│ │ ├── deploy_contract.ts
│ │ └── track_ledger_consensus_time.ts
│ │ └── get_protocol_version.ts
│ ├── services/
│ │ ├── horizon.ts # Horizon REST client wrapper
│ │ ├── soroban-rpc.ts # Soroban JSON-RPC client wrapper
│ │ ├── stellar-cli.ts # Shell-out wrapper for the Stellar CLI
│ │ └── xdr.ts # XDR encode/decode helpers
│ ├── schemas/
│ │ └── index.ts # Zod schemas for all tool inputs/outputs
│ └── config.ts # Network config, env var loading
├── tests/
│ ├── unit/
│ └── integration/
├── contracts/ # Soroban Rust workspaces
│ └── reference/ # Reference contracts and test suite
├── .env.example
├── package.json
├── tsconfig.json
└── README.md
参考合同
确保脉冲星的工具集(simulate_transaction, fetch_contract_spec, decode_ledger_entry)经过严格验证,我们保持 contracts/ 包含“参考合同”的目录。这些是标准的Soroban-Rust合约,实现了各种功能(事件、结构、跨合约调用、条件恐慌)。
您可以将这些合约编译为WASM,并通过以下方式运行其全面的Rust单元测试:
# Build the reference contracts (generates AI-ready WASM specs)
npm run build:contracts
# Run the comprehensive unit test suite
npm run test:contracts
这些参考WASM文件提供了一个精确的基线来验证脉冲星工具的输出。
添加新工具
- 创建处理程序 在
src/tools/my_new_tool.ts:
import { z } from 'zod';
import { McpToolHandler } from '../types.js';
export const myNewToolSchema = z.object({
some_param: z.string().describe('Description for the AI to understand'),
});
export const myNewTool: McpToolHandler<typeof myNewToolSchema> = async (input) => {
const { some_param } = input;
// ... implementation
return { result: '...' };
};
- 注册它 在
src/index.ts:
import { myNewTool, myNewToolSchema } from './tools/my_new_tool.js';
server.tool(
'my_new_tool',
'One-sentence description visible to the AI assistant',
myNewToolSchema.shape,
myNewTool
);
-
添加测试 在
tests/unit/my_new_tool.test.ts. -
记录它 在本自述文件中 工具参考.
本地运行
# Development mode with hot-reload
npm run dev
# Build and run
npm run build && node dist/index.js
# Test the server interactively (pipe JSON-RPC requests)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/index.js | jq .
测试
# Run all unit tests
npm test
# Run integration tests (requires testnet access)
npm run test:integration
# Run end-to-end (E2E) tests (requires testnet access and stellar CLI)
RUN_INTEGRATION_TESTS=true npx vitest tests/e2e
# Run with coverage
npm run test:coverage
# Lint
npm run lint
# Type-check only (no emit)
npm run typecheck
单元测试 模拟Horizon和Soroban RPC响应,不需要网络访问。
集成测试 访问真实的测试网端点。它们在CI中被跳过,除非 RUN_INTEGRATION_TESTS=true 已设置。
监控
普罗米修斯指标
pulser公开了详细的Prometheus指标,用于监控工具性能、资源使用和错误率。
访问指标
默认情况下,指标可在 http://localhost:9090/metrics (可通过以下方式定制 METRICS_PORT).
# Fetch metrics in Prometheus format
curl http://localhost:9090/metrics
# Health check endpoint
curl http://localhost:9090/health
Prometheus查询示例
# Average tool execution time (last 5 minutes)
rate(pulsar_tool_duration_seconds_sum[5m]) / rate(pulsar_tool_duration_seconds_count[5m])
# Tool error rate
rate(pulsar_tool_errors_total[5m])
# Current heap memory usage in MB
pulsar_heap_memory_used_bytes / 1024 / 1024
# Active tool invocations
pulsar_active_tool_invocations
# Total successful invocations by tool
sum by (tool_name) (pulsar_tool_invocations_total{status="success"})
Docker中的指标
在Docker中运行pulser时,暴露metrics端口:
docker run -p 9090:9090 ghcr.io/benelabs/pulsar:latest
禁用指标
如果您想减少内存开销或出于隐私原因禁用指标导出,请设置:
METRICS_ENABLED=false
HTTP指标服务器将不会启动,也不会收集任何指标。
安全注意事项
- 永不承诺
STELLAR_SECRET_KEY版本控制。添加.env到.gitignore在开发过程中使用一次性资助的测试网密钥对。 submit_transaction是不可逆转的。 总是打电话simulate_transaction首先验证交易是否成功,尤其是在主网上。- 输入验证。 在任何网络调用之前,所有工具输入都会使用Zod模式进行验证。格式错误的XDR或无效的公钥会被早期拒绝,并显示明确的错误消息。
- 没有密钥存储。 脉冲星不保存密钥。这
STELLAR_SECRET_KEY环境变量在运行时被读取,服务器从不将其写入磁盘。 - 工具执行审计日志记录。 pulser维护本地文件日志(默认为
audit.log)所有执行的工具,包括输入和结果。对于严格的安全标准和数据隐私,敏感字段(如STELLAR_SECRET_KEY,xdr,以及envelope_xdr)已完全编辑,公共标识符如Stellar帐户地址(G...)和Soroban合约ID(C...)被散列以确保匿名。 - 速率限制。 服务器在内部没有实现速率限制——如果你大量使用Horizon或Soroban RPC,可以考虑运行自己的节点或使用具有速率限制控制的提供程序。
- 先测试网。 默认值
STELLAR_NETWORK是testnet。您必须明确设置STELLAR_NETWORK=mainnet与实时网络进行交互。这是有意的。
路线图
- [x]
get_account_balance--账户余额查询 - [x]
fetch_contract_spec--Soroban ABI获取 - [x]
simulate_transaction--通过Soroban RPC进行模拟运行 - [x]
decode_ledger_entry--XDR解码 - [x]
submit_transaction--广播+等待结果 - [x]
soroban_math--定点、统计和金融数学 - [x]
compute_vesting_schedule--代币兑现/时间锁定时间表计算器 - [x]
deploy_contract--通过内置部署器或工厂模式部署Soroban合约 - [x]
get_price_feed--查询分散的oracle合约以获取实时资产价格 - [x] Prometheus指标导出——监控工具性能、错误和资源使用情况
- [x]
get_liquidity_pool--获取AMM池储备、份额和费用设置 - [x]
get_fee_stats--检索网络费用统计和推荐费用 - [x]
latency_based_rpc--自动路由到最快的Soroban RPC端点 - [x]
get_protocol_version--跟踪网络升级和功能可用性 - [x]
amm--具有掉期、流动性和报价操作的自动做市商(常数产品x*y=k) - [ ]
get_transaction_history--帐户的分页历史记录 - [ ]
stream_events--订阅Soroban合约活动 - [ ]
build_transaction--从合约spec+args构造Soroban调用事务(不需要预先构建的XDR) - [ ]
fund_testnet_account--致电Friendbot为新的测试网账户充值 - [ ]
get_offers--查询账户或资产对的公开DEX报价 - [ ]
watch_account--帐户的流式账本更新 - []SSE传输选项(适用于基于web的MCP主机)
- []Rust实现(用于更低的延迟和单二进制分布)
- []用于自托管部署的Docker镜像
贡献
非常欢迎捐款。脉冲星是一个社区项目,诞生于恒星生态系统对更好的人工智能工具的需求。
快速启动
# Fork and clone
git clone https://github.com/your-username/pulsar.git
cd pulsar
# Install deps
npm install
# Create a feature branch
git checkout -b feat/my-feature
# Make your changes, add tests
npm test && npm run lint
# Open a PR
指南
- 每个PR一个工具 --保持更改的重点和可审查性。
- 所需测试 --每个新工具至少需要单元测试覆盖率。
- 记录您的工具 --在此README中添加一节。
- 测试中没有密钥 --使用模拟回复或Friendbot资助的一次性账户。
- 常规承诺 --使用
feat:,fix:,docs:,test:提交消息中的前缀。
报告问题
通过以下方式打开问题:
- 您使用的工具名称和输入(编辑任何密钥)。
- 错误消息或意外输出。
- 你的
STELLAR_NETWORK和stellar --version.
相关项目
| 项目 | 描述 |
|---|---|
| Stellar开发者文档 | Stellar和Soroban的官方文件 |
| Stellar CLI | Soroban开发的官方CLI |
| @恒星/恒星sdk | 官方JavaScript/TypeScript SDK |
| 模型上下文协议 | 此服务器实现的开放协议 |
| 斯特拉(SDF) | SDF为Stellar提供的官方无头人工智能助手 |
| 索罗班的例子 | Soroban智能合约示例 |
| 恒星实验室 | 用于构建和签署交易的基于浏览器的工具 |
许可证
麻省理工学院 ©2026脉冲星贡献者
Built by the Stellar community, for the Stellar community.
If this helped you ship something, leave a ⭐ and tell a friend.
