Logo de Clean MCP

Clean MCP

Organização
cleanmcp

Reduce token usage. All local and open-source.

Publicado porcleanmcp
Repositórioclean-mcp
IdiomaPython
Forks
7
Estrelas
47
Ferramentas disponíveis
0
Tipo de transportestdio
LicençaMIT
Links
  • Conecte ferramentas a fluxos de trabalho de IA

    Clean MCP disponibiliza recursos MCP que podem ser usados por clientes e agentes de IA compatíveis.

  • 0 ferramentas disponíveis

    Confira abaixo as ações que podem ser chamadas, incluindo nomes e descrições quando fornecidos pelo servidor.

  • Configuração pronta para copiar

    Use os exemplos de instalação para configurar este servidor no seu cliente MCP preferido.

  • Indicadores da comunidade de código aberto

    47 estrelas e 7 forks no repositório vinculado.

Clean MCP

Local semantic code search for AI coding agents — runs on your laptop, indexes stay on disk.

Clean MCP is an MCP server that gives Claude Code, Cursor, and other AI tools meaning-aware code search. It parses your repositories with tree-sitter, builds a call graph, embeds every function with a local sentence-transformer model, and stores everything in LanceDB — no cloud, no API keys, no telemetry.

text
"find the function that validates email on signup"
   ↓
search_code(query="email validation on signup")
   ↓
returns the right function with full source + callers/callees

Features

  • Semantic search — describes behaviour, not keywords; finds code by what it does.
  • Local-only — embeddings, metadata, and source files live in ~/.clean/. Nothing leaves your machine.
  • MCP-native — drops into Claude Code / Cursor / any MCP client over stdio.
  • Index anything — point it at a local folder or a public GitHub repo.
  • Tree-sitter parsing — Python, JavaScript, TypeScript.
  • Call graph aware — search results include direct callers and callees.

Installation

Requires Python 3.10–3.13.

bash
git clone https://github.com/cleanmcp/clean-mcp.git
python -m pip install -e ".[dev]"

This project uses a src/ layout, so the module command only works after the package is installed into the Python environment you are using. If you create or activate a virtualenv, run python -m pip install -e ".[dev]" again inside that environment before starting the server. The dev extra installs the project's local tooling, including pytest and ruff.

First search or index downloads all-MiniLM-L6-v2 (~90 MB) into ~/.cache/huggingface/ if it is not already cached. After that, the model is reused from disk and does not download again.

The server starts with heavy dependencies lazy-loaded. Launching clean should reach Starting Clean MCP server quickly; the embedding model and LanceDB stack load only when you call search_code or index_repo for the first time in that process.

Running the server

Clean is a stdio MCP server. It speaks the Model Context Protocol over stdin/stdout — there is no HTTP port, no web framework, and nothing to run under uvicorn/gunicorn. In normal use your MCP client (Claude Code, Cursor, …) launches the process for you based on the config below; you don't start it by hand.

To run it manually — for debugging, or to confirm it boots — use either of these equivalent commands:

bash
# Module form
python -m clean.local.mcp_server

# Console script (installed by `python -m pip install -e ".[dev]"`)
clean

The process then waits silently for an MCP client to connect over stdin/stdout. That silence is expected — it is not a web server and will not print a URL. Do not type into that terminal; blank lines or other text are treated as MCP input and will produce JSON-RPC parse errors. Press Ctrl+C to stop it. To talk to it interactively, use the MCP Inspector:

bash
npx @modelcontextprotocol/inspector python -m clean.local.mcp_server

Pin a default repo

Pass --repo owner/repo so search_code targets that repo without callers specifying it each time:

bash
python -m clean.local.mcp_server --repo facebook/react

Where it stores data

Override the on-disk locations with environment variables (see Where your data lives):

bash
CLEAN_PERSIST_PATH=/data/clean/index python -m clean.local.mcp_server

Wire it into your MCP client

Claude Code / Cursor / Codex — .mcp.json (project-scoped)

json
{
  "mcpServers": {
    "clean": {
      "command": "python",
      "args": ["-m", "clean.local.mcp_server"]
    }
  }
}

Or globally via the CLI:

bash
# Claude Code
claude mcp add clean -- python -m clean.local.mcp_server

# Codex
codex mcp add clean -- python -m clean.local.mcp_server

Tools

ToolKey inputsWhat it does
index_repopath or repo, optional branch, force, background, timeoutIndex a local folder or clone+index a GitHub repo. Starts in the background by default.
search_codequery, optional repo, branch, cwd, top_k, depthSemantic search across indexed code, returning source, callers/callees, and neighbouring functions.
list_reposnoneShow every indexed repository with branch, status, entity count, and detected metadata.
get_file_treeoptional repo, branch, depth, include_hiddenPrint the directory tree of an indexed repo.
get_sourcefile, optional repo, branch, start_line, end_line, functionRead a file or exact indexed function from an indexed repo.
expand_resultrankGet full source for a truncated result from the last search_code call in the same session.
delete_reporepo, optional branch, remove_filesRemove an index, metadata record, and optionally cloned source files.
get_token_savingsoptional resetShow or reset TOON-format token savings for the current server session.

Indexing modes

Ask your MCP client to index code in one of two ways:

  • Index this local directory

    • Calls index_repo with path.
    • Indexes a folder already on disk.
    • Does not clone anything.
    • Uses the folder basename as the repo name unless it can detect a GitHub remote, in which case it uses owner/repo.
    • Starts in the background by default; use list_repos to check for ready.
  • Index this GitHub repo owner/repo

    • Calls index_repo with repo.
    • Expects a GitHub repo in owner/repo format.
    • Uses RepoManager to clone or locate the repo under the configured repos directory, usually ~/.clean/repos.
    • Then indexes that checked-out local copy.
    • Starts clone and indexing in the background by default; use list_repos to check for ready.

Useful prompt variants:

text
Index this local directory
Index this GitHub repo clarsbyte/obs-assistant
Force re-index this GitHub repo clarsbyte/obs-assistant
Index the main branch of this repo in the foreground

Example usage in Claude Code

"Index this directory" → calls index_repo with the current path

"Find the function that handles login redirects" → search_code

"Show me how the indexer entry point works" → search_code then get_source

Where your data lives

~/.clean/
├── index/         LanceDB vector store
├── metadata.db    SQLite — which repos are indexed, status
└── repos/         git clones (only for GitHub-mode indexing)

Back up that folder to keep your indexes. Delete it to start fresh.

Override the location with env vars:

VariableDefault
CLEAN_REPOS_DIR~/.clean/repos
CLEAN_DB_PATH~/.clean/metadata.db
CLEAN_PERSIST_PATH~/.clean/index
CLEAN_SHOW_PROGRESS_BARfalse

Development

bash
make install   # creates .venv and installs deps
make test      # runs the test suite
make lint      # ruff check + format check
make format    # apply ruff fixes

How the token savings work

Clean is engineered to minimise the tokens an AI agent spends understanding your code — via semantic retrieval, tiered result summaries, on-demand expansion, and incremental indexing. For a full, code-referenced breakdown of every cost-reduction mechanism, see docs/cost-reduction.md.

Contributing

PRs welcome. See CONTRIBUTING.md.

License

MIT — see LICENSE.

Use o MCP de Clean MCP com vários modelos de IA

O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho. Assim, após conectar Clean MCP, é possível usá-lo com diferentes modelos de IA no TypingMind, em vez de configurá-lo separadamente para cada modelo. Este MCP é executado localmente no seu dispositivo por meio do conector MCP do TypingMind.

Guia de configuração para usar o conector local

Use esta opção quando o servidor MCP precisar acessar arquivos locais, aplicativos ou recursos privados no seu computador.

1

Abra as configurações de MCP

No TypingMind, vá até Configurações, Configurações avançadas e depois Model Context Protocol e selecione Configurar conector.

  1. Abra o TypingMind no navegador.
  2. Clique no ícone de Ajustes.
  3. Acesse Configurações avançadas.
  4. Abra a seção Model Context Protocol.
  5. Clique em Configurar conector e selecione Este dispositivo.
Tela de configuração do conector MCP do TypingMind com a opção Este dispositivo selecionada
2

Execute o comando do conector

Selecione Este dispositivo, copie o comando do TypingMind e execute-o no Terminal. Mantenha o processo em execução enquanto usa o MCP.

  1. Copie o comando de configuração exibido pelo TypingMind.
  2. Abra o Terminal no macOS ou o Windows Terminal no Windows.
  3. Cole e execute o comando.
  4. Autorize a instalação do pacote se o Terminal pedir confirmação para continuar.
  5. Mantenha o processo em execução na janela do Terminal enquanto usa as ferramentas MCP.
3

Adicione Clean MCP como servidor

Quando o status do conector for Pronto, clique em Editar e cole a configuração do servidor MCP.

  1. Aguarde até que o status do conector mostre Pronto.
  2. Clique em Editar.
  3. Cole a configuração do servidor MCP de Clean MCP.
  4. Salve a lista de servidores.
  5. Atualize para confirmar se o conector ainda está pronto para uso.
Configurações de MCP do TypingMind mostrando um servidor ativo e o botão Editar
{
  "mcpServers": {
    "clean-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use a conexão com diferentes modelos

Salve a lista de servidores, abra Plugins, ative as ferramentas MCP de Clean MCP, selecione qualquer modelo de IA compatível no TypingMind e use as ferramentas no chat ou atribua-as a um agente de IA.

  1. Abra a página Plugins no TypingMind.
  2. Ative as ferramentas MCP de Clean MCP.
  3. Inicie um chat e escolha o modelo de IA que deseja usar.
  4. Use as ferramentas MCP no chat ou atribua-as a um agente de IA.
  5. Mude para outro modelo de IA sempre que necessário, sem reconectar o MCP.
Chat do TypingMind usando ferramentas MCP ativadas com um modelo de IA selecionado
Pode usar Clean MCP para me ajudar nesta tarefa?
Clean MCP
Claro. Já li.
Veja o que encontrei usando Clean MCP.

Perguntas frequentes

Para que serve o servidor MCP Clean MCP?

Clean MCP é um servidor MCP que permite que aplicativos de IA compatíveis se conectem a ferramentas externas e informações de contexto. No TypingMind, basta adicionar esse servidor MCP uma vez para disponibilizar suas ferramentas no seu espaço de trabalho com IA.

Posso usar o MCP Clean MCP com vários modelos de IA no TypingMind?

Sim. O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho, permitindo usar Clean MCP com diferentes modelos de IA, como Claude, ChatGPT, Gemini ou outros modelos configurados no TypingMind, sem configurar o servidor MCP separadamente para cada modelo.

Por que usar o MCP Clean MCP com o TypingMind?

O TypingMind é uma das melhores interfaces de chat com LLMs porque reúne vários modelos de IA, prompts, plugins, agentes de IA, chaves de API e ferramentas MCP em um só espaço de trabalho. Com Clean MCP conectado, é possível usar suas ferramentas MCP nos seus modelos preferidos e manter seu fluxo de trabalho de chat organizado no TypingMind.

Como conecto o MCP Clean MCP ao TypingMind?

Clean MCP funciona por meio do conector MCP local do TypingMind. Essa é a melhor opção quando o servidor MCP precisa acessar arquivos locais, apps de desktop, ferramentas de linha de comando ou recursos privados no seu computador.

Quais ferramentas o MCP Clean MCP oferece no TypingMind?

Clean MCP disponibiliza recursos MCP que podem ser ativados na página Plugins do TypingMind e usados no chat ou atribuídos a agentes de IA.

Preciso compartilhar minhas chaves de API com o TypingMind para usar o MCP Clean MCP?

Não. O TypingMind prioriza o uso local e permite manter seus provedores de modelos, chaves de API, prompts e configuração MCP sob seu controle. Se Clean MCP exigir autenticação, adicione os cabeçalhos, as configurações OAuth ou a configuração local exigidos por esse servidor MCP ao criar a conexão.

Servidores MCP relacionados

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇