MCP Integration Proxy

MCP Integration Proxy

Routes requests to multiple downstream Model Context Protocol servers and provides a LangGraph.js-based agent with RAG capabilities for development assistance.

Category
访问服务器

README

MCP Integration Challenge: Proxy & RAG Foundations

AI Protocol Engineer Challenge: Week 1

This repository contains the complete implementation for the MCP Integration, Proxy & RAG Foundations challenge using TypeScript/NodeJS with LangGraph.js.

Project Overview

This project implements a comprehensive MCP (Model Context Protocol) ecosystem including:

  • MCP Proxy Server: Routes requests to multiple downstream MCP servers
  • Dev Assistant Agent: LangGraph.js-based agent with RAG capabilities
  • Mock Knowledge Base: Sample data for testing RAG functionality
  • MCP Client Tester: Testing tools for MCP server interactions
  • IDE Integration: Configuration for VS Code/Cursor MCP support

Architecture

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   IDE Client   │ ──▶│   MCP Proxy      │ ──▶│ Downstream MCP  │
│ (VS Code/Cursor)│    │     Server       │    │    Servers      │
└─────────────────┘    └──────────────────┘    └─────────────────┘
                                │                       │
                                ▼                       │
                       ┌──────────────────┐             │
                       │ Dev Assistant    │             │
                       │    Agent         │             │
                       │ (LangGraph.js)   │             │
                       └──────────────────┘             │
                                │                       │
                                ▼                       │
                       ┌──────────────────┐             │
                       │  RAG Pipeline    │             │
                       │ (LangChain JS)   │             │
                       └──────────────────┘             │
                                │                       │
                                ▼                       │
                       ┌──────────────────┐             │
                       │ Mock Knowledge   │◀────────────┘
                       │     Base         │
                       └──────────────────┘

Project Structure

mcp/
├── src/
│   ├── proxy/           # MCP Proxy Server implementation
│   ├── agent/           # Dev Assistant Agent with LangGraph.js
│   ├── rag/             # RAG setup and utilities
│   ├── client/          # MCP Client testing tools
│   ├── types/           # TypeScript type definitions
│   └── utils/           # Shared utilities
├── tests/               # Unit and integration tests
├── docs/                # Documentation
│   ├── protocols_understanding.md
│   ├── mcp_server_exploration.md
│   ├── advanced_mcp_concepts.md
│   ├── realtime_rag_notes.md
│   └── ide_mcp_integration.md
├── mock_knowledge_base/ # Sample data for RAG
│   ├── docs/
│   ├── code/
│   ├── tickets/
│   └── jira_tickets.json
├── package.json
├── tsconfig.json
└── README.md

Technology Stack

Core Technologies

  • Runtime: Node.js 18+
  • Language: TypeScript 5.5+
  • Agent Framework: LangGraph.js
  • RAG Framework: LangChain JS

Dependencies

  • Protocol Communication: Built-in fetch, axios
  • Agent Building: @langchain/langgraph
  • RAG Components: @langchain/community, langchain
  • Web Framework: Express.js
  • Testing: Vitest
  • Development: tsx, eslint, prettier

Quick Start

Prerequisites

  • Node.js 18 or later
  • npm or yarn package manager
  • Git

Installation

  1. Clone the repository:
git clone https://github.com/your-username/mcp.git
cd mcp
  1. Install dependencies:
npm install --legacy-peer-deps
  1. Build the project:
npm run build
  1. Run tests:
npm test

Running Components

1. MCP Proxy Server

npm run proxy:start
# Starts on http://localhost:8002

2. Dev Assistant Agent

npm run agent:start

3. MCP Client Tester

npm run client:test

4. Development Mode (Watch)

npm run dev

Environment Setup

Required Environment Variables

Create a .env file in the root directory:

# OpenAI API Key (for LangChain)
OPENAI_API_KEY=your_openai_api_key

# GitHub Token (for GitHub MCP server)
GITHUB_TOKEN=your_github_token

# Google Drive Credentials (for GDrive MCP server)
GOOGLE_DRIVE_CLIENT_ID=your_client_id
GOOGLE_DRIVE_CLIENT_SECRET=your_client_secret

# Atlassian Credentials (for Atlassian MCP server)
ATLASSIAN_API_TOKEN=your_atlassian_token
ATLASSIAN_INSTANCE_URL=your_instance_url

# Proxy Configuration
PROXY_PORT=8002
PROXY_HOST=localhost

# Logging
LOG_LEVEL=info

MCP Server Configuration

The proxy server can route to multiple downstream MCP servers:

Supported Servers

  • Filesystem: Local file system access
  • GitHub: Repository and issue management
  • Google Drive: Document access and management
  • Atlassian: JIRA and Confluence integration

Proxy Routing Configuration

// src/proxy/config.ts
export const serverRoutes = {
  'filesystem': 'http://localhost:8001',
  'github': 'http://localhost:8003', 
  'gdrive': 'http://localhost:8004',
  'atlassian': 'http://localhost:8005'
};

IDE Integration

VS Code Setup

  1. Install the Copilot Chat extension
  2. Add to your settings.json:
{
  "github.copilot.chat.mcp.include": [
    "http://localhost:8002/mcp"
  ]
}

Cursor Setup

  1. Open Cursor settings
  2. Add MCP server URL: http://localhost:8002/mcp

Testing

Run All Tests

npm test

Run Specific Test Suites

npm run test:proxy      # Proxy server tests
npm run test:agent      # Agent tests
npm run test:rag        # RAG pipeline tests
npm run test:client     # Client tests

Test Coverage

npm run test:coverage

Documentation

Development Workflow

Code Style

  • ESLint for linting
  • Prettier for formatting
  • TypeScript strict mode enabled

Git Workflow

# Format code
npm run format

# Lint code  
npm run lint

# Run tests before commit
npm test

# Build before push
npm run build

Features Implemented

✅ Task 1: Environment Setup & Protocol Study

  • [x] TypeScript/NodeJS environment with LangGraph.js
  • [x] Mock knowledge base structure
  • [x] Comprehensive MCP/A2A protocol documentation
  • [x] Target MCP server analysis

🔄 Upcoming Tasks

  • [ ] Task 2: Explore & Test Existing MCP Servers
  • [ ] Task 3: Design & Implement MCP Proxy Server
  • [ ] Task 4: Implement Basic RAG Agent with MCP Integration
  • [ ] Task 5: Research Advanced MCP Concepts
  • [ ] Task 6: Test MCP Proxy with IDE Integration
  • [ ] Task 7: Documentation & Stand-up Preparation

Troubleshooting

Common Issues

  1. Dependency conflicts: Use npm install --legacy-peer-deps
  2. TypeScript errors: Ensure TypeScript 5.5+ is installed
  3. Build failures: Check Node.js version (18+ required)
  4. Test failures: Verify environment variables are set

Getting Help

  1. Check the documentation for detailed guides
  2. Review the protocols understanding document
  3. Examine test files for usage examples
  4. Check GitHub issues for known problems

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Make changes and add tests
  4. Run npm test and npm run lint
  5. Commit changes: git commit -m 'Add new feature'
  6. Push to branch: git push origin feature/new-feature
  7. Submit a pull request

License

MIT License - see LICENSE file for details.

Contact

For questions or support, please open an issue on GitHub.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选