Skip to main content
Glama

MCP 作业 — 主机、两种传输协议与一项技能

本项目无需额外框架即可满足作业的本地部分要求:

  • 使用 Ollama qwen3.5:4b 的 CLI 代理;

  • 加载配置、合并工具并路由调用的 MCP 主机;

  • 包含 3 个工具、1 个资源和 1 个提示的 stdio 待办事项服务器;

  • 通过经过身份验证的本地 Streamable HTTP 运行的同一服务器;

  • 通过 use_skill 实现的渐进式技能加载;

  • 持久化、验证、可恢复的 MCP 错误以及集成测试。

有意不进行公共托管。具体部署步骤请参见 PUBLIC_HTTP.md。

要求

  • Node.js 20+

  • Ollama

  • qwen3.5:4b:ollama pull qwen3.5:4b

Related MCP server: Personal OS MCP

安装与验证

npm install
npm test
npm run check

在本地运行所有内容

在两个终端中使用相同的本地密钥。该密钥不会被提交。

终端 1 — 启动经过身份验证的 HTTP 服务器:

export MCP_KEY="$(openssl rand -hex 32)"
echo "$MCP_KEY"   # copy this value for terminal 2
npm run server:http

终端 2 — 确保 Ollama 正在运行,然后启动代理:

export MCP_KEY="paste-the-same-value"
ollama serve      # omit if Ollama is already running

在另一个终端中,运行:

export MCP_KEY="paste-the-same-value"
npm run agent

尝试以下请求:

Add "finish MCP homework" using the stdio todo server.
Add "record the demo" using the HTTP todo server.
Standup time — what should I work on today?

最后一个请求应触发 use_skill("daily-plan"),然后调用两个 MCP 服务器并返回今日、稍后和阻碍项。

使用 MCP Inspector 进行测试

Stdio:

npx @modelcontextprotocol/inspector node src/servers/stdio.js

HTTP:

export MCP_KEY="a-local-test-key"
npm run server:http
npx @modelcontextprotocol/inspector

在 Inspector 中,选择 Streamable HTTP,使用 http://127.0.0.1:3000/mcp,并添加标头 Authorization: Bearer a-local-test-key。验证:

  1. add_task、list_tasks 和 complete_task 已列出且可调用。

  2. 可以读取 todo://list。

  3. 可以加载 plan_my_day。

  4. 完成未知 ID 会返回 isError: true。

项目结构

config.json                 agent/model/server configuration
skills/daily-plan/SKILL.md on-demand workflow
src/agent/                  MCP host, Ollama loop, and skill loader
src/todo/                   shared todo domain and MCP capabilities
src/servers/stdio.js        stdio entry point
src/servers/http.js         Streamable HTTP entry point
test/                       unit and protocol integration tests

评分依据

要求

证据

代理主机

src/agent、config.json;合并并路由带前缀的工具

stdio 服务器

src/servers/stdio.js;3 个工具 + 资源 + 提示

本地 HTTP

src/servers/http.js;Streamable HTTP + 健康检查 + Bearer 认证

代理中的技能

skills/daily-plan/SKILL.md;先索引,后由 use_skill 加载

错误处理

Zod 验证、isError、有界代理循环、稳定的 HTTP 错误

测试

npm test 端到端测试仓库和两种 MCP 传输协议

演示与提交清单

对于简短的 YouTube 演示:

  1. 展示 npm test 通过。

  2. 在 Inspector 中展示 stdio 服务器:工具、资源和提示。

  3. 展示 HTTP 服务器在没有密钥时返回 401,然后使用密钥连接。

  4. 在代理中,通过每个服务器添加一个任务。

  5. 询问“站会时间”,展示自动技能加载以及对两个服务器的调用。

  6. 简要打开 config.json 和 SKILL.md,解释路由机制。

在 Moodle 上提交 YouTube 链接和源代码。如果后续部署,还需提交公共 /mcp URL 和临时评分员密钥。

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    A local-stdio MCP server for a single personal Todoist account with env-gated read-only mode and prompt-injection mitigations.
    221 npm
    MIT
  • F
    license
    A
    quality
    B
    maintenance
    MCP server for Personal OS API that enables managing tasks, notes, projects, collections, reviews, and more through typed tools over stdio.
    66
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    A Model Context Protocol server that provides todo management via stdio, local HTTP, and public HTTPS transports, enabling agents to add, list, and complete tasks, and includes a daily standup skill.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    A demo MCP server exposing an in-memory todo list via tools (add_task, list_tasks, complete_task), a resource, and a prompt, over both stdio and HTTP transports.
    1 npm
    ISC