电报MCP服务器(Python)
一种模型上下文协议(MCP)服务器,提供与电报API(Telegraph.ph)交互的工具。此Python实现允许Claude和其他LLM客户端创建、管理和导出Telegraph页面。
特性
- 账户管理:创建帐户、更新信息、管理访问令牌
- 页面操作:创建、编辑、检索和列出页面
- 模板系统:使用预构建的模板创建页面
- 导出和备份:将页面导出到Markdown/HTML,备份整个帐户
- MCP资源:访问电报页面作为MCP资源
- MCP提示:常见任务的指导工作流程
安装
使用uvx(推荐)
uvx telegraph-mcp-py使用pip
pip install telegraph-mcp-py来源
git clone https://github.com/NehoraiHadad/telegraph-mcp
cd telegraph-mcp/telegraph-mcp-py
pip install -e .用法
使用克劳德代码
claude mcp add telegraph-py -- uvx telegraph-mcp-py使用克劳德桌面
添加到您的Claude Desktop配置(~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"telegraph-py": {
"command": "uvx",
"args": ["telegraph-mcp-py"]
}
}
}或者,如果通过pip安装:
{
"mcpServers": {
"telegraph-py": {
"command": "telegraph-mcp-py"
}
}
}可用工具
账户管理
| 工具 | 说明 |
|---|---|
telegraph_create_account | 创建新的Telegraph帐户 |
telegraph_edit_account_info | 更新帐户信息 |
telegraph_get_account_info | 获取帐户详细信息 |
telegraph_revoke_access_token | 撤销并重新生成访问令牌 |
页面管理
| 工具 | 说明 |
|---|---|
telegraph_create_page | 新建页面(支持HTML/Markdown) |
telegraph_edit_page | 编辑现有页面 |
telegraph_get_page | 按路径获取页面 |
telegraph_get_page_list | 列出帐户的所有页面 |
telegraph_get_views | 获取页面浏览统计信息 |
模板
| 工具 | 说明 |
|---|---|
telegraph_list_templates | 列出可用模板 |
telegraph_create_from_template | 从模板创建页面 |
导出和备份
| 工具 | 说明 |
|---|---|
telegraph_export_page | 将页面导出为Markdown或HTML格式 |
telegraph_backup_account | 备份所有帐户页面 |
资源
直接作为MCP资源访问Telegraph页面:
telegraph://page/{path}例子: telegraph://page/Sample-Page-12-15
提示
指导工作流程的预定义提示:
create_blog_post-创建博客文章指南create_documentation-文档创建指南summarize_page-总结现有页面
例子
使用Markdown创建页面
# Via MCP tool call
telegraph_create_page(
access_token="your-token",
title="My First Post",
content="# Hello World\n\nThis is my first Telegraph page!",
format="markdown"
)使用模板
telegraph_create_from_template(
access_token="your-token",
template="blog_post",
title="My Blog Post",
data={
"intro": "Welcome to my blog!",
"sections": [
{"heading": "Section 1", "content": "First section content"},
{"heading": "Section 2", "content": "Second section content"}
],
"conclusion": "Thanks for reading!"
}
)导出页面
telegraph_export_page(
path="Sample-Page-12-15",
format="markdown"
)发展
设置
cd telegraph-mcp-py
pip install -e ".[dev]"MCP检验员测试
npx @modelcontextprotocol/inspector uvx telegraph-mcp-py相关套餐
许可证
MIT许可证-请参阅 许可证 了解详情。
