File size: 4,620 Bytes
06231f2
 
 
 
 
 
 
 
 
 
 
28bc89c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
---
title: BIBFRAME Ontology Documentation MCP Server
emoji: πŸ“š
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: "5.0.0"
app_file: app.py
pinned: false
---

# πŸ“š BIBFRAME Ontology Documentation MCP Server

A Model Context Protocol (MCP) server that provides BIBFRAME ontology documentation for LLMs like Claude. Built with Gradio, this server dynamically loads from the official BIBFRAME ontology at id.loc.gov.

## 🌐 Live Server

**Deployed at:** https://jimfhahn-mcp4bibframe-docs.hf.space  
**MCP Endpoint:** https://jimfhahn-mcp4bibframe-docs.hf.space/gradio_api/mcp/

## ✨ Features

- βœ… **MCP Server**: Full MCP protocol support for LLM integration
- πŸ“š **Live Ontology Data**: Loads from official BIBFRAME ontology
- πŸ” **Four MCP Tools**:
  - `get_property_info` - Detailed property information with examples
  - `get_class_info` - Class documentation with applicable properties
  - `search_ontology` - Search for properties or classes
  - `get_property_usage` - Context-specific usage information
- 🌐 **Web UI**: Interactive Gradio interface for testing
- ☁️ **Deployed on HF Spaces**: Hosted for free on Hugging Face

## πŸš€ Quick Start with Claude Desktop

Add this to your Claude Desktop configuration:

**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`  
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "bibframe-docs": {
      "url": "https://jimfhahn-mcp4bibframe-docs.hf.space/gradio_api/mcp/"
    }
  }
}
```

For a hosted version on Hugging Face Spaces:

```json
{
  "mcpServers": {
    "bibframe-docs": {
      "url": "https://YOUR-USERNAME-mcp4bibframe-docs.hf.space/gradio_api/mcp/sse"
    }
  }
}
```

**Note**: Claude Desktop currently requires the `mcp-remote` bridge for SSE servers:

```json
{
  "mcpServers": {
    "bibframe-docs": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:7860/gradio_api/mcp/sse"
      ]
    }
  }
}
```

## Deploying to Hugging Face Spaces

1. Create a new Space on [Hugging Face](https://huggingface.co/spaces)
2. Choose "Gradio" as the SDK
3. Push this repository to your Space
4. The MCP server will be available at: `https://YOUR-USERNAME-SPACE-NAME.hf.space/gradio_api/mcp/sse`

### Private Spaces

For private Spaces, add your Hugging Face token:

```json
{
  "mcpServers": {
    "bibframe-docs": {
      "url": "https://YOUR-SPACE.hf.space/gradio_api/mcp/sse",
      "headers": {
        "Authorization": "Bearer YOUR-HF-TOKEN"
      }
    }
  }
}
```

## MCP Tools Reference

### get_property_info
```
Get detailed information about a BIBFRAME property from the official ontology.

Args:
    property_uri (str): Full URI or short name (e.g., "bf:assigner" or "assigner")

Returns:
    JSON with property information, domain, range, examples, and usage guidance
```

### get_class_info
```
Get detailed information about a BIBFRAME class from the official ontology.

Args:
    class_name (str): Class name (e.g., "Work", "bf:Work", or full URI)

Returns:
    JSON with class information and applicable properties
```

### search_ontology
```
Search the BIBFRAME ontology for properties or classes matching a term.

Args:
    search_term (str): Term to search for
    search_type (str): Type of search - "properties", "classes", or "all"

Returns:
    JSON with matching properties and/or classes
```

### get_property_usage
```
Get usage information for a property, optionally in the context of a specific class.

Args:
    property_name (str): Property name (e.g., "assigner" or "bf:assigner")
    class_name (str): Optional class context (e.g., "AdminMetadata")

Returns:
    JSON with usage information and examples
```

## Testing with MCP Inspector

```bash
# Install MCP Inspector
npm install -g @modelcontextprotocol/inspector

# Test your server
npx @modelcontextprotocol/inspector http://localhost:7860/gradio_api/mcp/sse
```

## Data Sources

- [BIBFRAME Ontology](https://id.loc.gov/ontologies/bibframe.html) - Official ontology from Library of Congress
- [LC BIBFRAME Profiles](https://github.com/lcnetdev/bfe-profiles) - Application profiles
- [DCTap Validation](https://github.com/bf-interop/DCTap) - Community validation patterns

## Related Projects

- **For SHACL validation**: [mcp4rdf validator](https://huggingface.co/spaces/jimfhahn/mcp4rdf)
- **BIBFRAME Homepage**: https://www.loc.gov/bibframe/
- **BIBFRAME Documentation**: https://www.loc.gov/bibframe/docs/

## License

MIT License - See LICENSE file for details

## Contributing

Contributions welcome! Please open an issue or PR on GitHub.