convez.ai
MCP ServerDesenvolvimento WebIntermediário
catherinegao

MCP Server Frontend Context

catherinegao/mcp-server-frontend-context

Contexto de frontend automático para agentes de IA

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP que expõe contexto de projetos frontend (inventário de componentes, detecção de framework, convenções e exemplos) para agentes de IA como Claude e Cursor. Permite que LLMs entendam a estrutura e padrões do seu projeto sem adivinhações, melhorando significativamente a qualidade da codificação assistida.

Instalação

$npx convez-ai catherinegao/mcp-server-frontend-context

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Auxiliar Claude/Cursor a gerar código consistente com padrões existentes
  • Inventariar componentes e convenções do projeto automaticamente
  • Fornecer exemplos de implementação ao agente antes de escrever novo código
  • Melhorar precisão de sugestões de IA em projetos complexos

Veredito

Ferramenta sólida e bem pensada que resolve um problema real da IA-assisted coding: falta de contexto do projeto. Implementação limpa em TypeScript, compatível com Cursor e Claude Desktop, com tools JSON bem estruturadas. Recomendado para equipes que usam agentes de IA frequentemente.

README

A tradução para o português deste README ainda está na fila.

mcp-server-frontend-context

A Model Context Protocol server that exposes frontend-project context — package.json, framework detection, component inventory, conventions, and in-repo examples — to LLM agents like Cursor, Claude Desktop, and any other MCP-compatible client.

Built to make AI-assisted engineering more grounded. Instead of letting the agent guess what your project looks like, this server tells it — quickly, deterministically, and with no LLM call required for the lookup itself.

Why this exists

Most "AI coding" failure modes come from the same place: the agent doesn't know what's already in the codebase, what framework it's working in, what component patterns the team uses, or where a similar example lives. So it invents.

This MCP server gives the agent the answers up front:

  • What kind of project is this? → get_project_overview
  • What components already exist? → list_components
  • How is this specific component implemented? → get_component_details
  • What conventions does this team follow? → get_conventions
  • Where is something like X done in this repo? → find_examples

The output of each tool is plain JSON, so it composes cleanly with whatever prompt the agent is running.

Quickstart

1. Install

npm install
npm run build

2. Wire it into your MCP client

Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "frontend-context": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-frontend-context/dist/index.js"],
      "env": {
        "PROJECT_ROOT": "/absolute/path/to/your/project"
      }
    }
  }
}

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows)

{
  "mcpServers": {
    "frontend-context": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-frontend-context/dist/index.js"],
      "env": {
        "PROJECT_ROOT": "/absolute/path/to/your/project"
      }
    }
  }
}

PROJECT_ROOT is optional — when omitted, the server uses the process working directory. Each tool call also accepts a per-call rootDir argument that overrides both.

3. Use it from the agent

Once the server is registered, the agent can call any of the tools by name. A typical agentic flow looks like:

Agent reasoning: "The user wants me to add a new modal. Let me first see what conventions this project follows and find an existing modal to mirror."

  1. get_conventions(rootDir) → reads CONVENTIONS.md
  2. find_examples({ rootDir, pattern: "modal" }) → returns Modal.tsx
  3. get_component_details({ rootDir, name: "Modal" }) → returns props, hooks, imports, and the source
  4. Agent writes new modal following the existing pattern.

Tool reference

get_project_overview

Returns the project's name, version, detected framework, package manager, TypeScript usage, dependency list, and npm scripts.

InputTypeNotes
rootDirstring (optional)Project root. Defaults to PROJECT_ROOT or cwd.

Frameworks detected: React, Next.js, Vite + React, Create React App, Remix, Astro, Svelte, Vue, Angular, or unknown.

list_components

Returns an inventory of React components: detected name, file path, declaration kind (function / arrow / class), and whether the file has a default export, a named export, or both.

InputTypeNotes
rootDirstring (optional)Project root.
scopestring (optional)Sub-path to scan. Defaults to src if present, else the root.

Heuristic: files with .tsx or .jsx, JSX-like content, and a PascalCase declaration are treated as components. Default-ignored: node_modules, .git, dist, build, .next, .nuxt, coverage, .cache, .turbo, .vercel, .netlify.

get_component_details

Returns props (parsed from a Props or <Name>Props interface), hooks called, all imports (default / named / namespace), line count, and the raw source for a single component.

InputTypeNotes
rootDirstring (optional)Project root.
namestring (optional)Component name to look up.
filePathstring (optional)File path. Overrides name when both are provided.

get_conventions

Returns the contents of the project's conventions document. Searches, in order: CONVENTIONS.md, docs/CONVENTIONS.md, .cursor/rules/CONVENTIONS.md, AGENTS.md, CONTRIBUTING.md. Returns { found: false } when no match exists so the agent can fall back gracefully.

InputTypeNotes
rootDirstring (optional)Project root.

find_examples

Finds example components matching a free-form pattern (e.g. "modal", "form", "data-table"). Scores matches by component name (10), file path (5), then source body (1), and returns the top results sorted by descending score.

InputTypeNotes
rootDirstring (optional)Project root.
patternstring (required)Search pattern, case-insensitive.
limitnumber (optional)Max results. Defaults to 10.

Design notes

A few things this server does on purpose, and why:

  • Regex over full AST. Parsing TypeScript is expensive and brittle for a starter MCP server. The agent consuming this output has its own filesystem access for the rare edge cases that need precision; the goal here is fast, good-enough context, not a compiler.
  • JSON-stringified responses. Every tool returns content[0].text as pretty-printed JSON. That gives the agent a single, structured shape it can parse or pass back into another tool.
  • Heuristic framework detection. Looks at dependencies first (next → Next, astro → Astro, etc.), then known config files. Returns unknown rather than guessing on weak signals.
  • No project-state mutation. Tools are strictly read-only. The agent can write code on its own; this server's job is to inform that writing, not perform it.

Development

npm install           # install dependencies
npm run dev           # run the server in stdio mode against cwd
npm run test          # run the vitest suite (uses examples/sample-project)
npm run lint          # eslint
npm run typecheck     # tsc --noEmit
npm run format        # prettier --write
npm run build         # compile to dist/

The examples/sample-project/ directory is a tiny Vite + React + TypeScript project that the test suite scans, so every tool exercises real I/O on real component files rather than mocks.

License

MIT

Ver o original no GitHub

Bom para

Relacionados