Trade Surveillance Support MCP Server

Trade Surveillance Support MCP Server

Automates trade surveillance support workflows by parsing inquiry emails, searching SQL configs and Java code using keyword-based metadata annotations, executing reports, and generating comprehensive responses.

Category
访问服务器

README

Trade Surveillance Support MCP Server

An MCP (Model Context Protocol) server designed to automate trade surveillance support workflows by integrating with your existing SQL configs and Java code repositories.

Overview

This MCP server enables you to:

  • Parse user inquiry emails - Extract key information from support emails automatically
  • Search SQL config files - Find relevant database queries and configurations
  • Search Java code - Locate report generation classes and methods
  • Execute Java reports - Run Java processes to generate data and reports
  • Generate response summaries - Create comprehensive responses for user inquiries

Installation

Prerequisites

  • Python 3.10 or higher
  • uv package manager (recommended) or pip

Install with uv (recommended)

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install the MCP server
uv pip install -e .

Install with pip

pip install -e .

Configuration

Setting up with VS Code

  1. Open VS Code Settings
  2. Search for "MCP"
  3. Add a new MCP server configuration:
{
  "mcp.servers": {
    "trade-surveillance": {
      "type": "stdio",
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/mcp_test_2",
        "run",
        "trade-surveillance-mcp"
      ]
    }
  }
}

Setting up with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "trade-surveillance": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/mcp_test_2",
        "run",
        "trade-surveillance-mcp"
      ]
    }
  }
}

macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

🎯 Keyword-Based Search (No File Paths!)

Instead of searching by file paths, this MCP server uses metadata annotations so Copilot can find files by what they do:

Example SQL annotation:

-- @keywords: trade, settlement, daily, reconciliation
-- @type: compliance_report
-- @description: Daily trade settlement reconciliation report

Example Java annotation:

/**
 * @keywords settlement, report, generator
 * @type report_generator
 * @description Generates daily settlement reports
 */

Result: Copilot searches by keywords like "settlement report" instead of file paths!

📚 Documentation:

Usage

With GitHub Copilot in VS Code

  1. Open a chat with Copilot
  2. Paste a user inquiry email
  3. Copilot will automatically use the MCP tools to:
    • Parse the email
    • Search for relevant configs by keywords (not file paths!)
    • Search for Java code by keywords
    • Execute reports
    • Generate a response

Example prompt:

I received this email from a user:

[Paste email content here]

Can you help me investigate and generate the necessary reports?

Available Tools

1. parse_email_inquiry

Extracts key information from user inquiry emails including inquiry type, trade IDs, time periods, and priority.

2. search_sql_configsMetadata-based search

Searches through your SQL configuration files by keywords instead of file paths. Files are searched using metadata annotations (see METADATA_GUIDE.md).

3. search_java_codeMetadata-based search

Locates Java classes and methods by keywords instead of file paths. Classes are found using javadoc annotations (see METADATA_GUIDE.md).

4. execute_java_report

Runs Java processes with the appropriate config files to generate reports.

5. rebuild_metadata_index

Rebuilds the search index by scanning all annotated SQL configs and Java files. Run this after adding new files or updating annotations.

6. generate_response_summary

Creates a comprehensive summary response for the user.

Project Structure

mcp_test_2/
├── trade_surveillance_mcp/
│   ├── __init__.py
│   └── server.py          # Main MCP server implementation
├── pyproject.toml          # Project dependencies
├── README.md
└── .github/
    └── copilot-instructions.md

Development

Running Locally

# Run the server directly
uv run trade-surveillance-mcp

# Or with Python
python -m trade_surveillance_mcp.server

Customization

You'll need to customize the server to work with your specific repository structure:

  1. Update search paths - Modify config_directory and code_directory parameters
  2. Implement email parsing - Add your email parsing logic in parse_email_inquiry
  3. Add file search - Implement actual file searching in search_sql_configs and search_java_code
  4. Configure Java execution - Add your Java classpath and execution logic in execute_java_report

Connecting to Your Repository

Point the MCP server to your actual config and code repositories:

# Example: Update default directories
@mcp.tool()
async def search_sql_configs(
    search_term: str,
    config_directory: str = "/path/to/your/sql/configs"
):
    # Your implementation

Next Steps

  1. MCP server is ready! - Restart VS Code to load it
  2. 📝 Annotate your files - Add metadata keywords to your SQL configs and Java code (QUICKSTART.md)
  3. 🔍 Build the index - Use rebuild_metadata_index tool in Copilot
  4. ⚙️ Customize paths - Update default directories in server.py to your repos
  5. 🎯 Test with Copilot - Paste a user email and let Copilot search by keywords!

Key Innovation: No More File Path Search! 🎉

Your SQL configs and Java files are now searchable by keywords:

  • Copilot finds files by what they do, not where they are
  • Search "settlement report" instead of remembering configs/reports/daily/settlement_v2.sql
  • See examples in examples/configs/ and examples/src/

Troubleshooting

Server not appearing in VS Code

  • Check the MCP server logs in VS Code Output panel
  • Verify the absolute path in configuration is correct
  • Ensure uv is installed and in PATH

Python version issues

  • Ensure Python 3.10+ is installed: python --version
  • Use uv for better environment management

Java execution errors

  • Verify Java is installed: java -version
  • Check classpath configuration
  • Ensure config files are accessible

Resources

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选