Labsco
FuelLabs logo

Fuel Network & Sway Language

β˜… 7

from FuelLabs

Semantic search for Fuel Network and Sway Language documentation using a local vector database.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

Fuel Network & Sway Language MCP Server

This project provides a Model Context Protocol (MCP) server for the Fuel Network and Sway Language ecosystem. It allows IDEs (like Cursor) to search and interact with Fuel documentation directly within the development environment.

The server indexes Fuel and Sway documentation into a local Vectra vector database using open-source embeddings (via Transformers.js) for powerful semantic search capabilities.

Features

  • Local semantic search of docs.fuel.network content
  • No Docker dependency - runs with just Bun
  • Fast file-based vector storage with Vectra
  • Enhanced result filtering and formatting
  • Hybrid search with keyword fallback

Claude/Cursor Integration

Add to your MCP config file:

{
  "mcpServers": {
    "fuel-server": {
      "command": "bun",
      "args": ["run", "/absolute/path/to/fuel-mcp-server/src/cli.ts", "--transport", "stdio"]
    }
  }
}

Project Structure

.
β”œβ”€β”€ docs/                     # Markdown documentation files
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli.ts                # Main CLI entry point
β”‚   β”œβ”€β”€ server.ts             # MCP server factory
β”‚   β”œβ”€β”€ transports/
β”‚   β”‚   β”œβ”€β”€ stdio.ts          # STDIO transport
β”‚   β”‚   └── http.ts           # HTTP transport
β”‚   β”œβ”€β”€ chunker.ts            # Markdown chunking logic
β”‚   β”œβ”€β”€ indexer.ts            # Document indexing script
β”‚   β”œβ”€β”€ query.ts              # Search query script
β”‚   └── *.test.ts             # Test files
β”œβ”€β”€ vectra_index/             # Local vector database (created after indexing)
β”œβ”€β”€ package.json
└── README.md

Environment Variables

VariableDefaultDescription
VECTRA_INDEX_PATH./vectra_indexVector database location
EMBEDDING_MODELXenova/all-MiniLM-L6-v2Hugging Face model
CHUNK_SIZE2000Target tokens per chunk
NUM_RESULTS5Search results count
LOG_LEVELSet to debug for verbose output

Implementation Details

  • Chunking: Preserves code blocks, splits by paragraphs with context awareness
  • Indexing: Generates embeddings with enhanced metadata for better search
  • Querying: Semantic search with quality filtering and keyword fallback
  • MCP Server: Exposes search as tool via stdio communication
  • Storage: File-based Vectra index (no external database required)

API

MCP Tools

searchFuelDocs

  • query (string): Search query
  • nResults (number, optional): Number of results (default: 5)
  • includeScore (boolean, optional): Include relevance scores

provideStdContext

  • Returns Sway standard library paths and types

Development

# Install dependencies
bun install

# Run tests
bun test

# Index sample docs
bun run src/indexer.ts ./docs

# Test search functionality
bun run src/query.ts --run "test query"

# Start MCP server for development (STDIO)
bun run src/cli.ts

# Start MCP server for development (HTTP)
bun run src/cli.ts --transport http --port 3500