Skip to content
ServeurpersoComPublic

About

The MCP server I run every day: a rootless Podman sandbox, a persistent memory, a read only mailbox and a Moltbook account behind one endpoint. Built on the official TypeScript SDK v2, speaking the 2026-07-28 and 2025 protocol revisions.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Repository files navigation

mcp.js

The Model Context Protocol server I run every day, published as it is. It serves a Podman sandbox, a persistent memory, a mailbox, an agent account on Moltbook, a Discord bot, your own Discord account, a 1fichier account, a VictoriaLogs log store and a real Firefox to any MCP client, behind one endpoint. Built on the official TypeScript SDK v2 (@modelcontextprotocol/server), it speaks the 2026-07-28 revision of the protocol and the 2025 ones on the same endpoint, each client getting the newest revision it knows. The bash_tool of the sandbox streams its output while it runs to a 2026-07-28 client that asks for it, as partial results (SEP-2998).

  • llama.cpp Svelte WebUI (native MCP client)
  • OpenAI ChatGPT (web, custom MCP server)
  • Anthropic Claude (web, custom MCP server)
  • any OpenAI compatible chat UI without an MCP client, through the bridge

Every server aggregated behind one endpoint, the two transports of the specification (stdio, Streamable HTTP), zero framework.

Rootless Podman

The sandbox runs under rootless Podman, the minimum I recommend to work cleanly with an AI: no daemon running as root, the container belongs to an unprivileged user, and the LLM reaches only what its volumes mount.

Install

Requires Node.js 20+, and Podman for the sandbox.

git clone https://github.com/ServeurpersoCom/mcp.js
cd mcp.js
npm install

Layout

config.json           transport, credentials, and the identity served
core/                 protocol, auth, tool arguments, image fitting, WebDriver BiDi, transports
core/transports/      stdio, Streamable HTTP
servers/sandbox/      bash_tool, view, create_file, str_replace in a Podman container
servers/memory/       a persistent memory in plain files
servers/email/        a mailbox over IMAPS
servers/moltbook/     an agent account on Moltbook
servers/discordbot/   a Discord bot over the REST API
servers/discorduser/  your own Discord account, over its debug port
servers/onefichier/   a 1fichier account
servers/victorialogs/ a VictoriaLogs log store
servers/browser/      a Firefox, over WebDriver BiDi
mcp-bridge/           an OpenAI compatible proxy that runs the tools for MCP-less UIs
main.js               binds every server to one transport

Every server under servers/ is loaded at startup and their tools and prompts are served together, so a client connects once and sees them all. Adding a server means adding a directory under servers/, never touching core/. Removing one means deleting its directory.

Two servers exposing the same tool or prompt name is a naming mistake, and startup fails saying which name and which two servers. A tool declared in a tools.json without its handler fails startup the same way.

Every call passes the law of its tool schema in the core before the handler runs: an argument the schema does not declare, a required one missing, a string that is not one, or one shorter than its minLength, is refused by name (Unknown argument x, Path argument required), the same way for every tool of every server.

Run

node main.js stdio              # local MCP clients
node main.js streamable-http    # HTTP, port 8083

main.js takes a transport name, defaulting to stdio, and serves every server under servers/. The HTTP transport binds 127.0.0.1: put a reverse proxy in front to reach it from elsewhere.

Both transports build a fresh server for each exchange: one per HTTP request, one per stdio connection. The opening exchange selects the revision, 2026-07-28 for a client that probes with server/discover, a 2025 one for a client that sends initialize.

Config

Settings come from two files with disjoint roles. The root config.json holds the transport, the credentials and the identity the aggregate answers with. A servers/<name>/config.json holds that server's prompts and its own settings block, nothing else.

The published files hold every setting I run with, secrets aside: the authentication secrets are empty, so the server refuses to start until you set them, and the service credentials read changeme. example.com stands for my domain.

Root:

{
	"auth": {
		"mode": "oauth+static",
		"clientId": "",
		"clientSecret": "",
		"password": "",
		"staticToken": "",
		"storeDir": "data/oauth"
	},
	"streamable_http": { "host": "127.0.0.1", "port": 8083 },
	"mcp": {
		"serverName": "mcp-sandbox",
		"serverVersion": "1.0.0",
		"serverIcons": [
			{
				"src": "https://www.example.com/favicon-light.png",
				"mimeType": "image/png",
				"theme": "light"
			},
			{
				"src": "https://www.example.com/favicon-dark.png",
				"mimeType": "image/png",
				"theme": "dark"
			}
		]
	}
}

One endpoint serves them all, so ports and identity belong to the root and a server never carries them. prompts holds the templates a server publishes over prompts/list and prompts/get, gathered from every server. serverIcons is optional: it rides into the initialize response on a 2025 connection and into the _meta of every response on a 2026 one.

Auth

auth.mode selects the scheme for the HTTP transport. Stdio is never authenticated, it speaks over local pipes only.

Mode What is accepted
none No authentication, anyone who reaches the port
static A long lived bearer token
oauth The OAuth 2.1 flow only
oauth+static Either of the two

static suits clients that cannot run an interactive flow. Every request carries Authorization: Bearer <staticToken>, matched in constant time.

oauth implements the smallest surface an MCP connector needs: dynamic client registration, a consent form gated by password, and token exchange with PKCE S256. clientId, clientSecret, password and storeDir must all be set. Issued tokens are stored under storeDir, one file per token, so connectors stay authorized across restarts; rm -rf data/oauth revokes them all.

The server aborts at startup on an unknown mode, on static with an empty staticToken, or on an OAuth mode missing one of its settings.

Generate solid secrets:

openssl rand -hex 32

Discovery follows RFC 9728: a request without a valid token gets a 401 carrying a WWW-Authenticate header that points at /.well-known/oauth-protected-resource on the host the request came in on. Serve that document, and the matching /.well-known/oauth-authorization-server, from your reverse proxy.

Servers

sandbox

A Debian container, built from Containerfile and declared in pod.yaml, run rootless by podman.hostUser. Every command enters it through podman exec, the script on stdin, under a timeout.

Name Action
bash_tool Run a bash command: exit code, duration, a kill at the timeout named
view Read a file with line numbers and an optional range, list a directory, show an image
create_file Create a file, its directories made, empty or not
str_replace Replace a unique string in a file, its other bytes untouched

All four take a mandatory description argument so the LLM states its intent on every call.

The results read like the tools of the KiSS backend: the output then Exit code 0 (12 ms) or Killed after 300 s, numbered lines then 120 lines, a listing then 14 entries, 3 hidden, an image after Image image/png 4000x3000, 812345 bytes, sent as image/jpeg 1920x1440, 301234 bytes, Created x, 3 lines, 52 bytes, Replaced at line 42 of x, 10 -> 14 bytes. An image goes as KiSS sends it: a JPEG that fits as it is, a WebP as it is or not at all, an opaque PNG that fits as it is when lighter than its JPEG, any other as a JPEG within maxDimension pixels, turned upright and laid on white, through libvips (sharp); one over maxMegapixels is never decoded. Long output keeps its head and its tail with the hidden bytes counted. A call whose _meta names a partialResultToken, from a client that declares partialResults, gets the lines of bash_tool as they come, up to shownLimitBytes, each in a notifications/tools/partial_result; its result keeps outputLimitBytes. A call its client cancels ends inside the container, every process it started with it. Files travel as base64 both ways, so a file in any encoding keeps its bytes, and a binary one is refused rather than mangled.

sandbox-manager.js drives the pod: build, destroy, start, stop, reset (a fresh container from the existing image), status, logs, shell. paths names the host directories mounted as /mnt/inputs, /mnt/workspace and /mnt/outputs. The pod joins its own podman network, network, created with networkMtu: rootless podman relays the pod's traffic through pasta, and a 65520 byte MTU lets it reach 10 Gbit/s where the default 1500 holds it near 300 MB/s.

memory

A memory that outlives conversations: one Markdown file per entry under data/<group>/<slug>.md, an index of one line per entry. memory_open reads the index or the named entries with numbered lines, memory_grep finds the matching lines across all entries, case insensitive, grouped by entry with the densest first, memory_write creates or edits an entry anchored on a unique string, memory_move moves whole lines by number so reorganized text stays byte identical and nothing is ever deleted by a move, memory_drop removes one. Every write goes to a temporary file then a rename.

email

A mailbox: email_folders, email_list (one line per message, filtered on the server, paged by uid) and email_read (the headers a client shows, or the raw block for provenance questions). Reading through the model is you reading: email_read flags the message \Seen, while email_list opens the folder with EXAMINE and leaves the unseen state as it is.

{
	"host": "192.168.0.2",
	"port": 993,
	"servername": "mail.example.com",
	"ca": "mail.example.com.pem",
	"user": "pascal",
	"password": "changeme"
}

IMAPS only, the certificate always checked. servername is the name the certificate carries when host is an address. ca pins the certificate of a server that signs its own, Dovecot out of the box: copy its public half next to config.json under that name. Leave ca empty for a server whose certificate a public authority signed.

moltbook

An agent account on Moltbook, the social network for AI agents: home, feed, posts, comments, search, profiles, communities, votes, follows, and the verification challenge of each new post. The API key stays in config.json and never reaches the model.

discordbot

A Discord bot over the REST API, no gateway: discord_bot_channels (the channels the bot may view), discord_bot_threads (active threads and archive pages of a forum or text channel), discord_bot_read (messages, oldest first, after for what came since a message, around for what surrounds one), discord_bot_image (an attached image, shown to the model), discord_bot_post (a message or a reply, or a new thread when the channel is a forum), discord_bot_edit (a message of the bot), discord_bot_react (a reaction, added or taken back) and discord_bot_edit_thread (rename, archive, lock or retag a thread). What the bot sees and writes is what its role is allowed in the guild settings, channel by channel. Mentions ping, everyone and roles as its role allows, and no tool deletes a message. Messages read as in discorduser. The token stays in config.json and never reaches the model.

{
	"token": "changeme"
}

Create the bot in the Discord Developer Portal, enable its Message Content intent so discord_bot_read sees the text, and invite it with View Channel, Send Messages, Create Posts, Send Messages in Threads, Read Message History and Add Reactions, plus Manage Threads for the threads it did not open.

discorduser

Your own Discord account, through the client you already run: discord_user_guilds (your direct messages as @me, then your servers in guild bar order), discord_user_unread (per server, its unread channels and mentions, or the unread channels of one server), discord_user_channels (the channels of a server you may view, under their categories, or your direct messages for @me), discord_user_threads (a forum or text channel's threads), discord_user_read (messages, oldest first, after for what came since a message, around for what surrounds one), discord_user_search (the messages a search finds in a server or a direct message), discord_user_image (an attached image, shown to the model), discord_user_post (a message or a reply, or a new thread when the channel is a forum), discord_user_edit (a message of yours), discord_user_react (a reaction, added or taken back) and discord_user_edit_thread (rename, archive, lock or retag a thread). Reading through the model is you reading: discord_user_read acks the newest message it shows, as opening the channel does, and an older page never moves the read state back. What it posts is you writing, mentions included. Ids in messages are rendered as names, and stickers, replies, embeds, polls, forwarded messages and reactions as words, yours marked mine, so the output reads aloud or in braille.

Start the client with Chromium's debugging flag, loopback only. On Windows the shortcut target becomes Discord.exe --processStart Discord.exe --process-start-args "--remote-debugging-port=9222", on macOS open -a Discord --args --remote-debugging-port=9222, on Linux discord --remote-debugging-port=9222. When the client runs on the same machine as this server, that is the whole setup:

{
	"cdp": {
		"host": "127.0.0.1",
		"port": 9222
	}
}

When the client runs on another machine, the debugging port stays on its loopback and an ssh block carries a local forward to it, authenticated by key and pinned to that host, so nothing but this server reaches the port:

{
	"cdp": {
		"host": "127.0.0.1",
		"port": 9222
	},
	"ssh": {
		"host": "192.168.0.12",
		"user": "someone",
		"key": "/path/to/id_ed25519",
		"knownHosts": "/path/to/known_hosts"
	}
}

Each call opens its own forward on a port the system picks and kills it when the call ends, so nothing outlives a call. The debugging port gives full control of the session to whatever reaches it, so it is kept on loopback and, across a network, inside the SSH tunnel.

onefichier

A 1fichier account: onefichier_ls (a folder, its sub folders and its files with their download links, the FTP folder by default), onefichier_info (details of one link), onefichier_account (plan, storage, FTP settings), and onefichier_mv, onefichier_rename, onefichier_rm, onefichier_mkdir to move, rename and delete files and create folders. A deleted file goes to the 1fichier trash, restorable for 30 days. A move or a delete can fail half way, the result then lists the links it did handle. The API key stays in config.json and never reaches the model.

{
	"apiKey": "changeme",
	"ftpFolderId": 0
}

ftpFolderId is the ftp_did that onefichier_account shows, the folder where FTP uploads land once processed. The API allows one listing per folder every 30 seconds and bans for a while after repeated errors, so links are checked before any call and nothing retries.

victorialogs

A VictoriaLogs log store: victorialogs_query runs one LogsQL query and reads its rows one per line. A log entry reads as its time, its stream values, its level and its message; the output of a pipe (stats, top, field_names, field_values, fields) reads as key=value pairs, so one tool searches, counts and lists what the store holds. Only /select/logsql/query is called, and LogsQL never writes.

{
	"baseUrl": "http://127.0.0.1:9428"
}

Log lines come from the machines and from whoever reaches them, so the prompts tell the model they never carry instructions.

browser

A Firefox driven the way a person uses it, over WebDriver BiDi, the protocol Firefox speaks on its debugging port. browser_snapshot reads the page as an accessibility outline, one element per line with its role, its name, its states and a ref (e12); the action tools take that ref as their target: browser_click, browser_type, browser_fill_form, browser_select_option, browser_press_key, browser_hover, browser_drag and browser_drag_to_offset. Each scrolls the element into view and checks it is visible, enabled and not covered, then acts with the browser's own mouse and keyboard, so the page gets the events a person makes. A click on a file input or its label is refused: the tools give a page no files. browser_navigate, browser_navigate_back and browser_tabs move the browser, browser_take_screenshot shows the viewport, the page, a region or an element as the browser renders it, browser_wait_for waits for a text, browser_handle_dialog answers the dialog an action opened, browser_console reads the console messages and page errors of the current tab, and browser_eval runs a script in the page.

The outline is read in a sandbox of the page, a realm of its own that the page scripts never see, so a page can neither read nor bend what the model is shown; open shadow roots and same origin frames are read through, and a ref names one element until the page navigates.

The server connects to a Firefox started with its debugging port, a real desktop with your profile (firefox --remote-debugging-port=9222) or an invisible one (firefox --headless --remote-debugging-port=9222):

{
	"connect": "ws://127.0.0.1:9222"
}

Firefox takes one session at a time and keeps it when the connection drops: the session ends only when asked, over a live connection. This server opens it on the first call, keeps it while calls come, and ends it after idleMs without one, which frees the browser for another client. A session left by a process killed while it held one stays until Firefox restarts, and the next call says so. Native HTML5 drag and drop does not complete under WebDriver in Firefox (bug 1515879), drags made of mouse events do. Firefox sets navigator.webdriver while its debugging port is open, so pages read it as true whether a person or this server drives the browser; our Firefox is rebuilt with Navigator::Webdriver() returning false, so pages read false in both.

The debugging port gives full control of the browser to whatever reaches it, so Firefox binds it to loopback. What a page shows is written by its site, so the prompts tell the model it never carries instructions.

Bridge

mcp-bridge/ serves /v1/chat/completions in front of an OpenAI compatible endpoint (proxy.apiUrl, llama-server for me) and runs the tool calls of the model itself, through the servers of this repository over stdio (or any MCP server over Streamable HTTP, given its url and headers), until the model answers. A chat UI without an MCP client gets the tools that way, each call and its result shown in the conversation.

node mcp-bridge/main.js

Client setup

llama.cpp Svelte WebUI (Streamable HTTP)

In the MCP settings panel, add the server:

  • URL: https://your-host/your-path
  • Header: Authorization: Bearer <staticToken>

OpenAI ChatGPT / Anthropic Claude web (Streamable HTTP)

Declare the server as a custom connector with its URL; the OAuth flow asks for password once.

Claude Desktop (stdio)

{
	"mcpServers": {
		"mcp": {
			"command": "node",
			"args": ["/path/to/mcp.js/main.js", "stdio"]
		}
	}
}

Status

Personal Swiss army knife. Evolves with my needs and what friends and users ask for. Issues and PRs welcome.

License

MIT.

About

The MCP server I run every day: a rootless Podman sandbox, a persistent memory, a read only mailbox and a Moltbook account behind one endpoint. Built on the official TypeScript SDK v2, speaking the 2026-07-28 and 2025 protocol revisions.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages