codemirror-mcp
by marimo-team
A CodeMirror extension that implements the Model Context Protocol (MCP) for resource mentions and prompt commands. It provides features like resource completion, decorations, and prompt completion within the CodeMirror editor.
Last updated: N/A
What is codemirror-mcp?
codemirror-mcp is a CodeMirror extension that integrates the Model Context Protocol (MCP), enabling features like resource referencing and prompt commands within the editor. It enhances the editing experience by providing autocomplete, visual decorations, and click handling for resources.
How to use codemirror-mcp?
Install the package and its peer dependencies using npm or pnpm. Import the mcpExtension
and configure it with a transport (e.g., WebSocketClientTransport) and optional settings like logger, client options, and a resource click handler. Add the extension to your CodeMirror editor's extensions array.
Key features of codemirror-mcp
Resource Completion
Resource Decorations
Prompt Completion
Theme Support
Use cases of codemirror-mcp
Referencing resources within code or text
Creating prompts with resource context
Integrating with AI servers for code generation or analysis
Building interactive coding environments
Enhancing code documentation with resource links
FAQ from codemirror-mcp
What is the Model Context Protocol (MCP)?
What is the Model Context Protocol (MCP)?
MCP is a protocol for managing and referencing resources within a text editing environment.
What are the peer dependencies?
What are the peer dependencies?
The peer dependencies are @codemirror/view
, @codemirror/state
, and @modelcontextprotocol/sdk
. They need to be installed separately.
How do I handle resource clicks?
How do I handle resource clicks?
You can provide an onResourceClick
function in the mcpExtension
options to handle clicks on resource mentions.
How do I reference resources?
How do I reference resources?
Use the @resource-uri
syntax to reference resources within the editor.
How do I use prompt commands?
How do I use prompt commands?
Use the /command
syntax for prompt commands. Autocomplete is provided for available prompts.