Readwise MCP 服务器是一个模型上下文协议(MCP)服务器,它能让你轻松访问和交互自己的 Readwise 图书馆,为你提供便捷的信息获取和处理体验。
git clone https://github.com/your-repository.git
cd your-repository
npm install
npm run build
npm run setup
config.js 文件。CLI 使用示例
# 获取高亮内容
npm run get-highlights -- [--page=1 --limit=10]
# 搜索高亮内容
npm run search-highlights -- [--query="您的搜索词" --exact]
API 示例代码
const { MCPClient } = require('@readwise/mcp-client');
// 初始化客户端
const client = new MCPClient('your-api-key');
// 获取高亮内容
async function getHighlights() {
try {
const response = await client.getHighlights({
page: 1,
limit: 10
});
console.log(response.data);
} catch (error) {
console.error('获取高亮内容失败:', error.message);
}
}
// 搜索高亮内容
async function searchHighlights() {
try {
const response = await client.searchHighlights({
query: '您的搜索词',
exact: true
});
console.log(response.data);
} catch (error) {
console.error('搜索高亮失败:', error.message);
}
}
npm test
get_highlights 工具获取高亮内容。search_highlights 工具搜索高亮内容。npm run test-mock
# 构建项目
npm run build
# 执行测试
npm test
# 开发模式启动(自动重载)
npm run dev:watch
# 代码检查
npm run lint
# 主代码目录
src/
# 测试脚本目录
test-scripts/
# 文档目录
docs/
# 示例配置文件目录
examples/
本项目采用 MIT 许可证。