S/MCP(斯特恩模型上下文协议)是一款强大的MCP服务器,为用户提供与哲学AI导师斯特恩交流的机会。斯特恩能通过微妙的指导和智慧,助力人类挖掘自身潜力。它结合理性主义思维与斯多葛派哲学,借助以太坊智能合约,在Solana网络上提供基于区块链的个人发展承诺工具。
OPENAI_API_KEY环境变量)git clone
cd s-mcp
bun install
cp .env.example .env
编辑.env文件以添加OpenAI API密钥:
OPENAI_API_KEY=your_openai_api_key_here
bun run build
启动MCP服务器:
bun run start
这将启动stdio模式的服务器,允许其与MCP客户端通信。
可以使用任何MCP客户端与服务器交互。以下是使用MCP SDK连接到服务器的一个示例:
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { spawn } from "child_process";
// 以子进程形式启动MCP服务器
const serverProcess = spawn("node", ["path/to/dist/main.js"], {
stdio: ["pipe", "pipe", "pipe"],
});
// 创建通过stdio与服务器通信的客户端
const transport = new StdioClientTransport();
const client = new Client(transport);
// 连接至斯特恩服务并请求一条哲学建议
client.connect()
.then(() => client.request("stern#chat"))
.then((response) => {
console.log("斯特恩回应:", response);
})
.catch((error) => {
console.error("发生错误:", error);
});
stern#chat -- "什么是真正的幸福?"
stern#advice -- "我该如何克服 procrastination?"
git clone
cd s-mcp
bun install
cp .env.example .env
编辑.env文件以添加OpenAI API密钥:
OPENAI_API_KEY=your_openai_api_key_here
bun run build
bun run start
这将启动stdio模式的服务器,允许其与MCP客户端通信。
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { spawn } from "child_process";
// 以子进程形式启动MCP服务器
const serverProcess = spawn("node", ["path/to/dist/main.js"], {
stdio: ["pipe", "pipe", "pipe"],
});
// 创建通过stdio与服务器通信的客户端
const transport = new StdioClientTransport();
const client = new Client(transport);
// 连接至斯特恩服务并请求一条哲学建议
client.connect()
.then(() => client.request("stern#chat"))
.then((response) => {
console.log("斯特恩回应:", response);
})
.catch((error) => {
console.error("发生错误:", error);
});
stern#chat -- "什么是真正的幸福?"
stern#advice -- "我该如何克服 procrastination?"
斯特恩是一位具有以下特点的哲学AI导师:
斯特恩通过以下方式帮助用户达成目标:
OPENAI_API_KEY:你的OpenAI API密钥(msg_stern工具所需)MIT