mcp-nextjs

Example MCP server with OAuth

GitHub Stars

79

User Rating

Not Rated

Favorites

0

Views

28

Forks

11

Issues

0

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Node.js 18.0.0以上
npm 8.0.0以上
+1 more

Installation

Installation

Prerequisites

Please specify required software and versions:
Node.js: 18.0.0 or higher
npm: 8.0.0 or higher
Claude Desktop: Latest version

Installation Steps

1. Clone Repository

bash
git clone https://github.com/run-llama/mcp-nextjs
cd mcp-nextjs

2. Install Dependencies

bash
npm install

3. Prisma Setup

bash
prisma generate
prisma db push

4. Start Server

bash
npm run dev

Troubleshooting

Common Issues

Issue: Server won't start Solution: Check Node.js version and reinstall dependencies. Issue: Not recognized by Claude Desktop Solution: Verify configuration file path and syntax.

Configuration

Configuration

Basic Configuration

Environment Variables

Required environment variables should be set in the .env file:
bash
DATABASE_URL="postgresql://user:pass@server/database"
AUTH_SECRET="any random string"
GOOGLE_CLIENT_ID="a Google OAuth client ID"
GOOGLE_CLIENT_SECRET="a Google OAuth client secret"
REDIS_URL="rediss://user:pass@host:6379"

Advanced Configuration

DATABASE_URL is required for OAuth authentication to work, where session information is stored.
REDIS_URL is necessary if you want to use SSE transport.

Examples

Examples

Basic Usage

Here are basic usage examples for the MCP server:

Programmatic Usage

javascript
// JavaScript example (Node.js)
const { MCPClient } = require('@modelcontextprotocol/client');

const client = new MCPClient();
await client.connect();

// Execute tool
const result = await client.callTool('toolName', {
  parameter1: 'value1',
  parameter2: 'value2'
});

console.log(result);

Automation Script

bash
#!/bin/bash

Batch processing example

for file in *.txt; do mcp-tool process "$file" done

Use Cases

Integration with Claude Desktop for developing applications using the MCP server
Using Cursor to connect to the MCP server for data processing
Enhancing development efficiency by integrating with the MCP server in VSCode
Debugging and validating the MCP server using MCP Inspector

Additional Resources

Author Information
LlamaIndex
United States of America

2,666

Followers

68

Repositories

0

Gists

0

Total Contributions