native-mcp
Skill221 starsChanged 5 months agoApache-2.0View on GitHub
Built-in MCP (Model Context Protocol) client that connects to external
- Reads credentials
- Installs packages
7 other projects use a version of this, 6 of them edited.
Adopted by
Most recently taken up by
- abduznik/abduznik-skillsedited, first seen Sep 7, 2026
- 2867203296/hermes-agentedited, first seen Aug 19, 2026
- wm2313/my-skillsedited, first seen Jul 2, 2026
- Martin-Hausleitner/martins-awesome-skillsedited, first seen May 24, 2026
- kevinnft/ai-agent-skillsedited, first seen May 12, 2026
- braxtonROSE4/zorro-agentedited, first seen Apr 13, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 6
- kevinnft/ai-agent-skills★ 1373% same
- braxtonROSE4/zorro-agent★ 984% same
- Martin-Hausleitner/martins-awesome-skills★ 484% same
- abduznik/abduznik-skills★ 283% same
- 2867203296/hermes-agent★ 061% same
- wm2313/my-skills★ 083% same
Wrote their own version · 1
- AlexAI-MCP/hermes-CCC★ 135same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository57 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apple-notesSkill
- apple-remindersSkill
- findmySkill
- imessageSkill
- claude-codeSkill
- codexSkill
- opencodeSkill
- ascii-artSkill
- ascii-videoSkill
- creative-ideationSkill
- excalidrawSkill
- manim-videoSkill
- p5jsSkill
- popular-web-designsSkill
- songwriting-and-ai-musicSkill
- jupyter-live-kernelSkill
- webhook-subscriptionsSkill
- dogfoodSkill
- himalayaSkill
- minecraft-modpack-serverSkill
- pokemon-playerSkill
- codebase-inspectionSkill
- github-authSkill
- github-code-reviewSkill
- github-issuesSkill
- github-pr-workflowSkill
- github-repo-managementSkill
- kheish-daemon-live-validationSkill
- find-nearbySkill
- mcporterSkill
- gif-searchSkill
- heartmulaSkill
- songseeSkill
- youtube-contentSkill
- huggingface-hubSkill
- obsidianSkill
- google-workspaceSkill
- linearSkill
- nano-pdfSkill
- notionSkill
- ocr-and-documentsSkill
- powerpointSkill
- godmodeSkill
- arxivSkill
- blogwatcherSkill
- llm-wikiSkill
- polymarketSkill
- research-paper-writingSkill
- openhueSkill
- xitterSkill
- planSkill
- requesting-code-reviewSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- writing-plansSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. 7 are common, 3 are distinctive, and 8 are very specific to this project.
7
Common
Most of the 7 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
When the original instructions refer to legacy tool names, use these Kheish mappings:
- Very specific: line 29
When the instructions mention local helper files, resolve them from ${KHEISH_SKILL_DIR}.
- Common: line 39
Use this whenever you want to:
- Common: line 41
Add external capabilities (filesystem access, GitHub, databases, APIs) via MCP
- Common: line 42
Run local stdio-based MCP servers (npx, uvx, or any command)
- Distinctive: line 64
Create an MCP config file for the daemon:
- Distinctive: line 72
Start the daemon with that config:
- Distinctive: line 84
Verify the result with:
- Very specific: line 137
When Kheish starts, discover_mcp_tools() is called during tool initialization:
- Very specific: line 161
After discovery, MCP tools are made available to Kheish runtime profiles, but the effective session/persona capability scope can still …
- Common: line 169
If a connection drops, automatic reconnection with exponential backoff kicks in (up to 5 retries, max 60s backoff)
- Very specific: line 203
If HTTP support is not available in your installed mcp version, the server will fail with an ImportError and other servers will continue …
- Very specific: line 214
All other environment variables (API keys, tokens, secrets) are excluded unless you explicitly add them via the env config key.
- Common: line 228
If an MCP tool call fails, any credential-like patterns in the error message are automatically redacted before being shown to the LLM.
- Very specific: line 267
Check that the server is listed under mcp_servers (not mcp or servers)
- Common: line 268
Ensure the YAML indentation is correct
- Very specific: line 269
Look at Kheish startup logs for connection messages
- Common: line 353
All tools from all servers are registered and available simultaneously.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Kheish Compatibility
This skill is repo-local and stays inactive until explicitly activated.
When the original instructions refer to legacy tool names, use these Kheish mappings:
terminal=>bashweb_extract=>web_fetch, plusweb_searchwhen discovery is neededsearch_files=>grep_searchandglob_searchbrowser_*tools require a browser-capable surfaced tool or MCP; if none is available, use the closest available surface and say so explicitly
When the instructions mention local helper files, resolve them from ${KHEISH_SKILL_DIR}.
Native MCP Client
Kheish has a built-in MCP client in the daemon. It connects to MCP servers at daemon startup, discovers their tools, and surfaces them as first-class runtime tools when the current session is allowed to see them.
When to Use
Use this whenever you want to:
- Connect to MCP servers and use their tools from within Kheish
- Add external capabilities (filesystem access, GitHub, databases, APIs) via MCP
- Run local stdio-based MCP servers (npx, uvx, or any command)
- Connect to remote HTTP/StreamableHTTP MCP servers
- Have MCP tools discovered by the daemon and exposed to sessions that are allowed to use them
For ad-hoc, one-off MCP tool calls from the terminal without configuring anything, see the mcporter skill instead.
Prerequisites
- mcp Python package -- optional dependency; install with
pip install mcp. If not installed, MCP support is silently disabled. - Node.js -- required for
npx-based MCP servers (most community servers) - uv -- required for
uvx-based MCP servers (Python-based servers)
Install the MCP SDK:
pip install mcp
# or, if using uv:
uv pip install mcpQuick Start
Create an MCP config file for the daemon:
[mcp_servers.time]
command = "uvx"
args = ["mcp-server-time"]Start the daemon with that config:
kheish-daemon serve --mcp-config ./mcp-config.tomlOn startup the daemon will:
- Connect to the server
- Discover available tools
- Register them with the prefix
mcp__time__* - Expose them to sessions whose effective capability scope allows them
Verify the result with:
kheish-daemon runtime getConfiguration Reference
Each entry under mcp_servers is a server name mapped to its config. There are two transport types: stdio (command-based) and HTTP (url-based).
Stdio Transport (command + args)
mcp_servers:
server_name:
command: "npx" # (required) executable to run
args: ["-y", "pkg-name"] # (optional) command arguments, default: []
env: # (optional) environment variables for the subprocess
SOME_API_KEY: "value"
timeout: 120 # (optional) per-tool-call timeout in seconds, default: 120
connect_timeout: 60 # (optional) initial connection timeout in seconds, default: 60HTTP Transport (url)
mcp_servers:
server_name:
url: "https://my-server.example.com/mcp" # (required) server URL
headers: # (optional) HTTP headers
Authorization: "Bearer <api_token>"
timeout: 180 # (optional) per-tool-call timeout in seconds, default: 120
connect_timeout: 60 # (optional) initial connection timeout in seconds, default: 60All Config Options
| Option | Type | Default | Description |
command | string | -- | Executable to run (stdio transport, required) |
args | list | [] | Arguments passed to the command |
env | dict | {} | Extra environment variables for the subprocess |
url | string | -- | Server URL (HTTP transport, required) |
headers | dict | {} | HTTP headers sent with every request |
timeout | int | 120 | Per-tool-call timeout in seconds |
connect_timeout | int | 60 | Timeout for initial connection and discovery |
Note: A server config must have either command (stdio) or url (HTTP), not both.
How It Works
Startup Discovery
When Kheish starts, discover_mcp_tools() is called during tool initialization:
- Reads
mcp_serversfrom~/.kheish/config.yaml - For each server, spawns a connection in a dedicated background event loop
- Initializes the MCP session and calls
list_tools()to discover available tools - Registers each tool in the Kheish tool registry
Tool Naming Convention
MCP tools are registered with the naming pattern:
mcp_{server_name}_{tool_name}Hyphens and dots in names are replaced with underscores for LLM API compatibility.
Examples:
- Server
filesystem, toolread_file→mcp_filesystem_read_file - Server
github, toollist-issues→mcp_github_list_issues - Server
my-api, toolfetch.data→mcp_my_api_fetch_data
Auto-Injection
After discovery, MCP tools are made available to Kheish runtime profiles, but the effective session/persona capability scope can still filter individual servers or tools. Do not assume every conversation sees the full MCP surface.
Connection Lifecycle
- Each server runs as a long-lived asyncio Task in a background daemon thread
- Connections persist for the lifetime of the agent process
- If a connection drops, automatic reconnection with exponential backoff kicks in (up to 5 retries, max 60s backoff)
- On agent shutdown, all connections are gracefully closed
Idempotency
discover_mcp_tools() is idempotent -- calling it multiple times only connects to servers that aren't already connected. Failed servers are retried on subsequent calls.
Transport Types
Stdio Transport
The most common transport. Kheish launches the MCP server as a subprocess and communicates over stdin/stdout.
mcp_servers:
filesystem:
command: "npx"
args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/projects"]The subprocess inherits a filtered environment (see Security section below) plus any variables you specify in env.
HTTP / StreamableHTTP Transport
For remote or shared MCP servers. Requires the mcp package to include HTTP client support (mcp.client.streamable_http).
mcp_servers:
remote_api:
url: "https://mcp.example.com/mcp"
headers:
Authorization: "Bearer <api_token>"If HTTP support is not available in your installed mcp version, the server will fail with an ImportError and other servers will continue normally.
Security
Environment Variable Filtering
For stdio servers, Kheish does NOT pass your full shell environment to MCP subprocesses. Only safe baseline variables are inherited:
PATH,HOME,USER,LANG,LC_ALL,TERM,SHELL,TMPDIR- Any
XDG_*variables
All other environment variables (API keys, tokens, secrets) are excluded unless you explicitly add them via the env config key. This prevents accidental credential leakage to untrusted MCP servers.
mcp_servers:
github:
command: "npx"
args: ["-y", "@modelcontextprotocol/server-github"]
env:
# Only this token is passed to the subprocess
GITHUB_PERSONAL_ACCESS_TOKEN: "<github_personal_access_token>"Credential Stripping in Error Messages
If an MCP tool call fails, any credential-like patterns in the error message are automatically redacted before being shown to the LLM. This covers:
- GitHub PATs
- OpenAI-style keys (
sk-...) - Bearer tokens
- Generic
token=,key=,API_KEY=,password=,secret=patterns
Troubleshooting
"MCP SDK not available -- skipping MCP tool discovery"
The mcp Python package is not installed. Install it:
pip install mcp"No MCP servers configured"
No mcp_servers key in ~/.kheish/config.yaml, or it's empty. Add at least one server.
"Failed to connect to MCP server 'X'"
Common causes:
- Command not found: The
commandbinary isn't on PATH. Ensurenpx,uvx, or the relevant command is installed. - Package not found: For npx servers, the npm package may not exist or may need
-yin args to auto-install. - Timeout: The server took too long to start. Increase
connect_timeout. - Port conflict: For HTTP servers, the URL may be unreachable.
"MCP server 'X' requires HTTP transport but mcp.client.streamable_http is not available"
Your mcp package version doesn't include HTTP client support. Upgrade:
pip install --upgrade mcpTools not appearing
- Check that the server is listed under
mcp_servers(notmcporservers) - Ensure the YAML indentation is correct
- Look at Kheish startup logs for connection messages
- Tool names are prefixed with
mcp_{server}_{tool}-- look for that pattern
Connection keeps dropping
The client retries up to 5 times with exponential backoff (1s, 2s, 4s, 8s, 16s, capped at 60s). If the server is fundamentally unreachable, it gives up after 5 attempts. Check the server process and network connectivity.
Examples
Time Server (uvx)
mcp_servers:
time:
command: "uvx"
args: ["mcp-server-time"]Registers tools like mcp_time_get_current_time.
Filesystem Server (npx)
mcp_servers:
filesystem:
command: "npx"
args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/documents"]
timeout: 30Registers tools like mcp_filesystem_read_file, mcp_filesystem_write_file, mcp_filesystem_list_directory.
GitHub Server with Authentication
mcp_servers:
github:
command: "npx"
args: ["-y", "@modelcontextprotocol/server-github"]
env:
GITHUB_PERSONAL_ACCESS_TOKEN: "<github_personal_access_token>"
timeout: 60Registers tools like mcp_github_list_issues, mcp_github_create_pull_request, etc.
Remote HTTP Server
mcp_servers:
company_api:
url: "https://mcp.mycompany.com/v1/mcp"
headers:
Authorization: "Bearer <api_token>"
X-Team-Id: "engineering"
timeout: 180
connect_timeout: 30Multiple Servers
mcp_servers:
time:
command: "uvx"
args: ["mcp-server-time"]
filesystem:
command: "npx"
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
github:
command: "npx"
args: ["-y", "@modelcontextprotocol/server-github"]
env:
GITHUB_PERSONAL_ACCESS_TOKEN: "<github_personal_access_token>"
company_api:
url: "https://mcp.internal.company.com/mcp"
headers:
Authorization: "Bearer <api_token>"
timeout: 300All tools from all servers are registered and available simultaneously. Each server's tools are prefixed with its name to avoid collisions.
Sampling (Server-Initiated LLM Requests)
Kheish supports MCP's sampling/createMessage capability — MCP servers can request LLM completions through the agent during tool execution. This enables agent-in-the-loop workflows (data analysis, content generation, decision-making).
Sampling is enabled by default. Configure per server:
mcp_servers:
my_server:
command: "npx"
args: ["-y", "my-mcp-server"]
sampling:
enabled: true # default: true
model: "gemini-3-flash" # model override (optional)
max_tokens_cap: 4096 # max tokens per request
timeout: 30 # LLM call timeout (seconds)
max_rpm: 10 # max requests per minute
allowed_models: [] # model whitelist (empty = all)
max_tool_rounds: 5 # tool loop limit (0 = disable)
log_level: "info" # audit verbosityServers can also include tools in sampling requests for multi-turn tool-augmented workflows. The max_tool_rounds config prevents infinite tool loops. Per-server audit metrics (requests, errors, tokens, tool use count) are tracked via get_mcp_status().
Disable sampling for untrusted servers with sampling: { enabled: false }.
Notes
- MCP tools are called synchronously from the agent's perspective but run asynchronously on a dedicated background event loop
- Tool results are returned as JSON with either
{"result": "..."}or{"error": "..."} - The native MCP client is independent of
mcporter-- you can use both simultaneously - Server connections are persistent and shared across all conversations in the same agent process
- Adding or removing servers requires restarting the agent (no hot-reload currently)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

