本项目提供了一系列工具和服务,用于解析库ID、获取库文档等,能帮助开发者更高效地进行开发工作。
npm install -g @upstash/context7-mcp
context7-mcp start --port 3001
在package.json中添加如下内容:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
}
}
}
const { Context7MCP } = require('@upstash/context7-mcp');
async function main() {
const mcp = new Context7MCP();
await mcp.start({ port: 3001 });
}
main().catch(console.error);
const config = {
port: 3002,
logLevel: 'debug',
apiEndpoints: ['api.example.com', 'docs.example.com']
};
const { Context7MCP } = require('@upstash/context7-mcp');
async function main() {
const mcp = new Context7MCP(config);
await mcp.start();
}
main().catch(console.error);
resolve-library-id将通用库名称解析为上下文7兼容的库ID。
libraryName(必需)get-library-docs使用上下文7兼容的库ID获取库文档。
context7CompatibleLibraryID(必需)topic(可选):聚焦于特定主题,例如“路由”、“钩子”tokens(可选,默认5000):返回的最大令牌数。小于配置的DEFAULT_MINIMUM_TOKENS值时会自动提升到该值。bun i
bun run build
如果出现此错误,请尝试使用bunx代替npx。
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
如果遇到类似Error: Cannot find module 'uriTemplate.js'的错误,请尝试使用以下命令:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"--node-options=--experimental-vm-modules",
"@upstash/context7-mcp@1.0.6"
]
}
}
}
@latest版本号。bunx作为替代方案。deno作为另一种选择。npx的原生fetch支持。npm install @upstash/context7-mcpcontext7-config.jsonnpx context7-mcp start --port 3001export DEFAULT_PORT=3002
export LOG_LEVEL=info
本项目遵循MIT许可证。查看LICENSE获取详细信息。
如需帮助或反馈,请访问GitHub仓库或联系email@example.com。
欢迎社区贡献!请参考CONTRIBUTING.md了解如何参与开发。