OpenWork MCP Gateway
Your OpenWork org's skills, plugins, workflows, and connections through one OAuth MCP URL.
DIdifferent-ai/openwork25k近 7 天新增 46 个 star
An Mcp client inside Emacs
#+TITLE: MCP.el - Model Context Protocol for Emacs
[[https://melpa.org/#/mcp][file:https://melpa.org/packages/mcp-badge.svg]] [[https://www.gnu.org/licenses/gpl-3.0][https://img.shields.io/badge/License-GPLv3-blue.svg]]
This is an Emacs client for interfacing with [[https://modelcontextprotocol.io/introduction][MCP]], supporting connections to MCP servers.
#+html:
*** Keymap | key | function | description | |-----+----------------------------+-----------------------------------------| | l | mcp-hub-view-log | View server logs | | s | mcp-hub-start-server | Start server under cursor | | k | mcp-hub-close-server | Stop server under cursor | | r | mcp-hub-restart-server | Restart server under cursor | | S | mcp-hub-start-all-server | Start all configured servers | | R | mcp-hub-restart-all-server | Restart all configured servers | | K | mcp-hub-close-all-server | Stop all running servers | | + | mcp-hub-add-root | Add root directory to server | | - | mcp-hub-remove-root | Remove root directory from server | | = | mcp-hub-view-roots | View server's root directories | *** use with [[https://github.com/karthink/gptel][gptel]]
#+begin_src elisp (mcp-connect-server "filesystem" :command "npx" :args '("-y" "@modelcontextprotocol/server-filesystem") :roots '("/home/user/project1" "/home/user/project2")) #+end_src
You can also dynamically manage roots after the server is connected:
#+begin_src elisp ;; Add a new root directory (mcp-add-root "filesystem" "/home/user/new-project")
;; Remove a root directory (mcp-remove-root "filesystem" "/home/user/old-project")
;; Replace all roots (mcp-set-roots "filesystem" '("/home/user/project1" "/home/user/project2"))
;; View current roots (mcp-get-roots "filesystem") #+end_src
Roots can also be specified as plists with additional metadata: #+begin_src elisp (mcp-connect-server "filesystem" :command "npx" :args '("-y" "@modelcontextprotocol/server-filesystem") :roots '((:uri "file:///home/user/project" :name "My Project") "/home/user/downloads")) #+end_src *** Define the use of tools. The current text is being tested using the [[https://github.com/karthink/gptel/issues/514][gptel tool]] branch.Use =mcp-make-text-tool= to create standard tool call data ([[https://github.com/ahyatt/llm/discussions/124][Discussions]]).It is recommended to create tools within the tools-callback or wait for the mcp connect server to complete. #+begin_src elisp (mcp-make-text-tool "filesystem" "write_file") #+end_src This will generate a data structure where the function is an auto-generated synchronous or asynchronous lambda function for accessing the MCP server. #+begin_src elisp (list :function #'(lambda (&rest args) ;; Synchronous or asynchronous access to the MCP server's Lambda function. ) :name "write_file" :async nil :description "Create a new file or completely overwrite an existing file with new content. Use with caution as it will overwrite existing files without warning. Handles text content with proper encoding. Only works within allowed directories." :args ((:type "string" :name "path" :description "path") (:type "string" :name "content" :description "content")) :category "files") #+end_src *** Disconnect from the server. #+begin_src elisp (mcp-stop-server "filesystem") #+end_src *** Manual function call **** Synchronize #+begin_src elisp (let ((connection (gethash "filesystem" mcp-server-connections))) (mcp-call-tool connection "write_file" '(:path "filename or file path" :content "the file content"))) #+end_src **** Asynchronous #+begin_src elisp (let ((connection (gethash "filesystem" mcp-server-connections))) (mcp-async-call-tool connection "write_file" '(:path "filename or file path" :content "the file content") #'(lambda (res) ;; handle res (mcp--parse-tool-call-result res)) #'(lambda (code message) ;; handle error (format "call %s tool error with %s: %s" tool-name code message)))) #+end_src *** Manual get prompt Since the [[https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem][filesystem]] lacks prompts, the [[https://github.com/modelcontextprotocol/servers/tree/main/src/everything][everything]] server is used for demonstration. **** Synchronize #+begin_src elisp (let ((connection (gethash "everything" mcp-server-connections))) (mcp-get-prompt connection "complex_prompt" '(:temperature "1.0"))) #+end_src **** Asynchronous #+begin_src elisp (let ((connection (gethash "everything" mcp-server-connections))) (mcp-async-get-prompt connection "complex_prompt" '(:temperature "1.0") #'(lambda (res) (message "prompt: %s" res)) #'(lambda (code message) (message "error call: %s, %s" code message)))) #+end_src *** Manual get resources Since the [[https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem][filesystem]] lacks resources, the [[https://github.com/modelcontextprotocol/servers/tree/main/src/everything][everything]] server is used for demonstration. **** Synchronize #+begin_src elisp (let ((connection (gethash "everything" mcp-server-connections))) (mcp-read-resource connection "test://static/resource/1")) #+end_src **** Asynchronous #+begin_src elisp (let ((connection (gethash "everything" mcp-server-connections))) (mcp-async-read-resource connection "test://static/resource/1" #'(lambda (resource) (message "res: %s" resource)))) #+end_src *** Get resource templates Since the [[https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem][filesystem]] lacks resources, the [[https://github.com/modelcontextprotocol/servers/tree/main/src/everything][everything]] server is used for demonstration. #+begin_src elisp (let ((connection (gethash "everything" mcp-server-connections))) (mcp-async-list-resource-templates connection #'(lambda (connection templates) (message "%s" templates)))) #+end_src
Your OpenWork org's skills, plugins, workflows, and connections through one OAuth MCP URL.
DIdifferent-ai/openwork25k近 7 天新增 46 个 star
Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!
TAtadata-org/fastapi_mcp12k
USDC-gated Base JSON-RPC: free 10 req/min, $0.50 per 10k. Failover, cache, /mcp, ledger.
COConway-Research/automaton8k近 7 天新增 48 个 star
Next Generation Agentic Proxy for AI Agents and MCP servers
AGagentgateway/agentgateway6.5k近 7 天新增 135 个 star