Skip to main content
Glama
vdonthireddy

GemmaJnana

by vdonthireddy

MCP Skills

一个轻量、健壮且解耦的 CLI/Agent 框架,演示了通过 Model Context Protocol (MCP) 实现 代理技能的渐进式披露

本项目实现了一个完整的本地代理循环,通过 stdio 传输与后端 MCP 服务器通信。它使代理能够动态地、按需地发现工具并获取复杂指令(技能),仅在相关时才加载。

🗺️ Obsidian 库地图

快速浏览 Obsidian 中的文档:

  • 🏠 主页 (README): [[README]]

  • 📖 通俗指南: [[LAYMAN_GUIDE|A Layman's Guide to MCP Skills]]

  • ⚙️ 系统流程与演练: [[FLOW|How it works — an end-to-end walkthrough]]

  • 🏴☠️ 示例技能: [[skills/pirate-speak/SKILL|Pirate Speak Skill (SKILL.md)]]


Related MCP server: Forage MCP Server

主要特性

  • 解耦架构:进程 A(CLI/Agent)与进程 B(MCP 服务器)严格通过 JSON-RPC 基于 Model Context Protocol 通信。代理中不导入服务器工具或技能加载器逻辑。

  • 渐进式技能披露:代理首先廉价地列出可用技能的元数据(名称和描述),仅当 LLM 确定技能相关时才拉取令牌密集的指令。

  • 基于 AST 的计算器:一个安全的数学评估工具,将执行限制为基本数字和算术运算,完全防止远程代码执行。

  • 健壮的本地测试:内置基于规则和脚本的 DummyClient,允许无需 LLM API 密钥即可进行确定性的离线多步代理行为测试。

  • 真实 LLM 集成:通过环境配置无缝切换到真实的 OpenAI 兼容端点。

  • 现代包布局:使用基于 Click 的 CLI 和 pyproject.toml 设置的结构化干净包布局。


系统架构

graph LR
    subgraph CLI_PROC["Process A — CLI / Agent"]
        CLI["cli.py<br/>run command"]
        AG["Agent<br/>ReAct Loop"]
        LLM["LLMClient<br/>(Dummy / OpenAI)"]
        MC["MCPClient<br/>(stdio client)"]
        CLI --> AG
        AG --> LLM
        AG --> MC
    end

    subgraph SRV_PROC["Process B — MCP Server"]
        SRV["FastMCP Server<br/>app.py"]
        TOOLS["Tools<br/>calculator, echo"]
        SKILLS["Skills<br/>list_skills / load_skill<br/>+ prompts"]
        SRV --> TOOLS
        SRV --> SKILLS
    end

    MC <-->|"MCP stdio<br/>(JSON-RPC on stdin/stdout)"| SRV
    LLM -.->|"OpenAI Chat API"| EXT["LLM API Endpoint"]

项目布局

mcp-skills-new/
├── chatbot-ui/                 # Premium Chatbot Web UI
├── start.sh                    # Starts MCP server & UI in background
├── stop.sh                     # Stops background services
├── pyproject.toml              # Build backend and dependencies config
├── FLOW.md                     # Walkthrough explaining how the framework runs
├── README.md                   # This overview file
├── skills/                     # Builtin skills catalog
│   └── pirate-speak/
│       └── SKILL.md            # Pirate-speak instructions with frontmatter
├── src/
│   └── mcp_skills/
│       ├── __init__.py
│       ├── cli.py              # Click commands entry point
│       ├── config.py           # Configuration parser settings
│       ├── agent/              # CLI Agent components
│       │   ├── __init__.py
│       │   ├── agent.py        # ReAct orchestration loop
│       │   ├── mcp_client.py   # MCP stdio client wrapper
│       │   └── prompts.py      # System prompts
│       ├── llm/                # LLM connectors (Dummy & OpenAI)
│       │   ├── __init__.py
│       │   ├── base.py
│       │   ├── dummy.py
│       │   └── openai_client.py
│       └── server/             # Stdio/SSE MCP server
│           ├── __init__.py
│           ├── __main__.py
│           ├── app.py          # FastMCP server wiring
│           ├── skills/         # Skill markdown loader
│           │   ├── __init__.py
│           │   ├── loader.py
│           │   └── models.py
│           └── tools/          # Registry and builtin tools
│               ├── __init__.py
│               ├── base.py
│               ├── registry.py
│               └── builtins.py
└── tests/                      # 18 pytest unit/integration tests

[!TIP] Obsidian 导航提示: 你可以直接在 Obsidian 中使用这些链接打开和编辑关键文件:

  • [[FLOW]] — ReAct 代理循环和 stdio 通信的详细技术演练。

  • [[LAYMAN_GUIDE]] — 高层、开发者友好的概述,附有类比。

  • [[skills/pirate-speak/SKILL]] — 示例技能指令模板。


安装

以可编辑模式安装包及其开发依赖:

python3 -m pip install -e ".[dev]"

用法

1. 运行代理循环

触发代理回答问题。它将自动生成 stdio MCP 服务器子进程,检查活动工具,推理步骤,调用适当的工具,并返回摘要。

数学执行(使用 AST 计算器工具):

mcp-skills run "what is 6 * 7?"

技能发现与懒加载:

mcp-skills run "what skills exist?"

2. 通过 CLI 探索已发现的技能

在不启动代理循环的情况下探索已加载的技能模板:

mcp-skills skills list

3. 运行独立 MCP 服务器

启动一个在 stdin/stdout 上监听的原始 MCP 服务器:

mcp-skills serve

通过 MCP Inspector 交互式检查工具和提示:

npx @modelcontextprotocol/inspector mcp-skills serve

4. Web UI 与后台服务器

我们提供脚本在后台运行 MCP 服务器和静态 Web UI:

./start.sh

这将通过 SSE 在端口 8000 上启动 mcp-skills serve,并在端口 8080 上启动 Python HTTP 服务器。导航到 http://127.0.0.1:8080 访问聊天机器人 UI。

要停止后台进程,运行:

./stop.sh

使用真实 LLM 运行

要从离线的 DummyClient 切换到真实模型,请在项目根目录创建 .env 文件:

MCP_SKILLS_LLM_PROVIDER=openai
MCP_SKILLS_MODEL=gpt-4o-mini
MCP_SKILLS_OPENAI_BASE_URL=https://api.openai.com/v1
MCP_SKILLS_OPENAI_API_KEY=your-api-key-here

运行测试

执行测试套件以运行 18 项离线验证检查:

pytest -v
F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • Hosted MCP server to manage a restaurant menu from AI agents - 39 tools over the DuckHub API.

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vdonthireddy/ollama-gemma-agents-mcp-skills'

If you have feedback or need assistance with the MCP directory API, please join our Discord server