openmcp-sdk
v0.1.5
Published
openmcp-sdk
Maintainers
Readme
🫱 OpenMCP SDK 官方文档
QQ Discussion GroupDiscord Channel
Introduction
OpenMCP-SDK is a framework designed for building autonomous agent systems with MCP (Model Context Protocol) server integration.
Create agents in just a few lines of code
Full MCP server compatibility
Built-in dataset collection system (OpenMCP Reflux)
Intuitive lifecycle control functions for precise agent management
Robust and efficient Agent Loop, proven reliable in numerous production deployments
Dual compatibility with both OpenAI and XML-Wrapper function calling standards
Straightforward logging that helps you quickly pinpoint agent issues
Installation
npm install openmcp-sdkCurrently, openmcp-sdk only supports ESM-style imports.
Usage
Filename: main.ts
import { OmAgent } from 'openmcp-sdk/service/sdk';
// create Agent
const agent = new OmAgent();
// Load configuration, which can be automatically generated after debugging with openmcp client
agent.loadMcpConfig('./mcpconfig.json');
// Read the debugged prompt
const prompt = await agent.getPrompt('hacknews', { topn: '5' });
// Execute the task
const res = await agent.ainvoke({ messages: prompt });
console.log('⚙️ Agent Response', res);mcpconfig.json can be generated from openmcp client directly, you don't have to write it by yourself. Here is the example:
{
"version": "1.0.0",
"namespace": "openmcp",
"mcpServers": {
"my-browser": {
"command": "mcp",
"args": [
"run",
"~/projects/openmcp-tutorial/crawl4ai-mcp/main.py"
],
"description": "A MCP for long-term memory support",
"prompts": [
"hacknews"
]
}
},
"defaultLLM": {
"baseURL": "https://api.deepseek.com",
"apiToken": "sk-xxxxxxxxxxxxxx",
"model": "deepseek-chat"
}
}Run your agent and get example output:
2025/6/20 - 20:47:31 | 🚀 [crawl4ai-mcp] 1.9.1 connected, type STDIO
2025/6/20 - 20:47:35 | 🤖 Agent wants to use these tools get_web_markdown
2025/6/20 - 20:47:39 | ✅ get_web_markdown success
2025/6/20 - 20:47:46 | 🤖 Agent wants to use tools(3) get_web_markdown, get_web_markdown, get_web_markdown
2025/6/20 - 20:47:48 | ✅ get_web_markdown success
2025/6/20 - 20:47:54 | ✅ get_web_markdown success
2025/6/20 - 20:47:57 | ✅ get_web_markdown success
└─ ⬇️145434 ⬆️1554 🎯96.1% 💰0.0439 rmb
⚙️ Agent Response
⌨️ Today's Tech Article Roundup
📌 How to Detect or Observe Passing Gravitational Waves?
Summary: This article explores the physics of gravitational waves, explaining their effects on space-time and how humans might perceive or observe this cosmic phenomenon.
Author: ynoxinul
Posted: 2 hours ago
Link: https://physics.stackexchange.com/questions/338912/how-would-a-passing-gravitational-wave-look-or-feel
📌 Learn Makefile Tutorial
Summary: A comprehensive Makefile tutorial for beginners and advanced users, covering basic syntax, variables, automatic rules, and advanced features to help developers manage project builds efficiently.
Author: dsego
Posted: 4 hours ago
Link: https://makefiletutorial.com/
📌 Hurl: Run and Test HTTP Requests in Plain Text
Summary: Hurl is a command-line tool that allows defining and executing HTTP requests in plain text format, ideal for data fetching and HTTP session testing. It supports chained requests, value capture, and response queries, making it perfect for testing REST, SOAP, and GraphQL APIs.
Author: flykespice
Posted: 8 hours ago
Link: https://github.com/Orange-OpenSource/hurlFor more details, see the official documentation: https://openmcp.kirigaya.cn/sdk-tutorial/
Star our project: https://github.com/LSTM-Kirigaya/openmcp-client
