{"id":23285272,"url":"https://github.com/wong2/litemcp","last_synced_at":"2025-09-10T08:10:17.897Z","repository":{"id":267264401,"uuid":"900708662","full_name":"wong2/litemcp","owner":"wong2","description":"A TypeScript framework for building MCP servers elegantly","archived":false,"fork":false,"pushed_at":"2025-04-27T03:30:13.000Z","size":116,"stargazers_count":177,"open_issues_count":5,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-01T01:08:45.569Z","etag":null,"topics":["mcp","model-context-protocol","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wong2.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-09T10:25:06.000Z","updated_at":"2025-07-19T20:23:53.000Z","dependencies_parsed_at":"2024-12-30T07:34:10.059Z","dependency_job_id":"447ecf12-e859-447d-8189-16eeac1a096f","html_url":"https://github.com/wong2/litemcp","commit_stats":null,"previous_names":["wong2/litemcp"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/wong2/litemcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Flitemcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Flitemcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Flitemcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Flitemcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wong2","download_url":"https://codeload.github.com/wong2/litemcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wong2%2Flitemcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274429324,"owners_count":25283355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcp","model-context-protocol","typescript","typescript-library"],"created_at":"2024-12-20T02:00:28.174Z","updated_at":"2025-09-10T08:10:17.888Z","avatar_url":"https://github.com/wong2.png","language":"TypeScript","funding_links":[],"categories":["📚 Projects (1974 total)","Frameworks","Developer Tools","Table of Contents","TypeScript","🌐 Web Development","SDKs","MCP Servers \u0026 Protocol","框架"],"sub_categories":["MCP Servers","🛠️ \u003ca name=\"other-tools-and-integrations\"\u003e\u003c/a\u003eOther Tools and Integrations","Gaming","JavaScript/TypeScript"],"readme":"# LiteMCP\n\nA TypeScript framework for building MCP (Model Context Protocol) servers elegantly\n\n\u003e **Deprecate notice**:\n\u003e \n\u003e Since the [official SDK](https://github.com/modelcontextprotocol/typescript-sdk) already offers a high-level API similar to this project, this project will no longer be maintained.\n\u003e\n\u003e If you like the CLI commands in this project, you can use them independently: https://github.com/wong2/mcp-cli\n\n## Features\n\n- Simple Tool, Resource, Prompt definition\n- Full TypeScript support\n- Built-in [logging](#logging)\n- Built-in error handling\n- Built-in CLI for [testing and debugging](#debugging-with-mcp-cli)\n- Built-in support for [SSE transport](#sse-transport)\n\n## Installation\n\n```bash\nnpm install litemcp zod\n```\n\n## Quickstart\n\n```js\nimport { LiteMCP } from \"litemcp\";\nimport { z } from \"zod\";\n\nconst server = new LiteMCP(\"demo\", \"1.0.0\");\n\nserver.addTool({\n  name: \"add\",\n  description: \"Add two numbers\",\n  parameters: z.object({\n    a: z.number(),\n    b: z.number(),\n  }),\n  execute: async (args) =\u003e {\n    return args.a + args.b;\n  },\n});\n\nserver.addResource({\n  uri: \"file:///logs/app.log\",\n  name: \"Application Logs\",\n  mimeType: \"text/plain\",\n  async load() {\n    return {\n      text: \"Example log content\",\n    };\n  },\n});\n\nserver.start();\n```\n\nYou can test the server in terminal with:\n\n```bash\nnpx litemcp dev server.js\n```\n\n## Core Concepts\n\n### Tools\n\nTools in MCP allow servers to expose executable functions that can be invoked by clients and used by LLMs to perform actions.\n\n```js\nserver.addTool({\n  name: \"fetch\",\n  description: \"Fetch the content of a url\",\n  parameters: z.object({\n    url: z.string(),\n  }),\n  execute: async (args) =\u003e {\n    const content = await fetchWebpageContent(args.url);\n    return content;\n  },\n});\n```\n\n### Resources\n\nResources represent any kind of data that an MCP server wants to make available to clients. This can include:\n\n- File contents\n- Screenshots and images\n- Log files\n- And more\n\nEach resource is identified by a unique URI and can contain either text or binary data.\n\n```js\nserver.addResource({\n  uri: \"file:///logs/app.log\",\n  name: \"Application Logs\",\n  mimeType: \"text/plain\",\n  async load() {\n    return {\n      text: await readLogFile(),\n    };\n  },\n});\n```\n\nYou can also return binary contents in `load`:\n\n```js\nasync load() {\n  return {\n    blob: 'base64-encoded-data'\n  }\n}\n```\n\n### Prompts\n\nPrompts enable servers to define reusable prompt templates and workflows that clients can easily surface to users and LLMs. They provide a powerful way to standardize and share common LLM interactions.\n\n```js\nserver.addPrompt({\n  name: \"git-commit\",\n  description: \"Generate a Git commit message\",\n  arguments: [\n    {\n      name: \"changes\",\n      description: \"Git diff or description of changes\",\n      required: true,\n    },\n  ],\n  load: async (args) =\u003e {\n    return `Generate a concise but descriptive commit message for these changes:\\n\\n${args.changes}`;\n  },\n});\n```\n\n### Logging\n\nYou can send log messages to the client with `server.logger`\n\n```js\nserver.addTool({\n  name: \"download\",\n  description: \"Download a file from a url\",\n  parameters: z.object({\n    url: z.string(),\n  }),\n  execute: async (args) =\u003e {\n    server.logger.info(\"Downloading file\", { url: args.url });\n    // ...\n    server.logger.info(\"Downloaded file\", { url: args.url });\n    return response;\n  },\n});\n```\n\nThe `logger` object has the following methods:\n\n- `debug(message: string, context?: JsonValue)`\n- `info(message: string, context?: JsonValue)`\n- `warn(message: string, context?: JsonValue)`\n- `error(message: string, context?: JsonValue)`\n\n## Running Your Server\n\n### Debugging with `mcp-cli`\n\nThe fastest way to test and debug your server is with [`mcp-cli`](https://github.com/wong2/mcp-cli):\n\n```bash\nnpx litemcp dev server.js\nnpx litemcp dev server.ts // ts files are also supported\n```\n\nThis will run your server with `mcp-cli` for testing and debugging your MCP server in the terminal.\n\n### Inspect with `MCP Inspector`\n\nAnother way is to use the official [`MCP Inspector`](https://modelcontextprotocol.io/docs/tools/inspector) to inspect your server with a Web UI:\n\n```bash\nnpx litemcp inspect server.js\n```\n\n### SSE Transport\n\nThe servers are running with `stdio` transport by default. You can also run the server with SSE mode:\n\n```js\nserver.start({\n  transportType: \"sse\",\n  sse: {\n    endpoint: \"/sse\",\n    port: 8080,\n  },\n});\n```\n\nThis will start the server and listen for SSE connections on http://localhost:8080/sse.\n\nYou can then connect to the server with [SSE transport](https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse) in the client.\n\n## Showcase\n\n\u003e If you've developed a server using LiteMCP, please submit a PR to showcase it here!\n\n- https://github.com/wong2/mcp-jina-reader\n- https://github.com/nloui/paperless-mcp\n\n## Roadmap\n\n- Add support for Resource Templates\n\n## Related\n\n- [mcp-cli](https://github.com/wong2/mcp-cli) - A CLI for testing and debugging MCP servers\n- [mcpservers.org](https://mcpservers.org) - A curated list of MCP servers\n- [FastMCP](https://github.com/jlowin/fastmcp) - A Python library for MCP server development, inspiration for this project\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwong2%2Flitemcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwong2%2Flitemcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwong2%2Flitemcp/lists"}