Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@e111077
Copy link
Contributor

@e111077 e111077 commented May 17, 2025

This implements a very basic mcp server that hooks into our algolia search for lit.dev. The key exposed is a rate-limited read-only key.

Features in this pr:

  • Implements an mcp server
    • Tools can have environment compatibilities
      • local can only run when it has source code in front of it or on a local machine
        • e.g. a tool that runs lit analyzer on your code
      • server can only run when it's on a server
        • e.g. a tool potentially set up at an endpoint on something like lit.dev/mcp that might require special API keys etc
      • any can run in any environment
        • e.g. a tool that can run on either local or server like algolia search
    • Only has an algolia search tool right now. Would be cool to eventually search discord
  • Implements the lit labs mcp command
    • Adds this as a labs command on the lit CLI
    • Implement the --skip-permissions command so that AI tools don't get stuck on the cli asking to install the mcp server
Parent Children
#4970

@github-actions
Copy link
Contributor

github-actions bot commented May 17, 2025

📊 Tachometer Benchmark Results

Summary

nop-update

  • this-change, tip-of-tree, previous-release: unsure 🔍 -4% - +7% (-0.46ms - +0.76ms)
    this-change vs tip-of-tree

render

  • this-change: 42.64ms - 54.27ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +5% (-0.67ms - +0.93ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +3% (-0.34ms - +1.14ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -20% - +36% (-8.36ms - +15.52ms)
    this-change vs tip-of-tree

update

  • this-change: 465.62ms - 474.21ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +9% (-1.10ms - +3.22ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -0% - +6% (+0.02ms - +4.07ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +1% (-6.94ms - +4.55ms)
    this-change vs tip-of-tree

update-reflect

  • this-change: 457.20ms - 464.49ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +1% (-8.43ms - +4.67ms)
    this-change vs tip-of-tree

Results

this-change

render

VersionAvg timevs
42.64ms - 54.27ms-

update

VersionAvg timevs
465.62ms - 474.21ms-

update-reflect

VersionAvg timevs
457.20ms - 464.49ms-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
19.16ms - 20.19ms-unsure 🔍
-3% - +5%
-0.67ms - +0.93ms
unsure 🔍
-3% - +4%
-0.63ms - +0.87ms
tip-of-tree
tip-of-tree
18.94ms - 20.15msunsure 🔍
-5% - +3%
-0.93ms - +0.67ms
-unsure 🔍
-4% - +4%
-0.82ms - +0.80ms
previous-release
previous-release
19.02ms - 20.10msunsure 🔍
-4% - +3%
-0.87ms - +0.63ms
unsure 🔍
-4% - +4%
-0.80ms - +0.82ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
35.48ms - 38.16ms-unsure 🔍
-3% - +9%
-1.10ms - +3.22ms
unsure 🔍
-5% - +7%
-1.72ms - +2.46ms
tip-of-tree
tip-of-tree
34.07ms - 37.45msunsure 🔍
-9% - +3%
-3.22ms - +1.10ms
-unsure 🔍
-8% - +4%
-3.02ms - +1.64ms
previous-release
previous-release
34.85ms - 38.06msunsure 🔍
-7% - +5%
-2.46ms - +1.72ms
unsure 🔍
-5% - +9%
-1.64ms - +3.02ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
11.03ms - 11.96ms-unsure 🔍
-4% - +7%
-0.46ms - +0.76ms
unsure 🔍
-5% - +6%
-0.59ms - +0.70ms
tip-of-tree
tip-of-tree
10.95ms - 11.74msunsure 🔍
-7% - +4%
-0.76ms - +0.46ms
-unsure 🔍
-6% - +4%
-0.69ms - +0.50ms
previous-release
previous-release
10.99ms - 11.89msunsure 🔍
-6% - +5%
-0.70ms - +0.59ms
unsure 🔍
-4% - +6%
-0.50ms - +0.69ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
35.36ms - 36.41ms-unsure 🔍
-1% - +3%
-0.34ms - +1.14ms
unsure 🔍
-1% - +4%
-0.18ms - +1.25ms
tip-of-tree
tip-of-tree
34.96ms - 36.00msunsure 🔍
-3% - +1%
-1.14ms - +0.34ms
-unsure 🔍
-2% - +2%
-0.59ms - +0.85ms
previous-release
previous-release
34.86ms - 35.84msunsure 🔍
-3% - +0%
-1.25ms - +0.18ms
unsure 🔍
-2% - +2%
-0.85ms - +0.59ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
72.68ms - 75.80ms-unsure 🔍
-0% - +6%
+0.02ms - +4.07ms
unsure 🔍
-2% - +4%
-1.15ms - +2.81ms
tip-of-tree
tip-of-tree
70.90ms - 73.49msfaster ✔
0% - 5%
0.02ms - 4.07ms
-unsure 🔍
-4% - +1%
-3.00ms - +0.57ms
previous-release
previous-release
72.18ms - 74.63msunsure 🔍
-4% - +2%
-2.81ms - +1.15ms
unsure 🔍
-1% - +4%
-0.57ms - +3.00ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
38.68ms - 56.50ms-unsure 🔍
-20% - +36%
-8.36ms - +15.52ms
unsure 🔍
-34% - +12%
-19.02ms - +7.40ms
tip-of-tree
tip-of-tree
36.06ms - 51.96msunsure 🔍
-32% - +17%
-15.52ms - +8.36ms
-unsure 🔍
-39% - +4%
-21.97ms - +3.19ms
previous-release
previous-release
43.65ms - 63.15msunsure 🔍
-17% - +42%
-7.40ms - +19.02ms
unsure 🔍
-10% - +52%
-3.19ms - +21.97ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
486.57ms - 494.92ms-unsure 🔍
-1% - +1%
-6.94ms - +4.55ms
unsure 🔍
-1% - +1%
-6.43ms - +5.02ms
tip-of-tree
tip-of-tree
487.99ms - 495.88msunsure 🔍
-1% - +1%
-4.55ms - +6.94ms
-unsure 🔍
-1% - +1%
-5.07ms - +6.05ms
previous-release
previous-release
487.53ms - 495.36msunsure 🔍
-1% - +1%
-5.02ms - +6.43ms
unsure 🔍
-1% - +1%
-6.05ms - +5.07ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
489.58ms - 498.96ms-unsure 🔍
-2% - +1%
-8.43ms - +4.67ms
unsure 🔍
-2% - +0%
-9.48ms - +2.09ms
tip-of-tree
tip-of-tree
491.59ms - 500.72msunsure 🔍
-1% - +2%
-4.67ms - +8.43ms
-unsure 🔍
-2% - +1%
-7.50ms - +3.87ms
previous-release
previous-release
494.59ms - 501.35msunsure 🔍
-0% - +2%
-2.09ms - +9.48ms
unsure 🔍
-1% - +2%
-3.87ms - +7.50ms
-

tachometer-reporter-action v2 for Benchmarks

@changeset-bot
Copy link

changeset-bot bot commented May 17, 2025

🦋 Changeset detected

Latest commit: 8c71d96

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@lit-labs/cli-mcp-server Minor
@lit-labs/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@e111077 e111077 force-pushed the copilot-instructions branch from ef0d45c to 2213cb5 Compare May 17, 2025 02:04
@e111077 e111077 marked this pull request as ready for review May 17, 2025 02:05
@e111077 e111077 requested a review from kevinpschaaf as a code owner May 17, 2025 02:05
@e111077
Copy link
Contributor Author

e111077 commented May 17, 2025

I had issues writing tests for this. The CLI version of this package seems to be the only way we can test this with with CI. Issues are:

  1. Do we want to include network requests in our tests?
  2. Invoking it from within the directory with npx ran into version conflicts with a transitive commander dependency:
  • npx @modelcontextprotocol/inspector --cli --help # program.name(...).allowExcessArguments is not a function

@github-actions
Copy link
Contributor

The size of lit-html.js and lit-core.min.js are as expected.

@e111077 e111077 force-pushed the copilot-instructions branch from a81b2a8 to 42f84b1 Compare May 17, 2025 02:59
@e111077 e111077 force-pushed the copilot-instructions branch from 42f84b1 to 83e7f0b Compare May 17, 2025 04:13
Base automatically changed from copilot-instructions to main May 19, 2025 06:09
@e111077 e111077 requested a review from justinfagnani May 19, 2025 06:10
Copy link
Collaborator

@rictic rictic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@e111077 e111077 changed the title [mcp-server] an initial implementation of a lit mcp server package feat(mcp): an initial implementation of a lit mcp server package Jun 5, 2025
@e111077 e111077 force-pushed the mcp-server branch 3 times, most recently from fd29310 to a312af9 Compare June 5, 2025 22:40
@e111077 e111077 changed the title feat(mcp): an initial implementation of a lit mcp server package feat(clit/mcp): an initial implementation of a lit mcp server package Jun 5, 2025
@e111077 e111077 requested a review from rictic June 5, 2025 22:46
@e111077 e111077 force-pushed the mcp-server branch 2 times, most recently from 4353115 to eadf6f8 Compare June 5, 2025 22:50
@e111077
Copy link
Contributor Author

e111077 commented Jun 5, 2025

@rictic PTAL: I've made some changes by adding this to the Lit CLI. I've updated the PR description

'The environment to run in, either "local" or "server". Server mode will ' +
'only expose MCP commands that are available on the server which are commands that do ' +
'not require local file access.',
typeLabel: '"local", "server"',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What local filesystem tools are you thinking of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what we were discussing previously:

  • Local, requires filesysten access like generating / finding CE manifests
  • Server, only requires network access to enable a RAG via MCP over HTTP (such as site search)

@e111077 e111077 changed the title feat(clit/mcp): an initial implementation of a lit mcp server package feat(cli/mcp): an initial implementation of a lit mcp server package Jun 19, 2025
@e111077 e111077 force-pushed the mcp-server branch 3 times, most recently from a5ef0ac to ca405be Compare August 21, 2025 18:48
This implements a very basic mcp server that hooks into our algolia search for lit.dev. The key exposed is a rate-limited read-only key.
@e111077 e111077 enabled auto-merge (rebase) August 21, 2025 22:28
@e111077 e111077 merged commit 36c6c00 into main Aug 21, 2025
10 checks passed
@e111077 e111077 deleted the mcp-server branch August 21, 2025 22:32
@lit-robot lit-robot mentioned this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants