Logo 40ants MCP

40ants MCP

Tổ chức
40ants

40ANTS-MCP is a framework for building Model Context Protocol servers in Common Lisp

Nhà phát hành40ants
Kho mãmcp
Ngôn ngữCommon Lisp
Bản fork
9
Sao
56
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    40ants MCP cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    56 sao và 9 bản fork từ kho mã được liên kết.

40ants-mcp - The framework for building MCP servers and clients in Common Lisp.

40ANTS-MCP ASDF System Details

About

A comprehensive framework for building Model Context Protocol (MCP) servers in Common Lisp. This library provides a complete implementation of the MCP specification with an easy-to-use API for creating servers that can interact with AI assistants like Claude Desktop.

Active development is ongoing and the interface is likely to change.

Features

  • ✅ STDIO Transport: Native support for STDIO-based communication
  • ✅ StreamableHTTP Transport: Allowing to create remotely hosted MCP servers
  • ✅ Tools System: Register and execute custom tools with JSON Schema validation
  • ✅ Built on OpenRPC: Leverages the robust 40ants OpenRPC library
  • ✅ CLOS-based: Object-oriented design with proper encapsulation
  • ✅ Easy Integration: Simple API for adding functionality
  • ✅ Error Handling: Comprehensive error management with proper JSON-RPC error codes
  • ✅ Interactive Editing: MCP tools can be edited and updated on the fly, using REPL driven approach

Roadmap

  • 🔄 Full MCP Specification Support: Complete implementation of MCP protocol version 2025-06-18
  • 🔄 Resources System: Serve dynamic and static resources via URI
  • 🔄 Prompts System: Provide prompt templates with argument interpolation
  • 🔄 MCP Client Protocol: Implement client-side protocol for connecting to MCP servers

Installation

You can install this library from Quicklisp, but you want to receive updates quickly, then install it from Ultralisp.org:

(ql-dist:install-dist "http://dist.ultralisp.org/"
                      :prompt nil)
(ql:quickload :40ants-mcp)

Usage

Here's a quick example of how to create an MCP server with custom tools:

lisp
(defpackage #:my-mcp-server
  (:use #:cl)
  (:import-from #:40ants-mcp/content/text
                #:text-content)
  (:import-from #:openrpc-server))

(in-package #:my-mcp-server)

;; Define your API
(openrpc-server:define-api (my-tools :title "My Custom Tools"))

;; Define a tool that adds two numbers
(40ants-mcp/tools:define-tool (my-tools add) (a b)
  (:summary "Adds two numbers and returns the result.")
  (:param a integer "First number to add.")
  (:param b integer "Second number to add.")
  (:result (soft-list-of text-content))
  (list (make-instance 'text-content
                      :text (format nil "The sum of ~A and ~A is: ~A"
                                  a b (+ a b)))))

;; Start the server
(40ants-mcp/server/definition:start-server my-tools)

Running as a Script

For production use, you can create a Roswell script. Create a file my-mcp.ros:

lisp
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 \"$@\"
|#

(ql:quickload '(:40ants-mcp :alexandria) :silent t)

;; Your package and tool definitions here...

(defun main (&rest argv)
  (declare (ignore argv))
  (40ants-mcp/server/definition:start-server my-tools))

Build and run the script:

bash
# Build the script
ros build my-mcp.ros

# Run the server
./my-mcp

# With remote debugging support
SLYNK_PORT=4005 ./my-mcp

Each tool you define should return a list of content items. The most common content type is text-content, but you can also return other types defined in the MCP specification.

For more examples, check the examples/ directory in the source code.

API

40ANTS-MCP/CONTENT/BASE

package 40ants-mcp/content/base

Classes

CONTENT

class 40ants-mcp/content/base:content ()

Readers

reader 40ants-mcp/content/base:content-type (content) (:TYPE = "unknown")

40ANTS-MCP/CONTENT/TEXT

package 40ants-mcp/content/text

Classes

TEXT-CONTENT

class 40ants-mcp/content/text:text-content (content)

Readers

reader 40ants-mcp/content/text:content-text (text-content) (:text)

40ANTS-MCP/HTTP-TRANSPORT

package 40ants-mcp/http-transport

Classes

HTTP-TRANSPORT

class 40ants-mcp/http-transport:http-transport ()

HTTP transport implementation for MCP (Model Context Protocol) communication. This class handles JSON-RPC message exchange via HTTP POST requests.

Readers

reader 40ants-mcp/http-transport:transport-lack-app (http-transport) ()

Lack application instance

reader 40ants-mcp/http-transport:transport-message-handler (http-transport) ()

Function to handle incoming messages

reader 40ants-mcp/http-transport:transport-port (http-transport) (:port = 8080)

Port number to listen on.

reader 40ants-mcp/http-transport:transport-running-p (http-transport) (= t)

Flag indicating if transport is active

reader 40ants-mcp/http-transport:transport-server (http-transport) ()

Clack server instance

Accessors

accessor 40ants-mcp/http-transport:transport-lack-app (http-transport) ()

Lack application instance

accessor 40ants-mcp/http-transport:transport-message-handler (http-transport) ()

Function to handle incoming messages

accessor 40ants-mcp/http-transport:transport-running-p (http-transport) (= t)

Flag indicating if transport is active

accessor 40ants-mcp/http-transport:transport-server (http-transport) ()

Clack server instance

40ANTS-MCP/SERVER/DEFINITION

package 40ants-mcp/server/definition

Classes

MCP-SERVER

class 40ants-mcp/server/definition:mcp-server (api)

Readers

reader 40ants-mcp/server/definition:server-tools-collections (mcp-server) (collections = nil)

Functions

function 40ants-mcp/server/definition:start-server tools-collections &key (transport :stdio) (port 8080)

Start the MCP server with specified transport. TRANSPORT can be :stdio or :http. PORT is only used when transport is :http.

40ANTS-MCP/SERVER/ERRORS

package 40ants-mcp/server/errors

Classes

TOOL-ERROR

condition 40ants-mcp/server/errors:tool-error ()

You should signal this error in case if the tool can't accomplish it's job.

Readers

reader 40ants-mcp/server/errors:tool-error-content (tool-error) (:content)

40ANTS-MCP/STDIO-TRANSPORT

package 40ants-mcp/stdio-transport

Classes

STDIO-TRANSPORT

class 40ants-mcp/stdio-transport:stdio-transport ()

STDIO transport implementation for MCP (Model Context Protocol) communication. This class handles JSON-RPC message exchange via standard input/output streams. It is designed to work with the MCP protocol specification for AI model communication.

Readers

reader 40ants-mcp/stdio-transport:transport-input (stdio-transport) (:input-stream = *standard-input*)

Input stream for reading JSON-RPC messages. Defaults to standard-input.

reader 40ants-mcp/stdio-transport:transport-output (stdio-transport) (:output-stream = *standard-output*)

Output stream for writing JSON-RPC responses. Defaults to standard-output.

reader 40ants-mcp/stdio-transport:transport-running-p (stdio-transport) (= t)

Flag indicating if transport is active and processing messages.

Accessors

accessor 40ants-mcp/stdio-transport:transport-input (stdio-transport) (:input-stream = *standard-input*)

Input stream for reading JSON-RPC messages. Defaults to standard-input.

accessor 40ants-mcp/stdio-transport:transport-output (stdio-transport) (:output-stream = *standard-output*)

Output stream for writing JSON-RPC responses. Defaults to standard-output.

accessor 40ants-mcp/stdio-transport:transport-running-p (stdio-transport) (= t)

Flag indicating if transport is active and processing messages.

Generics

generic-function 40ants-mcp/transport/base:receive-message transport

Receive a JSON-RPC message, returns a message or NIL.

generic-function 40ants-mcp/transport/base:send-message transport message

Send a JSON-RPC message, returns no values.

40ANTS-MCP/TOOLS

package 40ants-mcp/tools

Macros

macro 40ants-mcp/tools:define-tool name args &body body

40ANTS-MCP/TRANSPORT/BASE

package 40ants-mcp/transport/base

Generics

generic-function 40ants-mcp/transport/base:receive-message transport

Receive a JSON-RPC message, returns a message or NIL.

generic-function 40ants-mcp/transport/base:send-message transport message

Send a JSON-RPC message, returns no values.

generic-function 40ants-mcp/transport/base:start-loop transport message-handler

Starts message processing using given transport.

generic-function 40ants-mcp/transport/base:stop-loop transport

Stops message processing using given transport.


[generated by 40ANTS-DOC]

Dùng MCP 40ants MCP với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối 40ants MCP, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm 40ants MCP làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của 40ants MCP.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "40ants-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của 40ants MCP, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của 40ants MCP.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng 40ants MCP giúp tôi làm việc này không?
40ants MCP
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng 40ants MCP.

Câu hỏi thường gặp

Máy chủ MCP 40ants MCP dùng để làm gì?

40ants MCP là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP 40ants MCP với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng 40ants MCP với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP 40ants MCP với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối 40ants MCP, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP 40ants MCP với TypingMind?

40ants MCP hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP 40ants MCP cung cấp những công cụ nào trong TypingMind?

40ants MCP cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP 40ants MCP không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu 40ants MCP yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇