mcp -computer
获取电脑相关配置的mcp - mcp入门上手案例
claude mcp add --transport stdio jasonlat-dot-mcp-server-computer java -Dspring.ai.mcp.server.stdio=true -Dlogging.file.name=./data/mcp/${spring.application.name}.log -jar target/computer-mcp-server-1.0.jarHow to use
This MCP server provides a simple, introductory implementation for retrieving computer system information via the Model Context Protocol (MCP). It exposes tools to obtain core system data such as OS details, user information, Java runtime version, and hardware-related information, with cross-platform support for Windows, macOS, and Linux. After starting, MCP clients can query the server using the ComputerService exposed tools (e.g., queryComputerConfig) to receive structured JSON describing the current machine. The server is implemented with Spring Boot and Spring AI MCP tooling, and runs as a standard Java application packaged as a JAR.
To use, first ensure the server is running via the provided MCP client or by launching the JAR directly. If you launch directly, start the server with Java options that enable MCP stdio mode and direct logging to a file, for example: java -Dspring.ai.mcp.server.stdio=true -jar target/computer-mcp-server-1.0.jar. The server will listen through the MCP framework and respond to query requests such as queryComputerConfig, returning fields like osName, osVersion, osArch, userName, userHome, userDir, javaVersion, and osInfo. Clients can extend functionality by using the defined tools in ComputerService to add new capabilities as needed.
How to install
Prerequisites:
- Java 17 or higher installed and JAVA_HOME set
- Maven 3.6 or higher
- Git
-
Clone the repository git clone https://github.com/jasonlat-dot/mcp-server-computer cd computer-mcp-server
-
Build the project (Maven) mvn clean compile
-
Run tests (optional) mvn test
-
Package the application mvn clean package
The packaged JAR will be under target/computer-mcp-server-1.0.jar
-
Install to local Maven repository (optional) mvn clean install
JAR will be placed into your local Maven repository as described in the README
-
Run the server directly (example) java -Dspring.ai.mcp.server.stdio=true -jar target/computer-mcp-server-1.0.jar
Note: If you prefer running via MCP tooling, configure your MCP client to launch the server JAR with the same Java arguments used above.
Additional notes
Tips and common issues:
- Ensure JAVA_HOME points to a Java 17+ JDK installation to match the project requirements.
- When deploying on different OS, use absolute paths for logging and JAR location if needed to avoid path resolution issues.
- The MCP logging file is configured to ./data/mcp/${spring.application.name}.log; ensure the data/mcp directory exists and is writable.
- If the JAR cannot be found after build, verify the Maven package step completed successfully and that the path in the configuration matches the actual JAR location.
- For troubleshooting, check that the server runs in stdio mode (-Dspring.ai.mcp.server.stdio=true) to enable proper MCP I/O integration.
- The configuration example uses a relative target path; adjust to your deployment environment (e.g., absolute path) if your runtime working directory differs.