42 MCP Server

42 MCP Server

Exposes 42's intranet API via the Model Context Protocol, enabling LLM agents to access user information, projects, and campus data.

Category
访问服务器

README

42 MCP Server

English | 日本語

42 MCP Server is a server that exposes 42's intranet API through the Model Context Protocol (MCP). This enables LLM (Large Language Model) agents to safely and standardized access to 42's rich data (user information, projects, campus information, etc.).

Overview

This server abstracts requests to the 42 API and provides them in the form of resources and tools defined by MCP. It supports two transport modes, Stdio and HTTP, making it compatible with a wide range of clients from CLI tools to modern IDE extensions.

Features

  • Dual Transport: Supports both Stdio and HTTP.
  • 42 API Integration: Provides information about 42 users, projects, campuses, and more.
  • Tools: Equipped with many useful tools such as user search and Cursus level retrieval.

Prerequisites

  • Node.js (v20.x or later)
  • npm
  • 42 API client ID and secret

Setup

  1. Clone the repository:

    git clone https://github.com/smizuoch/42-mcp-server.git
    cd 42-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Get 42 API credentials: You need to create an OAuth application on the 42 intranet to get the client ID and secret.

    1. Access 42 OAuth Applications
    2. Log in with your 42 account
    3. Fill in the application details:
      • Name: Enter a name for your application (e.g., "42 MCP Server")
      • Redirect URI: Enter http://localhost:8080 (or any localhost URL)
      • Scopes: Select appropriate scopes (e.g., public for basic access)
    4. Click "Submit" to create the application
    5. Copy the generated Application ID and Secret
  4. Set up environment variables: Copy .env.example to create a .env file and fill in your 42 API credentials.

    cp .env.example .env
    

    Contents of .env file:

    42_CLIENT_ID=YOUR_42_CLIENT_ID
    42_CLIENT_SECRET=YOUR_42_CLIENT_SECRET
    

    Replace YOUR_42_CLIENT_ID with the Application ID and YOUR_42_CLIENT_SECRET with the Secret from step 3.

Usage

Development Mode

  • Stdio Mode: Communicates with MCP clients using standard input/output.

    npm run dev
    
  • HTTP Mode: Starts an HTTP server to communicate with MCP clients. Useful for VSCode extensions and similar tools.

    npm run dev:http
    

Production

  1. Build TypeScript:

    npm run build
    
  2. Start HTTP server:

    npm run start
    

    The server will start at http://127.0.0.1:8042.

VSCode Integration

  1. Start the server in HTTP mode:

    npm run dev:http
    

    You'll see logs like this in the terminal:

    MCP HTTP server ready on port 8042
    MCP endpoint: http://127.0.0.1:8042/
    Health check: http://127.0.0.1:8042/health
    
    VSCode Configuration (.vscode/mcp.json):
    {
      "servers": {
        "42-api": {
          "url": "http://127.0.0.1:8042/"
        }
      }
    }
    
  2. Create VSCode configuration file: Create a file named .vscode/mcp.json in the project root and paste the content shown in the logs above.

    .vscode/mcp.json:

    {
      "servers": {
        "42-api": {
          "url": "http://127.0.0.1:8042/"
        }
      }
    }
    
  3. After reloading VSCode, the extension will recognize the server and you can call resources and tools with prefixes like @42-api.

Provided MCP Features

Resources

URI Description
42://user/{id} User profile for the specified ID
42://me Profile of the currently authenticated user
42://campus List of all campuses
42://attachments List of all attachments
42://attachments/{id} Attachments for the specified project
42://projects List of all projects
42://project/{id} Project details for the specified ID
42://me/projects List of projects for the authenticated user
42://accreditations List of all accreditations
42://accreditation/{id} Accreditation details for the specified ID

Tools

Tool Name Description
searchUsers Search for users by login name.
getCursusLevel Get a user's level in a specific Cursus.
getUserProjects Get a list of user's projects.
getCoalition Get Coalition information for a user.
getCampusUsers Get campus-user associations by campus ID or user ID.
getBalances Get balance information (requires specific role).
getClusters Get cluster information (requires specific role).
getLocations Get user login status (seat information).
getAttachments Get a list of attachments for projects or project sessions.
getAttachment Get detailed information (such as PDF URLs) for a specific attachment.
getProjects Get a list of projects (with optional Cursus and filter specifications).
getProject Get detailed information for a specific project.
getMyProjects Get a list of projects for the authenticated user.
getAccreditations Get a list of accreditations with optional filtering by user, cursus, validation status.
getAccreditation Get detailed information for a specific accreditation.

Tech Stack

推荐服务器

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

官方
精选