# Codemirror Mcp

> CodeMirror extension to hook up a Model Context Provider (MCP)

- **Type:** MCP server
- **Install:** `agentstack add mcp-marimo-team-codemirror-mcp`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [marimo-team](https://agentstack.voostack.com/s/marimo-team)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [marimo-team](https://github.com/marimo-team)
- **Source:** https://github.com/marimo-team/codemirror-mcp
- **Website:** https://marimo-team.github.io/codemirror-mcp/

## Install

```sh
agentstack add mcp-marimo-team-codemirror-mcp
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# codemirror-mcp

A CodeMirror extension that implements the [Model Context Protocol](https://modelcontextprotocol.io) (MCP) for resource mentions and prompt commands.

## Features

- Resource Completion: Autocomplete for `@resource` mentions
- Resource Decorations: Visual styling for `@resource` mentions with click handling
- Prompt Completion: Autocomplete for `/prompt` commands
- Theme Support: Customizable styling

## Installation

```bash
npm install @marimo-team/codemirror-mcp @modelcontextprotocol/sdk
# or
pnpm add @marimo-team/codemirror-mcp @modelcontextprotocol/sdk
```

### Peer Dependencies

This module requires the following peer dependencies:

- `@codemirror/view`
- `@codemirror/state`
- `@modelcontextprotocol/sdk`

## Usage

```ts
import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js";
import { mcpExtension, extractResources } from '@marimo-team/codemirror-mcp';
import { EditorView } from '@codemirror/view';

const transport = new WebSocketClientTransport(new URL('ws://localhost:8080'));

const view = new EditorView({
  extensions: [
    // ... other extensions

    mcpExtension({
      // Required options
      transport: transport,

      // Optional options
      logger: console,
      clientOptions: {
        name: 'your-client',
        version: '1.0.0'
      },
      onResourceClick: (resource) => {
        // Open resource
        // e.g. open in a tab, etc.
      },
    }),

    // Handle submit
    keymap.of([
      {
        key: 'Enter',
        run: () => {
          const resources = extractResources(view);
          const formattedResources = resources
            .map(
              ({ resource }) =>
                `${resource.uri} (${resource.type}): ${resource.description || resource.name}`
            )
            .join('\n');
          const prompt = `${view.state.doc.toString()}\n\nResources:\n${formattedResources}`;
          // ... submit prompt to AI server
          // const response = await generateText(prompt);
        },
      },
    ]),
  ],
  parent: document.querySelector('#editor'),
});
```

## Resources

- Use `@resource-uri` syntax to reference resources
- Resources are visually decorated and clickable
- Click handling for resource interactions
- Hover tooltips show resource details
- Customizable theme

## Prompts

- Use `/command` syntax for prompt commands
- Autocomplete for available prompts

## Development

```bash
# Install dependencies
pnpm install

# Run tests
pnpm test

# Run demo
pnpm dev
```

## License

MIT

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [marimo-team](https://github.com/marimo-team)
- **Source:** [marimo-team/codemirror-mcp](https://github.com/marimo-team/codemirror-mcp)
- **License:** Apache-2.0
- **Homepage:** https://marimo-team.github.io/codemirror-mcp/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-marimo-team-codemirror-mcp
- Seller: https://agentstack.voostack.com/s/marimo-team
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
