mcpprobego

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2025 License: MIT Imports: 6 Imported by: 0

README

mcp-probe-go

A Go-based MCP (Multi-Tool Code Processing) server for searching and extracting code using ElasticSearch and AST-grep, with support for code block extraction and advanced code queries.

Features

  • Search code in your repository using ElasticSearch queries.
  • Query code using ast-grep structural pattern matching.
  • Extract code blocks from files by line number or symbol name.
  • Supports filtering, context lines, test code inclusion, and output formatting.

Getting Started

Prerequisites
Build
cd cli
go build -o probe-mcp-server main.go
Run
./probe-mcp-server

The server will start and listen for stdio requests.

Usage

The server registers the following tools:

  • search_code: Search code using ElasticSearch queries.
  • query_code: Search code using ast-grep patterns.
  • extract_code: Extract code blocks by line or symbol.

Each tool exposes a set of arguments for flexible code search and extraction. See the code for details on each tool's options.

Development

  • Main server logic is in main.go and cli/main.go.
  • Tool handlers are in search_code.go, query_code.go, and extract_code.go.
  • Uses the mcp-go server framework.

License

MIT License. See LICENSE for details.

Documentation

Index

Constants

View Source
const ExtractCodeToolName = "extract_code"
View Source
const QueryCodeToolName = "query_code"
View Source
const SearchCodeToolName = "search_code"

Variables

This section is empty.

Functions

func ExtractCodeHandler

func ExtractCodeHandler(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)

func NewExtractCodeTool

func NewExtractCodeTool() mcp.Tool

func NewProbeMCPServer

func NewProbeMCPServer(name, version string) *server.MCPServer

NewProbeMCPServer returns a configured MCP server instance. The caller is responsible for starting the server (e.g., with server.ServeStdio).

func NewQueryCodeTool

func NewQueryCodeTool() mcp.Tool

func NewSearchCodeTool

func NewSearchCodeTool() mcp.Tool

func QueryCodeHandler

func QueryCodeHandler(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)

func SearchCodeHandler

func SearchCodeHandler(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL