Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ The server automatically fetches and indexes documentation from the [bucketeer-i

Configure the MCP Server by adding the following to your `mcp.json` or `claude_desktop_config.json` file, referring to the documentation for Cursor (https://docs.cursor.com/context/model-context-protocol#configuring-mcp-servers) and Claude Desktop (https://modelcontextprotocol.io/quickstart/user):

**Option 1: Using npm (Recommended)**
```json
{
"mcpServers": {
"bucketeer-docs": {
"type": "stdio",
"command": "npm",
"args": ["start", "--prefix", "/path/to/bucketeer-docs-local-mcp-server"]
}
}
}
```

**Option 2: Using node directly**
```json
{
"mcpServers": {
Expand All @@ -89,14 +103,14 @@ Configure the MCP Server by adding the following to your `mcp.json` or `claude_d

When the MCP server is running, the following tools are available:

### 1. `search-docs` - Search Bucketeer Documentation
### 1. `search_docs` - Search Bucketeer Documentation
- **Parameter**: `query` (string) - The search query
- **Parameter**: `limit` (number, optional) - Maximum number of results to return (default: 5)

**Example**:
```json
{
"name": "search-docs",
"name": "search_docs",
"arguments": {
"query": "feature flags SDK integration",
"limit": 5
Expand All @@ -106,13 +120,13 @@ When the MCP server is running, the following tools are available:

**Response**: Returns an array of search results with title, URL, path, description, excerpt, and relevance score.

### 2. `get-document` - Get Specific Document Content
### 2. `get_document` - Get Specific Document Content
- **Parameter**: `path` (string) - Document path obtained from search results

**Example**:
```json
{
"name": "get-document",
"name": "get_document",
"arguments": {
"path": "getting-started/create-feature-flag"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bucketeer-docs-local-mcp-server",
"version": "1.0.0",
"version": "0.0.1",
"description": "Local MCP Server to query Bucketeer documentation",
"main": "dist/main.js",
"type": "module",
Expand Down
1 change: 0 additions & 1 deletion src/core/indexing/githubDocumentFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ export class GithubDocumentFetcher {
`Error listing GitHub repository files from ${directory}:`,
error.message
);
// 型ガードでerrorがオブジェクトかつ'response'プロパティを持つ場合のみ処理
if (
typeof error === 'object' &&
error !== null &&
Expand Down
9 changes: 1 addition & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,4 @@ async function main() {
}
}

const scriptPath = fileURLToPath(import.meta.url);
const isDirectRun =
process.argv[1] &&
(process.argv[1] === scriptPath || process.argv[1].endsWith('/dist/main.js'));

if (isDirectRun) {
main();
}
main();
6 changes: 3 additions & 3 deletions src/mcp/tools/getDocumentTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type McpTextContent = { type: 'text'; text: string };

export function createGetDocumentTool(searchService: SearchService) {
return {
name: 'get-document',
name: 'get_document',
description:
'Retrieve the full content of a specific document by its path.',
inputSchema: z.object({
Expand All @@ -14,7 +14,7 @@ export function createGetDocumentTool(searchService: SearchService) {
execute: async ({ path }: { path: string }) => {
try {
console.error(
`[MCP Tool] Received get-document request for path: "${path}"`
`[MCP Tool] Received get_document request for path: "${path}"`
);
const document = searchService.getDocument(path);

Expand All @@ -33,7 +33,7 @@ export function createGetDocumentTool(searchService: SearchService) {
return { content: [responseContent] };
} catch (error) {
console.error(
`[MCP Tool] Error processing get-document request for path "${path}":`,
`[MCP Tool] Error processing get_document request for path "${path}":`,
error
);
const errorMessage =
Expand Down
6 changes: 3 additions & 3 deletions src/mcp/tools/searchTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type McpTextContent = { type: 'text'; text: string };

export function createSearchTool(searchService: SearchService) {
return {
name: 'search-docs',
name: 'search_docs',
description: 'Search for relevant documents in the documentation.',
inputSchema: z.object({
query: z.string().describe('The search query.'),
Expand All @@ -19,7 +19,7 @@ export function createSearchTool(searchService: SearchService) {
execute: async ({ query, limit }: { query: string; limit?: number }) => {
try {
console.error(
`[MCP Tool] Received search-docs request: "${query}" (limit: ${limit})`
`[MCP Tool] Received search_docs request: "${query}" (limit: ${limit})`
);
const results = await searchService.search(
query,
Expand All @@ -32,7 +32,7 @@ export function createSearchTool(searchService: SearchService) {
return { content: [responseContent] };
} catch (error) {
console.error(
`[MCP Tool] Error processing search-docs request for "${query}":`,
`[MCP Tool] Error processing search_docs request for "${query}":`,
error
);
const errorMessage =
Expand Down