Acemcp
Enables semantic code search across codebases with automatic incremental indexing. Searches return relevant code snippets with file paths and line numbers based on natural language queries.
README
Acemcp
MCP server for codebase indexing and semantic search.
Installation
uv add mcp httpx fastapi "uvicorn[standard]" toml websockets
uv sync
Configuration
The configuration file is automatically created at ~/.acemcp/settings.toml on first run with default values.
Edit ~/.acemcp/settings.toml to configure:
BATCH_SIZE = 10
MAX_LINES_PER_BLOB = 800
BASE_URL = "https://your-api-endpoint.com"
TOKEN = "your-bearer-token-here"
TEXT_EXTENSIONS = [".py", ".js", ".ts", ...]
EXCLUDE_PATTERNS = [".venv", "node_modules", ".git", "__pycache__", "*.pyc", ...]
Configuration options:
BATCH_SIZE: Number of files to upload per batch (default: 10)MAX_LINES_PER_BLOB: Maximum lines per blob before splitting large files (default: 800)BASE_URL: API endpoint URLTOKEN: Authentication tokenTEXT_EXTENSIONS: List of file extensions to indexEXCLUDE_PATTERNS: List of patterns to exclude from indexing (supports wildcards like*.pyc)
You can also configure via:
- Command line arguments (highest priority):
--base-url,--token - Web management interface (updates user config file)
- Environment variables with
ACEMCP_prefix
MCP Configuration
Add the following to your MCP client configuration (e.g., Claude Desktop):
Basic Configuration
{
"mcpServers": {
"acemcp": {
"command": "uvx",
"args": [
"acemcp"
]
}
}
}
Available command line arguments:
--base-url: Override BASE_URL configuration--token: Override TOKEN configuration--web-port: Enable web management interface on specified port (e.g., 8080)
Configuration with Web Management Interface
To enable the web management interface, add the --web-port argument:
{
"mcpServers": {
"acemcp": {
"command": "uvx",
"args": [
"acemcp",
"--web-port",
"8888"
]
}
}
}
Then access the management interface at http://localhost:8888
Web Management Features:
- Configuration Management: View and edit server configuration (BASE_URL, TOKEN, BATCH_SIZE, MAX_LINES_PER_BLOB, TEXT_EXTENSIONS)
- Real-time Logs: Monitor server logs in real-time via WebSocket connection
- Tool Debugger: Test and debug MCP tools directly from the web interface
- Test
index_codetool with any project path - Test
search_contexttool with project path and query - View formatted results and error messages
- Test
Tools
search_context
Search for relevant code context based on a query. This tool automatically performs incremental indexing before searching, ensuring results are always up-to-date. It performs semantic search across your codebase and returns formatted text snippets showing where relevant code is located.
Key Features:
- Automatic Incremental Indexing: Before each search, the tool automatically indexes only new or modified files, skipping unchanged files for efficiency
- No Manual Indexing Required: You don't need to manually index your project - just search and the tool handles indexing automatically
- Always Up-to-Date: Search results reflect the current state of your codebase
Parameters:
project_root_path(string): Absolute path to the project root directory- IMPORTANT: Use forward slashes (
/) as path separators, even on Windows - Windows example:
C:/Users/username/projects/myproject - Linux/Mac example:
/home/username/projects/myproject
- IMPORTANT: Use forward slashes (
query(string): Natural language search query to find relevant code context- Use descriptive keywords related to what you're looking for
- The tool performs semantic matching, not just keyword search
- Returns code snippets with file paths and line numbers
What it returns:
- Formatted text snippets from files that match your query
- File paths and line numbers for each snippet
- Context around the relevant code sections
- Multiple results ranked by relevance
Query Examples:
-
Finding configuration code:
{ "project_root_path": "C:/Users/username/projects/myproject", "query": "查找所有调用 get_model 的地方" }Returns: Code related to logging setup, logger initialization, and configuration
-
Finding authentication logic:
{ "project_root_path": "C:/Users/username/projects/myproject", "query": "user authentication login password validation" }Returns: Authentication handlers, login functions, password validation code
-
Finding database code:
{ "project_root_path": "C:/Users/username/projects/myproject", "query": "database connection pool initialization" }Returns: Database connection setup, pool configuration, initialization code
-
Finding error handling:
{ "project_root_path": "C:/Users/username/projects/myproject", "query": "error handling exception try catch" }Returns: Error handling patterns, exception handlers, try-catch blocks
-
Finding API endpoints:
{ "project_root_path": "C:/Users/username/projects/myproject", "query": "API endpoint routes HTTP handlers" }Returns: API route definitions, HTTP handlers, endpoint implementations
Tips for better results:
- Use multiple related keywords (e.g., "logging configuration setup" instead of just "logging")
- Include technical terms specific to what you're looking for
- Describe the functionality rather than exact variable names
- Try different phrasings if the first query doesn't return what you need
Indexing Features:
- Incremental Indexing: Only new or modified files are uploaded, unchanged files are skipped
- Hash-based Deduplication: Files are identified by SHA-256 hash of path + content
- Automatic Retry: Network requests are automatically retried up to 3 times with exponential backoff (1s, 2s, 4s)
- Batch Resilience: If a batch upload fails after retries, the tool continues with the next batch
- File Splitting: Large files are automatically split into multiple blobs (default: 800 lines per blob)
- Exclude Patterns: Automatically skips virtual environments, node_modules, .git, build artifacts, etc.
Search Features:
- Automatic Retry: Search requests are automatically retried up to 3 times with exponential backoff (2s, 4s, 8s)
- Graceful Degradation: Returns a clear error message if the search fails after all retries
- Timeout Handling: Uses a 60-second timeout to handle long-running searches
- Empty Result Handling: Returns a helpful message if no relevant code is found
Default Exclude Patterns:
.venv, venv, .env, env, node_modules, .git, .svn, .hg, __pycache__,
.pytest_cache, .mypy_cache, .tox, .eggs, *.egg-info, dist, build,
.idea, .vscode, .DS_Store, *.pyc, *.pyo, *.pyd, .Python,
pip-log.txt, pip-delete-this-directory.txt, .coverage, htmlcov,
.gradle, target, bin, obj
Patterns support wildcards (*, ?) and match against directory/file names or paths.
Usage
- Start the MCP server (automatically started by MCP client)
- Use
search_contextto search for code context- The tool automatically indexes your project before searching
- Incremental indexing ensures only new/modified files are uploaded
- No manual indexing step required!
Data Storage
- Configuration:
~/.acemcp/settings.toml - Indexed projects:
~/.acemcp/data/projects.json(fixed location) - Log files:
~/.acemcp/log/acemcp.log(with automatic rotation) - Projects are identified by their absolute path (normalized with forward slashes)
Logging
The application automatically logs to ~/.acemcp/log/acemcp.log with the following features:
- Console output: INFO level and above (colored output)
- File output: DEBUG level and above (detailed format with module, function, and line number)
- Automatic rotation: Log files are rotated when they reach 5MB
- Retention: Maximum of 10 log files are kept
- Compression: Rotated log files are automatically compressed to
.zipformat - Thread-safe: Logging is thread-safe for concurrent operations
Log format:
2025-11-06 13:51:25 | INFO | acemcp.server:main:103 - Starting acemcp MCP server...
The log files are automatically created on first run and require no manual configuration.
Web Management Interface
The web management interface provides:
- Real-time server status monitoring
- Live log streaming via WebSocket
- Configuration viewing (current settings)
- Project statistics (number of indexed projects)
To enable the web interface, use the --web-port argument when starting the server.
Features:
- Real-time log display with auto-scroll
- Server status and metrics
- Configuration overview
- Responsive design with Tailwind CSS
- No build step required (uses CDN resources)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。