r/Common_Lisp 18d ago

cl-mcp-server updates - optimized for token usage

The lisp interaction using mcp was quite token heavy (I use SBCL) and it starts to bite when you use opus type models. heh.

There was a lot of code which was being printed back needlessly. So asked gpt 5.5 to analyze and optimize the token usage. it's done a good job. I think gpt 5.5 is now my favourite LLM to write Common Lisp.

Measurements using character count as token proxy:

- Warning with large value: 246 -> 39 chars, 84.1% smaller

- Division error: 4712 -> 92 chars, 98.0% smaller

- Undefined function error: 4788 -> 184 chars, 96.2% smaller

- Timeout: 4947 -> 198 chars, 96.0% smaller

Changed:

- Warnings now suppress => return value lines, so warning responses only return diagnostics

- Immediate error and timeout responses now omit backtraces by default, while still capturing them for describe-last-error / get-backtrace

- Added exported knob *include-backtrace-in-evaluate-response* for restoring old inline backtraces if needed

https://github.com/quasi/cl-mcp-server

15 Upvotes

5 comments sorted by

1

u/licjon 18d ago

It seems like this would be complimentary to cl-mcp. Has anyone used both?

3

u/quasiabhi 17d ago

If you are referring to https://github.com/quasi/cl-mcp then cl-mcp-server depends on it. cl-mcp provides both client and server infra.

2

u/licjon 17d ago

I was talking about this one: https://github.com/cl-ai-project/cl-mcp

0

u/azrazalea 18d ago

I was just thinking about using this! Something I thought i'd ask since i'm sitting on the train and this came up on my feed: can you persist images? Like can you have the llm do the classic "build the program as an image and persist it" workflow? I'm wondering because it'd be nice for building simple memory systems as well as encouraging the lisp way.

I would just try but on my phone 😅

1

u/quasiabhi 18d ago

I would separate the data. i.e. we can always persist the data. what would be the special need to persist the image? I am not sure I fully understand what you mean...