الأكاديمية ← أدلة تطبيقيةتوثيق رسمي · إرشاد عربي

استخدام MCP مع Hermes

Use MCP with Hermes

متوسط10 دقائق قراءةالدرس 73 أسئلة✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

MCP: طريقة موحّدة تسمح لـHermes أن يستعمل أدوات برامج أخرى، من دون أن يكتب أحد كودًا خاصًا لكل برنامج. بدلًا من انتظار دعم رسمي لكل خدمة تحبها، تشغّل «خادم MCP» جاهزًا فيصبح Hermes قادرًا على استخدامها فورًا. ستستعمل هنا hermes chat وhermes mcp add، والقراءة نحو 10 دقائق. انتبه: أي خادم MCP تضيفه يرى بياناتك ويستطيع التصرّف نيابةً عنك. شغّل ما تعرف مصدره، وابدأ بأقل الأدوات.

14أقسام
37أمثلة برمجية
0جداول
7أوامر
1,737كلمة من المصدر
الوصف الرسمي في سطر

A practical guide to connecting MCP servers to Hermes Agent, filtering their tools, and using them safely in real workflows

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما MCP ولماذا قد تحتاجه.
  • تنفّذ hermes chat وhermes mcp add وتفهم ما يحدث بعدها.
  • تضبط GITHUB_PERSONAL_ACCESS_TOKEN في المكان الصحيح.
ما ستقابله من أسماء

كما تظهر تمامًا داخل Hermes.

الأوامر
  • hermes chat
  • hermes mcp add
  • hermes uv pip install
  • hermes mcp add open_scaffold
  • hermes mcp test open_scaffold
  • hermes mcp add chrome-devtools-win
  • hermes mcp test chrome-devtools-win
متغيرات البيئة
  • GITHUB_PERSONAL_ACCESS_TOKEN
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01When should you use MCP?
  2. 02Mental model
  3. 03Step 1: install MCP support
  4. 04Step 2: add one server first
  5. 05Step 3: verify MCP loaded
  6. 06Step 4: start filtering immediately
  7. 07WSL2: bridge Hermes in WSL to Windows Chrome
  8. 08What does filtering actually affect?
  9. 09Common patterns
  10. 10Tutorial: end-to-end setup with filtering
  11. 11Safe usage recommendations
  12. 12Troubleshooting by symptom
  13. 13Recommended first MCP setups
  14. 14Related docs
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

This guide shows how to actually use MCP with Hermes Agent in day-to-day workflows.

If the feature page explains what MCP is, this guide is about how to get value from it quickly and safely.

When should you use MCP?

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: طريقة موحّدة تسمح لـHermes أن يستعمل أدوات برامج أخرى، من دون أن يكتب أحد كودًا خاصًا لكل برنامج.

Use MCP when:

  • a tool already exists in MCP form and you do not want to build a native Hermes tool
  • you want Hermes to operate against a local or remote system through a clean RPC layer
  • you want fine-grained per-server exposure control
  • you want to connect Hermes to internal APIs, databases, or company systems without modifying Hermes core

Do not use MCP when:

  • a built-in Hermes tool already solves the job well
  • the server exposes a huge dangerous tool surface and you are not prepared to filter it
  • you only need one very narrow integration and a native tool would be simpler and safer

Mental model

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

Think of MCP as an adapter layer:

  • Hermes remains the agent
  • MCP servers contribute tools
  • Hermes discovers those tools at startup or reload time
  • the model can use them like normal tools
  • you control how much of each server is visible

That last part matters. Good MCP usage is not just “connect everything.” It is “connect the right thing, with the smallest useful surface.”

Step 1: install MCP support

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes uv pip install.

If you installed Hermes with the standard install script, MCP support is already included (the installer runs uv pip install -e ".[all]").

If you installed without extras and need to add MCP separately:

Shellسطران
cd ~/.hermes/hermes-agent
uv pip install -e ".[mcp]"

For npm-based servers, make sure Node.js and npx are available.

For many Python MCP servers, uvx is a nice default.

Step 2: add one server first

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes chat.

Start with a single, safe server.

Example: filesystem access to one project directory only.

YAML4 أسطر
mcp_servers:
  project_fs:
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/my-project"]

Then start Hermes:

Shellسطر واحد
hermes chat

Now ask something concrete:

Textسطر واحد
Inspect this project and summarize the repo layout.

Step 3: verify MCP loaded

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

You can verify MCP in a few ways:

  • Hermes banner/status should show MCP integration when configured
  • ask Hermes what tools it has available
  • use /reload-mcp after config changes
  • check logs if the server failed to connect

A practical test prompt:

Textسطر واحد
Tell me which MCP-backed tools are available right now.

Step 4: start filtering immediately

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

Do not wait until later if the server exposes a lot of tools.

Example: whitelist only what you want

YAML8 أسطر
mcp_servers:
  github:
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-github"]
    env:
      GITHUB_PERSONAL_ACCESS_TOKEN: "***"
    tools:
      include: [list_issues, create_issue, search_code]

This is usually the best default for sensitive systems.

WSL2: bridge Hermes in WSL to Windows Chrome

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. الأوامر هنا: hermes mcp add chrome-devtools-win، hermes mcp test chrome-devtools-win.

This is the practical setup when:

  • Hermes runs inside WSL2
  • the browser you want to control is your normal signed-in Chrome on Windows
  • /browser connect is awkward or unreliable from WSL

In this setup, Hermes does not connect to Chrome directly. Instead:

  • Hermes runs in WSL
  • Hermes starts a local stdio MCP server
  • that MCP server is launched through Windows interop (cmd.exe or powershell.exe)
  • the MCP server attaches to your live Windows Chrome session

Mental model:

Textسطر واحد
Hermes (WSL) -> MCP stdio bridge -> Windows Chrome

Why this mode is useful

  • you keep your real Windows browser profile, cookies, and logins
  • Hermes stays in its supported Unix environment (WSL2)
  • browser control is exposed as MCP tools instead of relying on Hermes core browser transport

Use chrome-devtools-mcp.

If your Windows Chrome already has live remote debugging enabled from chrome://inspect/#remote-debugging, add it like this from WSL:

Shellسطر واحد
hermes mcp add chrome-devtools-win --command cmd.exe --args /c npx -y chrome-devtools-mcp@latest --autoConnect --no-usage-statistics

After saving the server:

Shellسطر واحد
hermes mcp test chrome-devtools-win

Then start a fresh Hermes session or run:

Textسطر واحد
/reload-mcp

Typical prompt

Once loaded, Hermes can use the MCP-prefixed browser tools directly. For example:

Textسطر واحد
调用 MCP 工具 mcp_chrome_devtools_win_list_pages,列出当前浏览器标签页。

When /browser connect is the wrong tool

If Hermes runs in WSL and Chrome runs on Windows, /browser connect may fail even though Chrome is open and debuggable.

Common reasons:

  • WSL cannot reach the same host-local endpoint Chrome exposes to Windows tools
  • newer Chrome live-debugging flows are not the same as a classic ws://localhost:9222
  • the browser is easier to attach to from a Windows-side helper like chrome-devtools-mcp

In those cases, keep /browser connect for same-environment setups and use MCP for WSL-to-Windows browser bridging.

Known pitfalls

  • Start Hermes from a Windows-mounted path like /mnt/c/Users/<you> or /mnt/c/workspace/... when using Windows stdio executables through MCP.
  • If you start Hermes from /root or /home/..., Windows may emit a UNC current-directory warning before the MCP server starts.
  • If chrome-devtools-mcp --autoConnect times out while enumerating pages, reduce background/frozen tabs in Chrome and retry.

Example: blacklist dangerous actions

YAML7 أسطر
mcp_servers:
  stripe:
    url: "https://mcp.stripe.com"
    headers:
      Authorization: "Bearer ***"
    tools:
      exclude: [delete_customer, refund_payment]

Example: disable utility wrappers too

YAML6 أسطر
mcp_servers:
  docs:
    url: "https://mcp.docs.example.com"
    tools:
      prompts: false
      resources: false

What does filtering actually affect?

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

There are two categories of MCP-exposed functionality in Hermes:

  1. Server-native MCP tools
  2. filtered with:
  3. tools.include
  4. tools.exclude
  1. Hermes-added utility wrappers
  2. filtered with:
  3. tools.resources
  4. tools.prompts

Utility wrappers you may see

Resources:

  • list_resources
  • read_resource

Prompts:

  • list_prompts
  • get_prompt

These wrappers only appear if:

  • your config allows them, and
  • the MCP server session actually supports those capabilities

So Hermes will not pretend a server has resources/prompts if it does not.

Common patterns

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. الأوامر هنا: hermes mcp add، hermes mcp add open_scaffold. تضبط GITHUB_PERSONAL_ACCESS_TOKEN خارج المحادثة، في بيئة التشغيل.

Pattern 1: local project assistant

Use MCP for a repo-local filesystem or git server when you want Hermes to reason over a bounded workspace.

YAML8 أسطر
mcp_servers:
  fs:
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/project"]

  git:
    command: "uvx"
    args: ["mcp-server-git", "--repository", "/home/user/project"]

Good prompts:

Textسطر واحد
Review the project structure and identify where configuration lives.
Textسطر واحد
Check the local git state and summarize what changed recently.

Pattern 2: repo-native work record with Open Scaffold

Use Open Scaffold ↗ when you want Hermes to read a repository's durable AI-work record: mission, plans, evidence notes, handoff packets, and review/gate results. Hermes remains the agent; Open Scaffold remains the repo-local record.

Add the server for one scaffolded repository:

Shellسطران
hermes mcp add open_scaffold --command npx --args -y open-scaffold@latest mcp serve --repo /absolute/path/to/repo
hermes mcp test open_scaffold

Then keep the exposed surface read-oriented. Choose select in the hermes mcp add prompt, or edit config.yaml afterward:

YAML18 سطرًا
mcp_servers:
  open_scaffold:
    command: "npx"
    args: ["-y", "open-scaffold@latest", "mcp", "serve", "--repo", "/absolute/path/to/repo"]
    tools:
      include:
        - list_plans
        - get_plan
        - get_mission
        - list_evidence
        - get_evidence
        - get_status
        - search_plans
        - list_amendments
        - get_handoff
        - analyze_loop
        - gate_loop
      prompts: false

Good prompts:

Textسطر واحد
Use the Open Scaffold MCP tools to compile the current handoff packet and tell me the next legal action.
Textسطر واحد
Inspect the active plans and evidence notes, then say whether this repo is ready for human review or needs another attempt.

Boundary notes:

  • Open Scaffold MCP is local-first and read-only by default.
  • Its write tools require the server to be started with --allow-write; do not enable that until you explicitly want Hermes to mutate .osc files.
  • Open Scaffold records and gates work; it does not authorize Hermes to merge, publish, deploy, or spawn runtimes.
  • Pin open-scaffold@<version> instead of @latest if you need reproducible tool schemas.

Pattern 3: GitHub triage assistant

YAML10 أسطر
mcp_servers:
  github:
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-github"]
    env:
      GITHUB_PERSONAL_ACCESS_TOKEN: "***"
    tools:
      include: [list_issues, create_issue, update_issue, search_code]
      prompts: false
      resources: false

Good prompts:

Textسطر واحد
List open issues about MCP, cluster them by theme, and draft a high-quality issue for the most common bug.
Textسطر واحد
Search the repo for uses of _discover_and_register_server and explain how MCP tools are registered.

Pattern 4: internal API assistant

YAML9 أسطر
mcp_servers:
  internal_api:
    url: "https://mcp.internal.example.com"
    headers:
      Authorization: "Bearer ***"
    tools:
      include: [list_customers, get_customer, list_invoices]
      resources: false
      prompts: false

Good prompts:

Textسطر واحد
Look up customer ACME Corp and summarize recent invoice activity.

This is the sort of place where a strict whitelist is far better than an exclude list.

Pattern 4: documentation / knowledge servers

Some MCP servers expose prompts or resources that are more like shared knowledge assets than direct actions.

YAML6 أسطر
mcp_servers:
  docs:
    url: "https://mcp.docs.example.com"
    tools:
      prompts: true
      resources: true

Good prompts:

Textسطر واحد
List available MCP resources from the docs server, then read the onboarding guide and summarize it.
Textسطر واحد
List prompts exposed by the docs server and tell me which ones would help with incident response.

Tutorial: end-to-end setup with filtering

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

Here is a practical progression.

Phase 1: add GitHub MCP with a tight whitelist

YAML10 أسطر
mcp_servers:
  github:
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-github"]
    env:
      GITHUB_PERSONAL_ACCESS_TOKEN: "***"
    tools:
      include: [list_issues, create_issue, search_code]
      prompts: false
      resources: false

Start Hermes and ask:

Textسطر واحد
Search the codebase for references to MCP and summarize the main integration points.

Phase 2: expand only when needed

If you later need issue updates too:

YAMLسطران
tools:
  include: [list_issues, create_issue, update_issue, search_code]

Then reload:

Textسطر واحد
/reload-mcp

Phase 3: add a second server with different policy

YAML14 سطرًا
mcp_servers:
  github:
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-github"]
    env:
      GITHUB_PERSONAL_ACCESS_TOKEN: "***"
    tools:
      include: [list_issues, create_issue, update_issue, search_code]
      prompts: false
      resources: false

  filesystem:
    command: "npx"
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/project"]

Now Hermes can combine them:

Textسطر واحد
Inspect the local project files, then create a GitHub issue summarizing the bug you find.

That is where MCP gets powerful: multi-system workflows without changing Hermes core.

Safe usage recommendations

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير.

Prefer allowlists for dangerous systems

For anything financial, customer-facing, or destructive:

  • use tools.include
  • start with the smallest set possible

Disable unused utilities

If you do not want the model browsing server-provided resources/prompts, turn them off:

YAML3 أسطر
tools:
  resources: false
  prompts: false

Keep servers scoped narrowly

Examples:

  • filesystem server rooted to one project dir, not your whole home directory
  • git server pointed at one repo
  • internal API server with read-heavy tool exposure by default

Reload after config changes

Textسطر واحد
/reload-mcp

Do this after changing:

  • include/exclude lists
  • enabled flags
  • resources/prompts toggles
  • auth headers / env

Troubleshooting by symptom

قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا.

"The server connects but the tools I expected are missing"

Possible causes:

  • filtered by tools.include
  • excluded by tools.exclude
  • utility wrappers disabled via resources: false or prompts: false
  • server does not actually support resources/prompts

"The server is configured but nothing loads"

Check:

  • enabled: false was not left in config
  • command/runtime exists (npx, uvx, etc.)
  • HTTP endpoint is reachable
  • auth env or headers are correct

"Why do I see fewer tools than the MCP server advertises?"

Because Hermes now respects your per-server policy and capability-aware registration. That is expected, and usually desirable.

"How do I remove an MCP server without deleting the config?"

Use:

YAMLسطر واحد
enabled: false

That keeps the config around but prevents connection and registration.

اختبار الفهم

3 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. أي متغير بيئة من التالي يظهر فعليًا في هذا الدرس؟
2. أي عنوان من التالي لا يظهر في هذا الدرس؟
3. أي مفتاح إعداد يظهر في أمثلة هذا الدرس؟