{"name":"mcp-server","title":"Remote MCP server","description":"A Streamable HTTP MCP server at /mcp with three example tools, ready to connect from Claude, ChatGPT or any MCP client.","runtime":"Bun 1.3 + TypeScript, official MCP SDK 1.30.1","size":"small","env":[{"name":"MCP_TOKEN","required":false,"description":"When set, /mcp answers 401 unless the client sends Authorization: Bearer <MCP_TOKEN>. Leave unset for clients that cannot send a header."}],"tags":["mcp","ai","tools","typescript","bun"],"next":"Connect a client to {url}/mcp, e.g. claude mcp add --transport http my-tools {url}/mcp. To require a token, set MCP_TOKEN (oa env set {slug} MCP_TOKEN=..., or PUT /v1/artifacts/{slug}/env).","oa_json":{"type":"service","install":"bun install","start":"bun run server.ts"},"files":[{"path":"README.md","content":"# Remote MCP server\n\nA remote [MCP](https://modelcontextprotocol.io) server over Streamable HTTP at\n`/mcp`, built with the official TypeScript SDK on Bun. It ships three example\ntools: `current_time`, `add_note` and `list_notes` (notes persist in `/data`).\nPoint Claude, ChatGPT or any MCP client at it, then replace the tools with\nyour own.\n\nIt runs stateless: each POST gets a fresh server and a JSON response, with no\nsession id to lose when the service sleeps and wakes.\n\n## Call it\n\nOnce it is healthy, the endpoint is `<url>/mcp`:\n\n```bash\n# Claude Code\nclaude mcp add --transport http my-tools <url>/mcp\n\n# by hand: initialize, list the tools, call one\ncurl -s -X POST <url>/mcp -H 'content-type: application/json' \\\n  -H 'accept: application/json, text/event-stream' \\\n  -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{},\"clientInfo\":{\"name\":\"curl\",\"version\":\"1\"}}}'\ncurl -s -X POST <url>/mcp -H 'content-type: application/json' \\\n  -H 'accept: application/json, text/event-stream' \\\n  -d '{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"current_time\",\"arguments\":{\"timezone\":\"Europe/Berlin\"}}}'\n```\n\nIn ChatGPT, add it as a connector (Settings, then Connectors) with the URL\n`<url>/mcp` and no authentication. `GET <url>/` describes the server and\nprints these commands with the real URL filled in.\n\n## Environment\n\n| Variable | Required | What it does |\n| --- | --- | --- |\n| `MCP_TOKEN` | no | When set, `/mcp` answers 401 unless the request carries `Authorization: Bearer <MCP_TOKEN>`. Claude Code sends it with `--header \"Authorization: Bearer ...\"`. ChatGPT connectors cannot send a fixed header, so leave it unset for them. |\n\nSet it with `oa env set <slug> MCP_TOKEN=...` or\n`PUT /v1/artifacts/<slug>/env {\"env\":{\"MCP_TOKEN\":\"...\"}}`; the service\nrestarts with it. Without a token anyone with the URL can call the tools, so\nkeep the tools harmless or set the token.\n\n## Extend it\n\n- Add a tool: one more `server.registerTool(name, {description, inputSchema}, handler)`\n  in `buildServer()` in `server.ts`. `inputSchema` is a map of zod schemas;\n  the SDK validates arguments and advertises the JSON Schema in `tools/list`.\n- Add a dependency: `bun add <package>` locally (it updates `package.json`\n  and `bun.lock`), then publish both files. Versions are pinned exactly, and\n  `bun.lock` pins everything below them.\n- Keep state in `/data`, written whole (a sibling file, then a rename), as\n  `saveNotes` does. Everything else in the container is rebuilt on each boot.\n\n## Boot and wake\n\nThe first boot runs `install` (`bun install`: about 92 packages from the npm\nregistry, a few seconds) and stores the result; every later boot restores it\ninstead of installing, then `bun run server.ts` starts in well under a second.\nA request to a sleeping service waits for that, so the first call after a\nsleep takes a few seconds; the rest are immediate.\n\n## What it costs\n\nPrices for `small`, the size this template needs (current prices on\n[openartifacts.sh](https://openartifacts.sh/#cost)):\n\n- **Asleep:** no runtime charge. The bundle and `/data` are stored at $0.05 per GB-month; this template is about 30 kB.\n- **Awake:** $0.03 per awake hour, billed per minute, plus $0.216 per vCPU-hour of CPU actually used. A call wakes it and it stays awake 600 seconds (`sleep_after_s`) after the last one, so an occasional call costs about $0.005 plus a little CPU.\n- **Busy all day:** awake around the clock is $0.72 a day plus CPU.\n\nStarting it needs an hour of awake time in credit ($0.03), and an account runs\none service per $1 of balance.\n"},{"path":"bun.lock","content":"{\n  \"lockfileVersion\": 1,\n  \"configVersion\": 1,\n  \"workspaces\": {\n    \"\": {\n      \"name\": \"oa-mcp-server\",\n      \"dependencies\": {\n        \"@modelcontextprotocol/sdk\": \"1.30.1\",\n        \"zod\": \"3.25.76\",\n      },\n    },\n  },\n  \"packages\": {\n    \"@hono/node-server\": [\"@hono/node-server@2.1.7\", \"\", { \"peerDependencies\": { \"hono\": \"^4 || ^5.0.0-0\" } }, \"sha512-Wr0E6S+v2Bw9FkpGNP5BQ5QbJvclUa06UVehd65WFZe6XeJwbrKQQ5wPDevc0IC+QyzbO7v3Llh5uo45IZcSnA==\"],\n\n    \"@modelcontextprotocol/sdk\": [\"@modelcontextprotocol/sdk@1.30.1\", \"\", { \"dependencies\": { \"@hono/node-server\": \"^1.19.9 || ^2.0.5\", \"ajv\": \"^8.17.1\", \"ajv-formats\": \"^3.0.1\", \"content-type\": \"^1.0.5\", \"cors\": \"^2.8.5\", \"cross-spawn\": \"^7.0.5\", \"eventsource\": \"^3.0.2\", \"eventsource-parser\": \"^3.0.0\", \"express\": \"^5.2.1\", \"express-rate-limit\": \"^8.2.1\", \"hono\": \"^4.11.4\", \"jose\": \"^6.1.3\", \"json-schema-typed\": \"^8.0.2\", \"pkce-challenge\": \"^5.0.0\", \"raw-body\": \"^3.0.0\", \"zod\": \"^3.25 || ^4.0\", \"zod-to-json-schema\": \"^3.25.1\" }, \"peerDependencies\": { \"@cfworker/json-schema\": \"^4.1.1\" }, \"optionalPeers\": [\"@cfworker/json-schema\"] }, \"sha512-H2HxLvC3HDNybePJaLdSrU1hhUK5iQw+WvV1b01myFyI7sdVGe1u/IPTE5D9fGCiJDVtgMV/lmFkQXLmQyIFYA==\"],\n\n    \"accepts\": [\"accepts@2.0.0\", \"\", { \"dependencies\": { \"mime-types\": \"^3.0.0\", \"negotiator\": \"^1.0.0\" } }, \"sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==\"],\n\n    \"ajv\": [\"ajv@8.20.0\", \"\", { \"dependencies\": { \"fast-deep-equal\": \"^3.1.3\", \"fast-uri\": \"^3.0.1\", \"json-schema-traverse\": \"^1.0.0\", \"require-from-string\": \"^2.0.2\" } }, \"sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==\"],\n\n    \"ajv-formats\": [\"ajv-formats@3.0.1\", \"\", { \"dependencies\": { \"ajv\": \"^8.0.0\" } }, \"sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==\"],\n\n    \"body-parser\": [\"body-parser@2.4.0\", \"\", { \"dependencies\": { \"bytes\": \"^3.1.2\", \"content-type\": \"^2.1.0\", \"debug\": \"^4.4.3\", \"http-errors\": \"^2.0.1\", \"iconv-lite\": \"^0.7.3\", \"on-finished\": \"^2.4.1\", \"qs\": \"^6.16.1\", \"raw-body\": \"^3.0.2\", \"type-is\": \"^2.1.0\" } }, \"sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==\"],\n\n    \"bytes\": [\"bytes@3.1.2\", \"\", {}, \"sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==\"],\n\n    \"call-bind-apply-helpers\": [\"call-bind-apply-helpers@1.0.2\", \"\", { \"dependencies\": { \"es-errors\": \"^1.3.0\", \"function-bind\": \"^1.1.2\" } }, \"sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==\"],\n\n    \"call-bound\": [\"call-bound@1.0.4\", \"\", { \"dependencies\": { \"call-bind-apply-helpers\": \"^1.0.2\", \"get-intrinsic\": \"^1.3.0\" } }, \"sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==\"],\n\n    \"content-disposition\": [\"content-disposition@2.0.1\", \"\", {}, \"sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==\"],\n\n    \"content-type\": [\"content-type@1.0.5\", \"\", {}, \"sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==\"],\n\n    \"cookie\": [\"cookie@0.7.2\", \"\", {}, \"sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==\"],\n\n    \"cookie-signature\": [\"cookie-signature@1.2.2\", \"\", {}, \"sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==\"],\n\n    \"cors\": [\"cors@2.8.6\", \"\", { \"dependencies\": { \"object-assign\": \"^4\", \"vary\": \"^1\" } }, \"sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==\"],\n\n    \"cross-spawn\": [\"cross-spawn@7.0.6\", \"\", { \"dependencies\": { \"path-key\": \"^3.1.0\", \"shebang-command\": \"^2.0.0\", \"which\": \"^2.0.1\" } }, \"sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==\"],\n\n    \"debug\": [\"debug@4.4.3\", \"\", { \"dependencies\": { \"ms\": \"^2.1.3\" }, \"peerDependencies\": { \"supports-color\": \"*\" }, \"optionalPeers\": [\"supports-color\"] }, \"sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==\"],\n\n    \"depd\": [\"depd@2.0.0\", \"\", {}, \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\"],\n\n    \"dunder-proto\": [\"dunder-proto@1.0.1\", \"\", { \"dependencies\": { \"call-bind-apply-helpers\": \"^1.0.1\", \"es-errors\": \"^1.3.0\", \"gopd\": \"^1.2.0\" } }, \"sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==\"],\n\n    \"ee-first\": [\"ee-first@1.1.1\", \"\", {}, \"sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==\"],\n\n    \"encodeurl\": [\"encodeurl@2.0.1\", \"\", {}, \"sha512-Ev/hIyePLZtpL98x562lvPtenrUfGr0lfaf44HFZ+hDEwso7ccV9QAZrEVLg0hxNAzygaAFxy2dYaAKKM0G06A==\"],\n\n    \"es-define-property\": [\"es-define-property@1.0.1\", \"\", {}, \"sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==\"],\n\n    \"es-errors\": [\"es-errors@1.3.0\", \"\", {}, \"sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==\"],\n\n    \"es-object-atoms\": [\"es-object-atoms@1.1.2\", \"\", { \"dependencies\": { \"es-errors\": \"^1.3.0\" } }, \"sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==\"],\n\n    \"escape-html\": [\"escape-html@1.0.3\", \"\", {}, \"sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==\"],\n\n    \"etag\": [\"etag@1.8.1\", \"\", {}, \"sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==\"],\n\n    \"eventsource\": [\"eventsource@3.0.7\", \"\", { \"dependencies\": { \"eventsource-parser\": \"^3.0.1\" } }, \"sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==\"],\n\n    \"eventsource-parser\": [\"eventsource-parser@3.1.1\", \"\", {}, \"sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==\"],\n\n    \"express\": [\"express@5.3.0\", \"\", { \"dependencies\": { \"accepts\": \"^2.0.0\", \"body-parser\": \"^2.3.0\", \"content-disposition\": \"^2.0.1\", \"content-type\": \"^2.0.0\", \"cookie\": \"^0.7.1\", \"cookie-signature\": \"^1.2.1\", \"debug\": \"^4.4.0\", \"depd\": \"^2.0.0\", \"encodeurl\": \"^2.0.0\", \"escape-html\": \"^1.0.3\", \"etag\": \"^1.8.1\", \"finalhandler\": \"^2.1.0\", \"fresh\": \"^2.0.0\", \"http-errors\": \"^2.0.0\", \"merge-descriptors\": \"^2.0.0\", \"mime-types\": \"^3.0.0\", \"on-finished\": \"^2.4.1\", \"once\": \"^1.4.0\", \"parseurl\": \"^1.3.3\", \"proxy-addr\": \"^2.0.8\", \"qs\": \"^6.16.0\", \"range-parser\": \"^1.2.1\", \"router\": \"^2.2.0\", \"send\": \"^1.1.0\", \"serve-static\": \"^2.2.0\", \"statuses\": \"^2.0.1\", \"type-is\": \"^2.1.0\", \"vary\": \"^1.1.2\" } }, \"sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==\"],\n\n    \"express-rate-limit\": [\"express-rate-limit@8.7.4\", \"\", { \"dependencies\": { \"debug\": \"^4.4.3\", \"ip-address\": \"^10.2.0\" }, \"peerDependencies\": { \"express\": \">= 4.11\" } }, \"sha512-LKBXzX700wz3zAGNNmVnjRI5mEbYkLv7UbMI4+9Xa+JPcg2UZh6AgY/2CZh9RrJjFM5ttC/N1lD+KzyFoZITCw==\"],\n\n    \"fast-deep-equal\": [\"fast-deep-equal@3.1.3\", \"\", {}, \"sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==\"],\n\n    \"fast-uri\": [\"fast-uri@3.1.9\", \"\", {}, \"sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==\"],\n\n    \"finalhandler\": [\"finalhandler@2.1.1\", \"\", { \"dependencies\": { \"debug\": \"^4.4.0\", \"encodeurl\": \"^2.0.0\", \"escape-html\": \"^1.0.3\", \"on-finished\": \"^2.4.1\", \"parseurl\": \"^1.3.3\", \"statuses\": \"^2.0.1\" } }, \"sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==\"],\n\n    \"forwarded\": [\"forwarded@0.2.0\", \"\", {}, \"sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==\"],\n\n    \"fresh\": [\"fresh@2.0.0\", \"\", {}, \"sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==\"],\n\n    \"function-bind\": [\"function-bind@1.1.2\", \"\", {}, \"sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==\"],\n\n    \"get-intrinsic\": [\"get-intrinsic@1.3.0\", \"\", { \"dependencies\": { \"call-bind-apply-helpers\": \"^1.0.2\", \"es-define-property\": \"^1.0.1\", \"es-errors\": \"^1.3.0\", \"es-object-atoms\": \"^1.1.1\", \"function-bind\": \"^1.1.2\", \"get-proto\": \"^1.0.1\", \"gopd\": \"^1.2.0\", \"has-symbols\": \"^1.1.0\", \"hasown\": \"^2.0.2\", \"math-intrinsics\": \"^1.1.0\" } }, \"sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==\"],\n\n    \"get-proto\": [\"get-proto@1.0.1\", \"\", { \"dependencies\": { \"dunder-proto\": \"^1.0.1\", \"es-object-atoms\": \"^1.0.0\" } }, \"sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==\"],\n\n    \"gopd\": [\"gopd@1.2.0\", \"\", {}, \"sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==\"],\n\n    \"has-symbols\": [\"has-symbols@1.1.0\", \"\", {}, \"sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==\"],\n\n    \"hasown\": [\"hasown@2.0.4\", \"\", { \"dependencies\": { \"function-bind\": \"^1.1.2\" } }, \"sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==\"],\n\n    \"hono\": [\"hono@4.13.18\", \"\", {}, \"sha512-H9q/E1XizaWstJxUW881dmLxEj+t/TrGGnyxINkm4+sK0qUwsMtFdo2BWI9Vs3cIS19MU6b6iCijoUoEf4f3DA==\"],\n\n    \"http-errors\": [\"http-errors@2.0.1\", \"\", { \"dependencies\": { \"depd\": \"~2.0.0\", \"inherits\": \"~2.0.4\", \"setprototypeof\": \"~1.2.0\", \"statuses\": \"~2.0.2\", \"toidentifier\": \"~1.0.1\" } }, \"sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==\"],\n\n    \"iconv-lite\": [\"iconv-lite@0.7.3\", \"\", { \"dependencies\": { \"safer-buffer\": \">= 2.1.2 < 3.0.0\" } }, \"sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==\"],\n\n    \"inherits\": [\"inherits@2.0.4\", \"\", {}, \"sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==\"],\n\n    \"ip-address\": [\"ip-address@10.7.6\", \"\", {}, \"sha512-00LYkM6byILa9eQIx6qoaXCM40xTLd56AZ4vyaPW3YTyb49VZYPo5xsiAq4tuQ54GH4R7gVdYScJ1B7B77PuTg==\"],\n\n    \"ipaddr.js\": [\"ipaddr.js@1.9.1\", \"\", {}, \"sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==\"],\n\n    \"is-promise\": [\"is-promise@4.0.0\", \"\", {}, \"sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==\"],\n\n    \"isexe\": [\"isexe@2.0.0\", \"\", {}, \"sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==\"],\n\n    \"jose\": [\"jose@6.2.17\", \"\", {}, \"sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==\"],\n\n    \"json-schema-traverse\": [\"json-schema-traverse@1.0.0\", \"\", {}, \"sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==\"],\n\n    \"json-schema-typed\": [\"json-schema-typed@8.0.2\", \"\", {}, \"sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==\"],\n\n    \"math-intrinsics\": [\"math-intrinsics@1.1.0\", \"\", {}, \"sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==\"],\n\n    \"media-typer\": [\"media-typer@1.1.1\", \"\", {}, \"sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==\"],\n\n    \"merge-descriptors\": [\"merge-descriptors@2.0.0\", \"\", {}, \"sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==\"],\n\n    \"mime-db\": [\"mime-db@1.54.0\", \"\", {}, \"sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==\"],\n\n    \"mime-types\": [\"mime-types@3.0.2\", \"\", { \"dependencies\": { \"mime-db\": \"^1.54.0\" } }, \"sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==\"],\n\n    \"ms\": [\"ms@2.1.3\", \"\", {}, \"sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==\"],\n\n    \"negotiator\": [\"negotiator@1.1.0\", \"\", { \"dependencies\": { \"content-type\": \"^2.1.0\" } }, \"sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==\"],\n\n    \"object-assign\": [\"object-assign@4.1.1\", \"\", {}, \"sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==\"],\n\n    \"object-inspect\": [\"object-inspect@1.13.4\", \"\", {}, \"sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==\"],\n\n    \"on-finished\": [\"on-finished@2.4.2\", \"\", { \"dependencies\": { \"ee-first\": \"1.1.1\" } }, \"sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==\"],\n\n    \"once\": [\"once@1.4.0\", \"\", { \"dependencies\": { \"wrappy\": \"1\" } }, \"sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==\"],\n\n    \"parseurl\": [\"parseurl@1.3.3\", \"\", {}, \"sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==\"],\n\n    \"path-key\": [\"path-key@3.1.1\", \"\", {}, \"sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==\"],\n\n    \"path-to-regexp\": [\"path-to-regexp@8.4.2\", \"\", {}, \"sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==\"],\n\n    \"pkce-challenge\": [\"pkce-challenge@5.0.1\", \"\", {}, \"sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==\"],\n\n    \"proxy-addr\": [\"proxy-addr@2.0.8\", \"\", { \"dependencies\": { \"forwarded\": \"0.2.0\", \"ipaddr.js\": \"1.9.1\" } }, \"sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==\"],\n\n    \"qs\": [\"qs@6.17.1\", \"\", { \"dependencies\": { \"es-define-property\": \"^1.0.1\", \"side-channel\": \"^1.1.1\" } }, \"sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==\"],\n\n    \"range-parser\": [\"range-parser@1.3.0\", \"\", {}, \"sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==\"],\n\n    \"raw-body\": [\"raw-body@3.0.2\", \"\", { \"dependencies\": { \"bytes\": \"~3.1.2\", \"http-errors\": \"~2.0.1\", \"iconv-lite\": \"~0.7.0\", \"unpipe\": \"~1.0.0\" } }, \"sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==\"],\n\n    \"require-from-string\": [\"require-from-string@2.0.2\", \"\", {}, \"sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==\"],\n\n    \"router\": [\"router@2.2.0\", \"\", { \"dependencies\": { \"debug\": \"^4.4.0\", \"depd\": \"^2.0.0\", \"is-promise\": \"^4.0.0\", \"parseurl\": \"^1.3.3\", \"path-to-regexp\": \"^8.0.0\" } }, \"sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==\"],\n\n    \"safer-buffer\": [\"safer-buffer@2.1.2\", \"\", {}, \"sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==\"],\n\n    \"send\": [\"send@1.2.1\", \"\", { \"dependencies\": { \"debug\": \"^4.4.3\", \"encodeurl\": \"^2.0.0\", \"escape-html\": \"^1.0.3\", \"etag\": \"^1.8.1\", \"fresh\": \"^2.0.0\", \"http-errors\": \"^2.0.1\", \"mime-types\": \"^3.0.2\", \"ms\": \"^2.1.3\", \"on-finished\": \"^2.4.1\", \"range-parser\": \"^1.2.1\", \"statuses\": \"^2.0.2\" } }, \"sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==\"],\n\n    \"serve-static\": [\"serve-static@2.2.1\", \"\", { \"dependencies\": { \"encodeurl\": \"^2.0.0\", \"escape-html\": \"^1.0.3\", \"parseurl\": \"^1.3.3\", \"send\": \"^1.2.0\" } }, \"sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==\"],\n\n    \"setprototypeof\": [\"setprototypeof@1.2.0\", \"\", {}, \"sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==\"],\n\n    \"shebang-command\": [\"shebang-command@2.0.0\", \"\", { \"dependencies\": { \"shebang-regex\": \"^3.0.0\" } }, \"sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==\"],\n\n    \"shebang-regex\": [\"shebang-regex@3.0.0\", \"\", {}, \"sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==\"],\n\n    \"side-channel\": [\"side-channel@1.1.1\", \"\", { \"dependencies\": { \"es-errors\": \"^1.3.0\", \"object-inspect\": \"^1.13.4\", \"side-channel-list\": \"^1.0.1\", \"side-channel-map\": \"^1.0.1\", \"side-channel-weakmap\": \"^1.0.2\" } }, \"sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==\"],\n\n    \"side-channel-list\": [\"side-channel-list@1.0.1\", \"\", { \"dependencies\": { \"es-errors\": \"^1.3.0\", \"object-inspect\": \"^1.13.4\" } }, \"sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==\"],\n\n    \"side-channel-map\": [\"side-channel-map@1.0.1\", \"\", { \"dependencies\": { \"call-bound\": \"^1.0.2\", \"es-errors\": \"^1.3.0\", \"get-intrinsic\": \"^1.2.5\", \"object-inspect\": \"^1.13.3\" } }, \"sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==\"],\n\n    \"side-channel-weakmap\": [\"side-channel-weakmap@1.0.2\", \"\", { \"dependencies\": { \"call-bound\": \"^1.0.2\", \"es-errors\": \"^1.3.0\", \"get-intrinsic\": \"^1.2.5\", \"object-inspect\": \"^1.13.3\", \"side-channel-map\": \"^1.0.1\" } }, \"sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==\"],\n\n    \"statuses\": [\"statuses@2.0.2\", \"\", {}, \"sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==\"],\n\n    \"toidentifier\": [\"toidentifier@1.0.1\", \"\", {}, \"sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==\"],\n\n    \"type-is\": [\"type-is@2.1.0\", \"\", { \"dependencies\": { \"content-type\": \"^2.0.0\", \"media-typer\": \"^1.1.0\", \"mime-types\": \"^3.0.0\" } }, \"sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==\"],\n\n    \"unpipe\": [\"unpipe@1.0.0\", \"\", {}, \"sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==\"],\n\n    \"vary\": [\"vary@1.1.2\", \"\", {}, \"sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==\"],\n\n    \"which\": [\"which@2.0.2\", \"\", { \"dependencies\": { \"isexe\": \"^2.0.0\" }, \"bin\": { \"node-which\": \"./bin/node-which\" } }, \"sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==\"],\n\n    \"wrappy\": [\"wrappy@1.0.2\", \"\", {}, \"sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==\"],\n\n    \"zod\": [\"zod@3.25.76\", \"\", {}, \"sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==\"],\n\n    \"zod-to-json-schema\": [\"zod-to-json-schema@3.25.2\", \"\", { \"peerDependencies\": { \"zod\": \"^3.25.28 || ^4\" } }, \"sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==\"],\n\n    \"body-parser/content-type\": [\"content-type@2.1.0\", \"\", {}, \"sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==\"],\n\n    \"express/content-type\": [\"content-type@2.1.0\", \"\", {}, \"sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==\"],\n\n    \"negotiator/content-type\": [\"content-type@2.1.0\", \"\", {}, \"sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==\"],\n\n    \"type-is/content-type\": [\"content-type@2.1.0\", \"\", {}, \"sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==\"],\n  }\n}\n"},{"path":"oa.json","content":"{\n  \"type\": \"service\",\n  \"install\": \"bun install\",\n  \"start\": \"bun run server.ts\"\n}\n"},{"path":"package.json","content":"{\n  \"name\": \"oa-mcp-server\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"dependencies\": {\n    \"@modelcontextprotocol/sdk\": \"1.30.1\",\n    \"zod\": \"3.25.76\"\n  }\n}\n"},{"path":"server.ts","content":"/**\n * A remote MCP server over Streamable HTTP, on Bun with the official\n * TypeScript SDK (@modelcontextprotocol/sdk).\n *\n *   POST /mcp   the MCP endpoint (JSON-RPC; JSON responses, no session)\n *   GET  /      what this server is and how to connect to it\n *\n * Stateless on purpose: every POST builds a fresh server and transport, so\n * nothing is lost when the platform puts the container to sleep, and a client\n * never holds a session id that a restart would invalidate. State that must\n * outlive a request (the notes) lives in /data.\n */\nimport { timingSafeEqual } from \"node:crypto\";\nimport { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { WebStandardStreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js\";\nimport { z } from \"zod\";\n\nconst PORT = Number(process.env.PORT ?? 8080);\n/** Optional. When set, /mcp answers 401 unless the request carries `Authorization: Bearer <MCP_TOKEN>`. */\nconst TOKEN = process.env.MCP_TOKEN ?? \"\";\n/** The platform sets OA_URL to this service's public URL. */\nconst PUBLIC_URL = (process.env.OA_URL ?? `http://localhost:${PORT}`).replace(/\\/+$/, \"\");\nconst DATA_DIR = process.env.DATA_DIR ?? (existsSync(\"/data\") ? \"/data\" : \"./data\");\nconst NOTES_FILE = join(DATA_DIR, \"notes.json\");\nconst MAX_NOTES = 500;\n\ntype Note = { id: number; text: string; created_at: string };\n\nfunction loadNotes(): Note[] {\n  try {\n    const parsed = JSON.parse(readFileSync(NOTES_FILE, \"utf8\"));\n    return Array.isArray(parsed) ? parsed : [];\n  } catch {\n    return [];\n  }\n}\n\n/**\n * /data is object storage mounted as a directory: a file there should be\n * written whole and never edited in place. Write a sibling, then rename it\n * over the old one, so a reader (or a crash) sees the old list or the new\n * one, never half of either.\n */\nfunction saveNotes(list: Note[]): void {\n  mkdirSync(DATA_DIR, { recursive: true });\n  const tmp = `${NOTES_FILE}.tmp`;\n  writeFileSync(tmp, JSON.stringify(list));\n  renameSync(tmp, NOTES_FILE);\n}\n\nlet notes = loadNotes();\n\nconst text = (value: unknown) => ({\n  content: [{ type: \"text\" as const, text: typeof value === \"string\" ? value : JSON.stringify(value, null, 2) }],\n});\n\n/** One McpServer per request (stateless mode). Add your own tools here. */\nfunction buildServer(): McpServer {\n  const server = new McpServer({ name: \"oa-mcp-server\", version: \"1.0.0\" });\n\n  server.registerTool(\n    \"current_time\",\n    {\n      title: \"Current time\",\n      description: \"The current date and time in UTC or in an IANA time zone such as Europe/Berlin.\",\n      inputSchema: {\n        timezone: z.string().optional().describe(\"IANA time zone, e.g. America/New_York. Default UTC.\"),\n      },\n      annotations: { readOnlyHint: true, openWorldHint: false },\n    },\n    async ({ timezone }) => {\n      const zone = timezone ?? \"UTC\";\n      try {\n        const formatted = new Intl.DateTimeFormat(\"en-GB\", {\n          timeZone: zone,\n          dateStyle: \"full\",\n          timeStyle: \"long\",\n        }).format(new Date());\n        return text({ timezone: zone, now: formatted, iso_utc: new Date().toISOString() });\n      } catch {\n        return { ...text(`Unknown time zone \"${zone}\". Use an IANA name such as Europe/Berlin.`), isError: true };\n      }\n    },\n  );\n\n  server.registerTool(\n    \"add_note\",\n    {\n      title: \"Add a note\",\n      description: \"Save a short note on this server. Notes persist across restarts and sleeps.\",\n      inputSchema: { text: z.string().min(1).max(2000).describe(\"The note text.\") },\n      annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },\n    },\n    async ({ text: body }) => {\n      const note: Note = { id: (notes.at(-1)?.id ?? 0) + 1, text: body, created_at: new Date().toISOString() };\n      notes = [...notes, note].slice(-MAX_NOTES);\n      saveNotes(notes);\n      return text({ saved: note, total: notes.length });\n    },\n  );\n\n  server.registerTool(\n    \"list_notes\",\n    {\n      title: \"List notes\",\n      description: \"The most recent notes saved with add_note, newest first.\",\n      inputSchema: { limit: z.number().int().min(1).max(100).optional().describe(\"How many notes. Default 20.\") },\n      annotations: { readOnlyHint: true, openWorldHint: false },\n    },\n    async ({ limit }) => text({ notes: notes.slice(-(limit ?? 20)).reverse(), total: notes.length }),\n  );\n\n  return server;\n}\n\nfunction authorized(req: Request): boolean {\n  if (!TOKEN) return true;\n  const given = Buffer.from(req.headers.get(\"authorization\") ?? \"\");\n  const wanted = Buffer.from(`Bearer ${TOKEN}`);\n  return given.length === wanted.length && timingSafeEqual(given, wanted);\n}\n\nfunction info() {\n  return {\n    name: \"oa-mcp-server\",\n    mcp_endpoint: `${PUBLIC_URL}/mcp`,\n    transport: \"streamable-http (stateless, JSON responses)\",\n    auth: TOKEN ? \"Authorization: Bearer <MCP_TOKEN>\" : \"none (set MCP_TOKEN to require a bearer token)\",\n    tools: [\"current_time\", \"add_note\", \"list_notes\"],\n    connect: {\n      claude_code: `claude mcp add --transport http my-tools ${PUBLIC_URL}/mcp${TOKEN ? ' --header \"Authorization: Bearer $MCP_TOKEN\"' : \"\"}`,\n      chatgpt: `Settings -> Connectors -> Create: URL ${PUBLIC_URL}/mcp (no authentication)`,\n    },\n  };\n}\n\nBun.serve({\n  port: PORT,\n  hostname: \"0.0.0.0\",\n  async fetch(req) {\n    const { pathname } = new URL(req.url);\n    if (pathname === \"/mcp\") {\n      if (!authorized(req)) {\n        return Response.json(\n          { jsonrpc: \"2.0\", id: null, error: { code: -32001, message: \"Unauthorized: send Authorization: Bearer <MCP_TOKEN>.\" } },\n          { status: 401, headers: { \"www-authenticate\": 'Bearer realm=\"mcp\"' } },\n        );\n      }\n      const server = buildServer();\n      const transport = new WebStandardStreamableHTTPServerTransport({\n        sessionIdGenerator: undefined,\n        enableJsonResponse: true,\n      });\n      await server.connect(transport);\n      const res = await transport.handleRequest(req);\n      // The JSON body is complete by now; release the per-request pair.\n      void transport.close();\n      void server.close();\n      return res;\n    }\n    if (pathname === \"/\" || pathname === \"/health\") return Response.json(info());\n    return Response.json({ code: \"not_found\", message: `No route ${pathname}. The MCP endpoint is /mcp.` }, { status: 404 });\n  },\n});\n\nconsole.log(`mcp-server listening on 0.0.0.0:${PORT}; MCP endpoint ${PUBLIC_URL}/mcp`);\n"}],"file_count":5,"bytes":29830,"page":"https://openartifacts.sh/templates/mcp-server","publish":{"curl":"curl -sX POST https://openartifacts.sh/v1/publish -H \"Authorization: Bearer $OA_TOKEN\" -F type=service -F template=mcp-server -F slug=my-tools","mcp":{"tool":"publish_artifact","arguments":{"type":"service","template":"mcp-server","slug":"my-tools"}},"cli":"oa deploy --template mcp-server --slug my-tools"},"hint":"files is in the shape publish_artifact takes. To publish it unchanged: POST /v1/publish -F type=service -F template=mcp-server. To publish an edited copy: send your changed files alongside -F template=mcp-server (they replace the files of the same path), or publish the whole edited set without it (type=service; oa.json is among the files)."}